Linux Driver for the azio levetron mech5 keyboard
- Macro buttons (a/b+a/b1-5)
- Toggling the lights
- demo:
for i in {0..3}; do echo $i | sudo tee /sys/bus/hid/devices/*:04D9:2819.*/azio-levetron-mech5/led; sleep 1; done
- demo:
- DKMS packaged in the AUR
- Win on/off key & state (seems like it's not possible)
- D1-6 Keys (default mapped to F1-6, they can be remapped with a patched hid descriptor)
- only attach sysfs to one of the hid devices
-
Key events
-
Control Values
The driver exposes the backlight leds via sysfs. Write 0-3 to
/sys/bus/hid/devices/0003:04D9:2819.XXXX/azio-levetron-mech5/led
where XXXX varies (e.g. 0008). 0-3 corresponds in binary to which led you want to be on or off. 0b00 = 0
means both lights off, 0b11 = 3
means both lights on. 1 = just macro key led on, 2 = just volume knob light on.
cd kernel-driver
Compile the driver
make
Load it from where it is
sudo insmod hid-azio-lv-mech5.ko
Replace the default generic driver
sudo ../misc/rebind.sh
Watch the debug messages
dmesg -w
Make changes and rebuild sudo rmmod hid-azio-lv-mech5 make ...
Note that rebind will only need to be run once.
Install dkms, yada yada yada. A package will be available in the archlinux AUR.
Requires Python 3.4+ and PyUSB
cd proof-of-concept
sudo python3 -i main.py
# to read the key states
>>> watch_special_keys()
# to set the backlight
>>> kbd = Mech5Keyboard()
>>> kbd.detach_kernel_driver()
>>> kbd.set_backlight(True, False)
>>> kbd.attach_kernel_driver()