3.9 KiB
3.9 KiB
Development Guide
Project Architecture
This project uses a userspace approach to configure the Azeron Cyborg keypad. Since Linux already recognizes the device as a HID device, we don't need a kernel driver. Instead, we communicate directly with the device using libusb to send configuration commands.
Directory Structure
libazeron/- Core C library for device communicationazeron-cli/- Command-line interface toolazeron-gui/- Python GUI application (planned)docs/- Documentationscripts/- Helper scripts and udev rules
Building from Source
Prerequisites
- CMake 3.10 or higher
- C compiler (GCC or Clang)
- libusb-1.0 development files
- json-c development files
Fedora/RHEL
sudo dnf install cmake gcc libusb1-devel json-c-devel
Ubuntu/Debian
sudo apt-get install cmake build-essential libusb-1.0-0-dev libjson-c-dev
Build Instructions
mkdir build
cd build
cmake ..
make
sudo make install
Build Options
# Debug build
cmake -DCMAKE_BUILD_TYPE=Debug ..
# Specify installation prefix
cmake -DCMAKE_INSTALL_PREFIX=/usr/local ..
# Build without udev rules
cmake -DINSTALL_UDEV_RULES=OFF ..
Development Workflow
1. Core Library Development
The libazeron library is the foundation. It handles:
- USB device detection and connection
- Configuration protocol implementation
- Error handling and logging
Key files:
libazeron/azeron.h- Public APIlibazeron/azeron.c- Implementationlibazeron/protocol.md- Protocol documentation
2. Testing Protocol
Since we may not have Windows software to reverse engineer from, we'll use a systematic approach:
- Device Enumeration: List all USB descriptors and endpoints
- Control Transfers: Test standard USB control transfers
- Interrupt Transfers: Monitor interrupt endpoints for data
- Configuration Commands: Try to discover configuration commands
- Response Analysis: Parse device responses
Useful tools:
lsusb -v -d 16d0:113c- Device informationusbhid-dump- HID report descriptorsevtest- Input event testing- Wireshark with USBPcap - Protocol analysis (if Windows available)
3. Adding New Features
- Implement feature in
libazeronfirst - Add CLI support in
azeron-cli - Add GUI support in
azeron-gui(if applicable) - Update documentation
- Add tests
Code Style
- C code follows Linux kernel style (indent with tabs)
- Functions should be documented with Doxygen comments
- Error handling: check all return values
- Memory management: free all allocated memory
- Use const where appropriate
Debugging
Enable Debug Output
# Set debug environment variable
export AZERON_DEBUG=1
azeron-cli list
USB Debugging
# Monitor USB traffic (requires root)
sudo usbmon -f -t > usb_trace.txt
# Use with azeron-cli to capture configuration commands
Common Issues
- Permission Denied: Install udev rules or run with sudo
- Device Not Found: Check USB connection and device permissions
- Configuration Not Applying: Ensure device is in configuration mode
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
Testing
Unit Tests
cd build
make test
Manual Testing
- Connect Azeron device
- Run
azeron-cli listto verify detection - Test button mapping:
azeron-cli map-button 5 KEY_W - Verify mapping works in game/application
- Test profile save/load functionality
Release Process
- Update version in CMakeLists.txt
- Update CHANGELOG.md
- Create git tag:
git tag -a v1.0.0 -m "Release version 1.0.0" - Push tag:
git push origin v1.0.0 - Create release packages