8BitDo Retro mechanical keyboard: udev rule

An annoying “feature” with this great keyboard is that it registers an additional USB HID as a mouse (/dev/input/mouse0) which supersedes my mouse or trackball device. I suspect it has to do with its included 2.4ghz adapter to work with their retro mouse, too, but I don’t own one.

While I know I can manually select “Mouse Index” to override the first mouse enumerated by RetroArch, for me, I’d rather suppress that Linux input bind altogether with a /etc/udev/rules.d/99-8bitdo-kbd.rules:

# 8BitDo Retro mechanical keyboard

# allow
SUBSYSTEM=="usb", ATTRS{idVendor}=="2dc8", ATTRS{idProduct}=="5200", MODE="0660", TAG+="uaccess"

# unbind
SUBSYSTEM=="usb", ACTION=="bind", ATTR{bInterfaceNumber}=="00", ATTRS{idVendor}=="2dc8", ATTRS{idProduct}=="5200", RUN+="/bin/sh -c ' \
	echo $kernel > /sys/bus/usb/drivers/usbhid/unbind ; \
	logger -t RETRO unbind $kernel ; \
'"

Onward to playing Final Burn Alpha Centipede with Cheevos. :nerd_face:

2 Likes

It may be worth noting that I also have a revision 1 model, whereas changing it to ATTRS{idProduct}=="520?" detects both the original “0” and extra crispy “1” revisions.

I also noticed that for whatever reason on boot that udev does not trigger USB 2 port #1 on the Pi 4B, perhaps because it erroneously assumes an attached Pi 400 keyboard waiting on the keyboard POWER button? If I remove the adapter and plug it back in, the rule to remove the “mouse” device works as expected.

However, if I move the 2.4ghz adapter to USB 2 port #2 or to either USB 3 ports, the udev rule works fine at boot and on hotplug events.

Go figure.

1 Like