Just found out by accident that someone created an #AUR repo for my keyboard mapper!
Just found out by accident that someone created an #AUR repo for my keyboard mapper!
No idea why my 8BitDo Retro Mechanical Keyboard configuration utility (#8bdkbd) #GitHub repository has been increasing starts a bit faster lately. Actually quite surprised it has this "many" stars.
I'm glad, since I put it out there so that it could help someone else. But since I've published it and configured my own keyboard, it's been pretty much fire and forget.
(Theory: maybe people got keyboards for Christmas and found the repo as they started using the keyboard?)
https://github.com/goncalor/8bitdo-kbd-mapper/
#8BitDo #retro #mechanical #keyboard #linux #foss #openSource
Just figured it out.
I had to unbind usbhid, not only hid-generic (PS: unbinding usbhid will also unbind hid-generic). And set the right permissions at the SUBSYSTEM=="usb" level.
Now when the keyboard is connected interface no. 2 gets unbound and permissions are correct such that python can read/write to that #USB interface. Without affecting the remaining interfaces.
Rules for reference (PROGRAM is just for debugging, RUN has the unbind action):
SUBSYSTEM=="usb", ATTRS{idVendor}=="2dc8", ATTRS{idProduct}=="5200", MODE="0660", TAG+="uaccess"
ACTION=="bind", SUBSYSTEM=="usb", ATTR{bInterfaceNumber}=="02", ATTRS{idVendor}=="2dc8", ATTRS{idProduct}=="5200", PROGRAM="/usr/bin/sh -c 'logger -p user.info usb matched! kernel=$kernel, number=$number, devpath=$devpath, id=$id, driver=$driver, major=$major, minor=$minor, result=$result, parent=$parent, name=$name, links=$links, root=$root, sys=$sys, devnode=$devnode'", RUN+="/usr/bin/sh -c 'echo $kernel > /sys/bus/usb/drivers/usbhid/unbind'"
Today, after reading the #udev #manpage and some other references I managed to write a udev rule to automatically unbind the USB interface of the keyboard, the one used to program it.
It was an interesting challenge because the keyboard has multiple interfaces under the same #USB vendor and product IDs and I only wanted to touch that specific interface.
There's something not quite right yet for my objective of manking my #8bdkbd utility able to run rootless though. Will keep experimenting later.