NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.38k stars 13.61k forks source link

USB HID evdev gamepad only works on certain USB ports #197433

Open r-burns opened 1 year ago

r-burns commented 1 year ago

Edit: see comment for more details, this only applies to the front panel USB ports

I have a USB gamepad which works on an Ubuntu 22.04 LTS live boot, but does not work on NixOS. The gamepad appears to be detected and initialized correctly, but pressing buttons only creates events on Ubuntu, and has no effect on NixOS. No manual setup or prerequisite packages are necessary on Ubuntu; the gamepad is simply plug and play, which makes me think this is an issue with NixOS.

The gamepad is this fightstick: https://junkfoodarcades.com/collections/lbx/products/lbx Using this firmware: https://github.com/JonnyHaystack/HayBox

The dmesg log on plugin looks like this on both distros:

[ 5771.837726] usb 1-1: new full-speed USB device number 7 using xhci_hcd
[ 5772.536395] usb 1-1: New USB device found, idVendor=2341, idProduct=8036, bcdDevice= 1.00
[ 5772.536400] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 5772.536401] usb 1-1: Product: Arduino Leonardo
[ 5772.536402] usb 1-1: Manufacturer: Arduino LLC
[ 5772.536403] usb 1-1: SerialNumber: HIDPCHIDGF
[ 5772.609168] cdc_acm 1-1:1.0: ttyACM0: USB ACM device
[ 5772.689239] input: Arduino LLC Arduino Leonardo as /devices/pci0000:00/0000:00:01.2/0000:01:00.0/usb1/1-1/1-1:1.2/0003:2341:8036.000D/input/input29
[ 5772.740801] hid-generic 0003:2341:8036.000D: input,hidraw6: USB HID v1.01 Keyboard [Arduino LLC Arduino Leonardo] on usb-0000:01:00.0-1/input2
[ 5772.775227] input: Arduino LLC Arduino Leonardo as /devices/pci0000:00/0000:00:01.2/0000:01:00.0/usb1/1-1/1-1:1.3/0003:2341:8036.000E/input/input30
[ 5772.775316] hid-generic 0003:2341:8036.000E: input,hidraw7: USB HID v1.01 Gamepad [Arduino LLC Arduino Leonardo] on usb-0000:01:00.0-1/input3

On both distros, these devices are created:

/dev/input/by-id/usb-Arduino_LLC_Arduino_Leonardo_HIDPCHIDGF-if02-event-kbd
/dev/input/by-id/usb-Arduino_LLC_Arduino_Leonardo_HIDPCHIDGF-if03-event-joystick
/dev/input/by-id/usb-Arduino_LLC_Arduino_Leonardo_HIDPCHIDGF-if03-joystick

When I cat either of the joystick devices on Ubuntu, pressing buttons on the gamepad prints data to the screen. On NixOS, when I do the same thing nothing happens.

Ubuntu 22.04 LTS is on 5.15.0-43-generic kernel. I am on NixOS unstable, and have tried the 5.15 and 5.19 kernels with the same result.

r-burns commented 1 year ago

Update: I did all the above testing on my front 2 USB ports. I also have 6 USB ports on the rear of my desktop - 4 USB3, and 2 USB2. The 4 lower ports all work! The 2 upper ports do not work.

It is also worth noting that the front ports work when booted into the Ubuntu live USB.

What I still do not understand is why this is happening!