How can I get the Moga Pro 2 Gamepad to work?

If I enable HID by using the physical switch on the Moga Pro 2 gamepad and pair it using Bluetooth with Debian 12, it works perfectly. A /dev/input/js device is created and every button works in jstest-gtk.

If I do the same on NixOS, no /dev/input/js device is created.

Anything special that needs to be done here?:wink:

That’s most likely a missing kernel module of some sort. Can you try having dmesg -w in a terminal while you connect that device?

On NixOS, I connect the Moga, like this:

[b0ef@t520:~]$ bluetoothctl scan on
Discovery started
[CHG] Controller EC:55:F9:F5:B4:79 Discovering: yes
[CHG] Device 00:1E:B5:8F:38:1F LegacyPairing: yes
[CHG] Device 00:1E:B5:8F:38:1F RSSI: 0xffffffc1 (-63)

[b0ef@t520:~]$ bluetoothctl connect 00:1E:B5:8F:38:1F
Attempting to connect to 00:1E:B5:8F:38:1F
[CHG] Device 00:1E:B5:8F:38:1F Connected: yes
[CHG] Device 00:1E:B5:8F:38:1F Paired: yes
Connection successful

[b0ef@t520:~]$ bluetoothctl info 00:1E:B5:8F:38:1F
Device 00:1E:B5:8F:38:1F (public)
        Name: Moga Pro 2 HID
        Alias: Moga Pro 2 HID
        Class: 0x00000508 (1288)
        Icon: input-gaming
        Paired: yes
        Bonded: no
        Trusted: yes
        Blocked: no
        Connected: yes
        WakeAllowed: yes
        LegacyPairing: yes
        UUID: Human Interface Device... (00001124-0000-1000-8000-00805f9b34fb)
        UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)
        Modalias: usb:v20D6p6271d0001

[b0ef@t520:~]$ bluetoothctl trust 00:1E:B5:8F:38:1F
Changing 00:1E:B5:8F:38:1F trust succeeded

This is everything that is printed out in dmesg:

[ 2892.841856] Bluetooth: HIDP (Human Interface Emulation) ver 1.2
[ 2892.841864] Bluetooth: HIDP socket layer initialized

On Debian, I see this in dmesg:

[  120.858110] Bluetooth: HIDP (Human Interface Emulation) ver 1.2
[  120.858120] Bluetooth: HIDP socket layer initialized
[  122.775906] hid-generic 0005:20D6:6271.0003: unknown main item tag 0x0
[  122.776133] input: Moga Pro 2 HID as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.4/1-1.4:1.0/bluetooth/hci0/hci0:12/0005:20D6:6271.0003/input/input29
[  122.776313] hid-generic 0005:20D6:6271.0003: input,hidraw2: BLUETOOTH HID v0.01 Gamepad [Moga Pro 2 HID] on 68:94:23:ed:10:33

If I do a diff on lsmod on Debian, before and after connecting, I see:

2,3c2
< hidp                   32768  1
< rfcomm                 94208  16
---
> rfcomm                 94208  4
26c25
< bluetooth             958464  51 btrtl,hidp,btmtk,btintel,btbcm,bnep,btusb,rfcomm
---
> bluetooth             958464  36 btrtl,btmtk,btintel,btbcm,bnep,btusb,rfcomm
126,127c125,126
< hid                   159744  4 hidp,wacom,usbhid,hid_generic
< i915                 3051520  11
---
> hid                   159744  3 wacom,usbhid,hid_generic
> i915                 3051520  4
150c149
< drm                   614400  9 drm_kms_helper,drm_display_helper,drm_buddy,thinkpad_acpi,i915,ttm
---
> drm                   614400  8 drm_kms_helper,drm_display_helper,drm_buddy,thinkpad_acpi,i915,ttm

I also have this hid and hidp loaded on NixOS, so I can’t really see a difference

With modprobe?

Well, Debian and NixOS’ kernels are quite different, NixOS’ will be newer and they have different configuration. This will be a fair bit of work to debug.

You could try a newer/older kernel on NixOS, at least, it’s possible this is a bug that has been resolved or not yet been reported.

No, I have not run modprobe to load these modules.

I’d also try a simple modprobe hidp just in case then.

That would have no effect, if hidp is already loaded, no?

I did try to rmmod hidp && modprobe hidp, but it just printed the same in dmesg:

[ 2907.701250] Bluetooth: HIDP (Human Interface Emulation) ver 1.2
[ 2907.701258] Bluetooth: HIDP socket layer initialized

I also tried rmmod hid_generic && modprobe hid_generic. This loaded my other hid devices, except the Moga Pro 2.

[ 3030.544334] input: CharaChorder CharaChorder 1 Mouse as /devices/pci0000:00/0000:00:1a.0/usb2/2-1/2-1.1/2-1.1:1.2/0003:239A:800F.0001/input/input19
[ 3030.544494] input: CharaChorder CharaChorder 1 Keyboard as /devices/pci0000:00/0000:00:1a.0/usb2/2-1/2-1.1/2-1.1:1.2/0003:239A:800F.0001/input/input20
[ 3030.596387] hid-generic 0003:239A:800F.0001: input,hidraw0: USB HID v1.01 Mouse [CharaChorder CharaChorder 1] on usb-0000:00:1a.0-1.1/input2

Yep, I assumed that was the debian side :wink:

Ok, I bought a new gamepad, the 8BitDo Ultimate C Bluetooth and the same thing happens. I see exactly the same dmesg messages.

It does work if I plug it directly with USB.

[ 1591.312865] usb 1-1.1: new full-speed USB device number 4 using ehci-pci
[ 1591.394878] usb 1-1.1: New USB device found, idVendor=057e, idProduct=2009, bcdDevice= 2.00
[ 1591.394900] usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1591.394907] usb 1-1.1: Product: Pro Controller
[ 1591.394912] usb 1-1.1: Manufacturer: Nintendo.Co.Ltd.
[ 1591.394917] usb 1-1.1: SerialNumber: 000000000001
[ 1591.397280] input: Nintendo.Co.Ltd. Pro Controller as /devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1.1/1-1.1:1.0/0003:057E:2009.0002/input/input19
[ 1591.397482] hid-generic 0003:057E:2009.0002: input,hidraw1: USB HID v1.11 Joystick [Nintendo.Co.Ltd. Pro Controller] on usb-0000:00:1d.0-1.1/input0
[ 1591.452242] nintendo 0003:057E:2009.0002: hidraw1: USB HID v81.11 Joystick [Nintendo.Co.Ltd. Pro Controller] on usb-0000:00:1d.0-1.1/input0
[ 1591.798577] nintendo 0003:057E:2009.0002: controller MAC = E4:17:D8:85:A1:AF
[ 1591.822578] nintendo 0003:057E:2009.0002: using factory cal for left stick
[ 1591.838491] nintendo 0003:057E:2009.0002: using factory cal for right stick
[ 1591.894384] nintendo 0003:057E:2009.0002: using factory cal for IMU
[ 1591.974530] nintendo 0003:057E:2009.0002: assigned player 1 led pattern
[ 1592.014716] input: Nintendo.Co.Ltd. Pro Controller as /devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1.1/1-1.1:1.0/0003:057E:2009.0002/input/input20
[ 1592.014820] input: Nintendo.Co.Ltd. Pro Controller (IMU) as /devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1.1/1-1.1:1.0/0003:057E:2009.0002/input/input21