Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to set up xpadneo on Raspberry Pi 2 running buster with kernel 6.6 #497

Open
6 of 41 tasks
defanator opened this issue Sep 28, 2024 · 7 comments
Open
6 of 41 tasks
Labels
0 | type: enhancement New feature or request

Comments

@defanator
Copy link

defanator commented Sep 28, 2024

Version of xpadneo

root@raspberrypi:/ # dkms status
hid-xpadneo, v0.9-175-g70ef8ee, 6.6.51-v7+, armv7l: installed

Controller Model

  • Xbox One S controller
  • Xbox Elite 2 controller
  • Xbox Series X|S controller (I guess - under the battery it says "Xbox Wireless Controller Model 1914")
  • Other:

Connection mode

  • Bluetooth connection
  • USB cable (not yet supported)
  • Xbox Dongle connection (not yet supported)

Installed Software

  • Anti-Micro (may affect button mappings)
  • OpenRGB (may mess up mappings and rumble stability)
  • Steam Input (enabled by default via Steam Desktop client)
  • Steam Link (usually via Raspberry Pi or other micro computers)
  • devices with QMK firmware (may affect udev rules, similar to OpenRGB)
  • netstick (shares input devices via network similar to Steam Link)
  • xboxdrv (user-space gamepad driver)
  • xone (kernel-space gamepad driver using the Xbox dongle or USB)
  • xow (alternative driver using the Xbox dongle)

Protocol Information

Please help us identify at which layer the problem can be found if you want
to report mapping errors or if the controller fails to be detected:

  • Steam Proton games are having issues
  • Steam Linux-native games are having issues
    • I don't use Steam or did not try
  • games running through Lutris, wine and/or Bottles are having issues
    • I don't use Lutris, Bottles, wine or did not try
  • Linux-native games are having issues
    • I don't use native games or did not try
  • Other software is having issues (describe software and issues below)
  • Running evtest is showing issues (describe the issues below)
    • Keep in mind that BTN_NORTH and BTN_WEST are intentionally swapped
  • Running jstest is showing issues (describe the issues below)
    • I don't have this tool or don't know how to use it
  • Running gamepad-tool is showing issues (post console output below)
    • I don't have this tool

Please describe how it is failing below in the next sections.

Severity / Impact

  • I've read the docs and the bug reporting instructions
  • I've applied the latest firmware update to the controller
  • I've tried disabling or running without above mentioned software
  • It does not work at all
  • It used to work in a previous version
  • It mostly works but sometimes it doesn't
  • I found a work-around
  • I probably didn't figure it all out but it's too early to give up
  • I don't know how to ...
  • It's too complicated
  • Fantastic work but ...
  • I can code and I want to help

Describe the Bug

I'm trying to set up an Xbox Wireless Controller with Raspberry Pi 2 running Raspbian 10 (buster) with latest available kernel (6.6.51-v7+). The final goal is to install RetroPie on that device, hence the choice of buster (RetroPie fails to install flawlessly on bullseye and newer releases).

I was using exactly that controller with exactly that Pi 2, but with another USB bluetooth adapter a few years back with either RetroPie own image, or Raspbian stretch with RetroPie installed manually - can not recall these days, but the thing is that it worked pretty well.

Now I'm using TP-Link UB400 adapter, and unfortunately it does not work with buster running original kernel (5.10.103) - device itself is visible, bluetooth service is running, but no BT devices can be found during scanning; i.e. the adapter is completely blind.

Things go better with the latest kernel I was able to install with rpi-update - 6.6.51. Adapter is visible and I can see all my BT devices in scanning mode, including Xbox controller.

However, when I try to actually pair and connect to the controller, literally nothing happens - it continues to blink with the X button and does not do rumble, while in bluetoothctl I can see that it is connected and paired, e.g.:

$ bluetoothctl
Agent registered
[bluetooth]# devices
Device F4:6A:D7:FC:E2:4C Xbox Wireless Controller
[CHG] Device F4:6A:D7:FC:E2:4C Connected: yes
[CHG] Device F4:6A:D7:FC:E2:4C ServicesResolved: yes
[Xbox Wireless Controller]# info
Device F4:6A:D7:FC:E2:4C (public)
	Name: Xbox Wireless Controller
	Alias: Xbox Wireless Controller
	Appearance: 0x03c4
	Icon: input-gaming
	Paired: no
	Trusted: yes
	Blocked: no
	Connected: yes
	LegacyPairing: no
	UUID: Vendor specific           (00000001-5f60-4c4f-9c83-a7953298d40d)
	UUID: Generic Access Profile    (00001800-0000-1000-8000-00805f9b34fb)
	UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
	UUID: Device Information        (0000180a-0000-1000-8000-00805f9b34fb)
	UUID: Battery Service           (0000180f-0000-1000-8000-00805f9b34fb)
	UUID: Human Interface Device    (00001812-0000-1000-8000-00805f9b34fb)
	Modalias: usb:v045Ep0B13d0522
	ManufacturerData Key: 0x0006
	ManufacturerData Value:
  03 00 80                                         ...
[Xbox Wireless Controller]# pair
Attempting to pair with F4:6A:D7:FC:E2:4C
[CHG] Device F4:6A:D7:FC:E2:4C Paired: yes
Pairing successful
[Xbox Wireless Controller]# info
Device F4:6A:D7:FC:E2:4C (public)
	Name: Xbox Wireless Controller
	Alias: Xbox Wireless Controller
	Appearance: 0x03c4
	Icon: input-gaming
	Paired: yes
	Trusted: yes
	Blocked: no
	Connected: yes
	LegacyPairing: no
	UUID: Vendor specific           (00000001-5f60-4c4f-9c83-a7953298d40d)
	UUID: Generic Access Profile    (00001800-0000-1000-8000-00805f9b34fb)
	UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
	UUID: Device Information        (0000180a-0000-1000-8000-00805f9b34fb)
	UUID: Battery Service           (0000180f-0000-1000-8000-00805f9b34fb)
	UUID: Human Interface Device    (00001812-0000-1000-8000-00805f9b34fb)
	Modalias: usb:v045Ep0B13d0522
	ManufacturerData Key: 0x0006
	ManufacturerData Value:
  03 00 80                                         ...
[Xbox Wireless Controller]#

I have tried to remove and re-pair it multiple times, the result is the same.

Then, I tried to figure out why it could happen and found out really weird thing: after rebooting I can't see uhid or hid-xpadneo modules loaded:

root@raspberrypi:/# lsmod | egrep -i -- "hid|xpad"
root@raspberrypi:/# 

But when I try to load xpadneo manually, I get this:

root@raspberrypi:/# modprobe -v hid-xpadneo
insmod /lib/modules/6.6.51-v7+/kernel/drivers/input/ff-memless.ko.xz 
insmod /lib/modules/6.6.51-v7+/kernel/drivers/hid/hid-xpadneo.ko.xz 
modprobe: ERROR: could not insert 'hid_xpadneo': Exec format error
root@raspberrypi:/#

I did not have any errors while installing the module with install.sh.

Steps to Reproduce

So, here's how I reached the above described stage:

  1. Installed buster from 2023-05-03-raspios-buster-armhf-lite.img (https://downloads.raspberrypi.com/raspios_oldstable_lite_armhf/images/raspios_oldstable_lite_armhf-2023-05-03/).
  2. Updated kernel to 6.6.51-v7+ #1799 SMP Thu Sep 26 16:09:25 BST 2024 armv7l GNU/Linux (with rpi-update).
  3. Installed RetroPie (default installation, no extra modules like xpad or xpadneo).
  4. Installed kernel sources with guidance from https://github.com/notro/rpi-source/wiki.
  5. Installed latest xpadneo (v0.9-175-g70ef8ee) with guidance from readme.

Expected Behavior

Xbox controller able to fully pair to be used in RetroPie.

Screenshots / GIFs / Videos

System Information

# uname -a
Linux raspberrypi 6.6.51-v7+ #1799 SMP Thu Sep 26 16:09:25 BST 2024 armv7l GNU/Linux
# xxd -c20 -g1 /sys/module/hid_xpadneo/drivers/hid:xpadneo/0005:045E:*/report_descriptor | tee >(cksum)
root@raspberrypi:/# xxd -c20 -g1 /sys/module/hid_xpadneo/drivers/hid:xpadneo/0005:045E:*/report_descriptor | tee >(cksum)
xxd: /sys/module/hid_xpadneo/drivers/hid:xpadneo/0005:045E:*/report_descriptor: No such file or directory
4294967295 0

Controller and Bluetooth Information

btmon output:

Bluetooth monitor ver 5.50
= Note: Linux version 6.6.51-v7+ (armv7l)                              0.691806
= Note: Bluetooth subsystem version 2.22                               0.691834
= New Index: 60:83:E7:5D:44:9A (Primary,USB,hci0)               [hci0] 0.691841
= Open Index: 60:83:E7:5D:44:9A                                 [hci0] 0.691844
= Index Info: 60:83:E7:5.. (Realtek Semiconductor Corporation)  [hci0] 0.691850
@ MGMT Open: bluetoothd (privileged) version 1.22             {0x0001} 0.691857
@ MGMT Open: btmon (privileged) version 1.22                  {0x0002} 0.692232
> HCI Event: LE Meta Event (0x3e) plen 45                    #1 [hci0] 5.368656
      LE Extended Advertising Report (0x0d)
        Num reports: 1
        Entry 0
          Event type: 0x0013
            Props: 0x0013
              Connectable
              Scannable
              Use legacy advertising PDUs
            Data status: Complete
          Legacy PDU Type: ADV_IND (0x0013)
          Address type: Public (0x00)
          Address: F4:6A:D7:FC:E2:4C (OUI F4-6A-D7)
          Primary PHY: LE 1M
          Secondary PHY: No packets
          SID: no ADI field (0xff)
          TX power: 127 dBm
          RSSI: -62 dBm (0xc2)
          Periodic advertising invteral: 0.00 msec (0x0000)
          Direct address type: Public (0x00)
          Direct address: 00:00:00:00:00:00 (OUI 00-00-00)
          Data length: 0x13
        02 01 04 02 0a 14 03 19 c4 03 04 ff 06 00 00 03  ................
        03 12 18                                         ...             
< HCI Command: LE Set Extended Scan... (0x08|0x0042) plen 6  #2 [hci0] 5.369387
        Extended scan: Disabled (0x00)
        Filter duplicates: Disabled (0x00)
        Duration: 0 msec (0x0000)
        Period: 0.00 sec (0x0000)
> HCI Event: Command Complete (0x0e) plen 4                  #3 [hci0] 5.370674
      LE Set Extended Scan Enable (0x08|0x0042) ncmd 2
        Status: Success (0x00)
< HCI Command: LE Extended Create C.. (0x08|0x0043) plen 58  #4 [hci0] 5.370870
        Filter policy: White list is not used (0x00)
        Own address type: Public (0x00)
        Peer address type: Public (0x00)
        Peer address: F4:6A:D7:FC:E2:4C (OUI F4-6A-D7)
        Initiating PHYs: 0x07
        Entry 0: LE 1M
          Scan interval: 60.000 msec (0x0060)
          Scan window: 60.000 msec (0x0060)
          Min connection interval: 30.00 msec (0x0018)
          Max connection interval: 50.00 msec (0x0028)
          Connection latency: 0 (0x0000)
          Supervision timeout: 420 msec (0x002a)
          Min connection length: 0.000 msec (0x0000)
          Max connection length: 0.000 msec (0x0000)
        Entry 1: LE 2M
          Scan interval: 60.000 msec (0x0060)
          Scan window: 60.000 msec (0x0060)
          Min connection interval: 30.00 msec (0x0018)
          Max connection interval: 50.00 msec (0x0028)
          Connection latency: 0 (0x0000)
          Supervision timeout: 420 msec (0x002a)
          Min connection length: 0.000 msec (0x0000)
          Max connection length: 0.000 msec (0x0000)
        Entry 2: LE Coded
          Scan interval: 60.000 msec (0x0060)
          Scan window: 60.000 msec (0x0060)
          Min connection interval: 30.00 msec (0x0018)
          Max connection interval: 50.00 msec (0x0028)
          Connection latency: 0 (0x0000)
          Supervision timeout: 420 msec (0x002a)
          Min connection length: 0.000 msec (0x0000)
          Max connection length: 0.000 msec (0x0000)
> HCI Event: Command Status (0x0f) plen 4                    #5 [hci0] 5.372729
      LE Extended Create Connection (0x08|0x0043) ncmd 2
        Status: Success (0x00)
> HCI Event: LE Meta Event (0x3e) plen 31                    #6 [hci0] 5.594666
      LE Enhanced Connection Complete (0x0a)
        Status: Success (0x00)
        Handle: 16
        Role: Master (0x00)
        Peer address type: Public (0x00)
        Peer address: F4:6A:D7:FC:E2:4C (OUI F4-6A-D7)
        Local resolvable private address: 00:00:00:00:00:00 (Non-Resolvable)
        Peer resolvable private address: 00:00:00:00:00:00 (Non-Resolvable)
        Connection interval: 45.00 msec (0x0024)
        Connection latency: 0 (0x0000)
        Supervision timeout: 420 msec (0x002a)
        Master clock accuracy: 0x00
@ MGMT Event: Device Connected (0x000b) plen 32        {0x0002} [hci0] 5.594812
        LE Address: F4:6A:D7:FC:E2:4C (OUI F4-6A-D7)
        Flags: 0x00000008
          Unknown device flag (0x00000008)
        Data length: 19
        Flags: 0x04
          BR/EDR Not Supported
        TX power: 20 dBm
        Appearance: Gamepad (0x03c4)
        Company: Microsoft (6)
          Data: 00
        16-bit Service UUIDs (complete): 1 entry
          Human Interface Device (0x1812)
@ MGMT Event: Device Connected (0x000b) plen 32        {0x0001} [hci0] 5.594812
        LE Address: F4:6A:D7:FC:E2:4C (OUI F4-6A-D7)
        Flags: 0x00000008
          Unknown device flag (0x00000008)
        Data length: 19
        Flags: 0x04
          BR/EDR Not Supported
        TX power: 20 dBm
        Appearance: Gamepad (0x03c4)
        Company: Microsoft (6)
          Data: 00
        16-bit Service UUIDs (complete): 1 entry
          Human Interface Device (0x1812)
> HCI Event: LE Meta Event (0x3e) plen 4                     #7 [hci0] 5.617776
      LE Channel Selection Algorithm (0x14)
        Handle: 16
        Algorithm: #1 (0x00)
< HCI Command: LE Read Remote Used F.. (0x08|0x0016) plen 2  #8 [hci0] 5.663951
        Handle: 16
> HCI Event: Command Status (0x0f) plen 4                    #9 [hci0] 5.665704
      LE Read Remote Used Features (0x08|0x0016) ncmd 2
        Status: Success (0x00)
> HCI Event: LE Meta Event (0x3e) plen 11                   #10 [hci0] 5.707670
      LE Data Length Change (0x07)
        Handle: 16
        Max TX octets: 251
        Max TX time: 2120
        Max RX octets: 251
        Max RX time: 2120
> HCI Event: LE Meta Event (0x3e) plen 12                   #11 [hci0] 5.797674
      LE Read Remote Used Features (0x04)
        Status: Success (0x00)
        Handle: 16
        Features: 0xa1 0x00 0x00 0x00 0x00 0x00 0x00 0x00
          LE Encryption
          LE Data Packet Length Extension
          Extended Scanner Filter Policies
= bluetoothd[410]: input-hog profile accept failed for F4:6A:D7:FC..   5.836018
< ACL Data TX: Handle 16 flags 0x00 dlen 7                  #12 [hci0] 5.835631
      ATT: Exchange MTU Request (0x02) len 2
        Client RX MTU: 517
> HCI Event: Number of Completed Packets (0x13) plen 5      #13 [hci0] 5.841708
        Num handles: 1
        Handle: 16
        Count: 1
> ACL Data RX: Handle 16 flags 0x02 dlen 7                  #14 [hci0] 5.904991
      ATT: Exchange MTU Response (0x03) len 2
        Server RX MTU: 23
< ACL Data TX: Handle 16 flags 0x00 dlen 7                  #15 [hci0] 5.905678
      ATT: Read Request (0x0a) len 2
        Handle: 0x0014
> HCI Event: Number of Completed Packets (0x13) plen 5      #16 [hci0] 5.931690
        Num handles: 1
        Handle: 16
        Count: 1
> ACL Data RX: Handle 16 flags 0x02 dlen 6                  #17 [hci0] 5.993600
      ATT: Read Response (0x0b) len 1
        Value: 32
< ACL Data TX: Handle 16 flags 0x00 dlen 7                  #18 [hci0] 5.994175
      ATT: Read Request (0x0a) len 2
        Handle: 0x000d
> HCI Event: Number of Completed Packets (0x13) plen 5      #19 [hci0] 6.021692
        Num handles: 1
        Handle: 16
        Count: 1
> ACL Data RX: Handle 16 flags 0x02 dlen 12                 #20 [hci0] 6.083589
      ATT: Read Response (0x0b) len 7
        Value: 025e04130b2205
< ACL Data TX: Handle 16 flags 0x00 dlen 7                  #21 [hci0] 6.084019
      ATT: Read Request (0x0a) len 2
        Handle: 0x0003
> HCI Event: Number of Completed Packets (0x13) plen 5      #22 [hci0] 6.111688
        Num handles: 1
        Handle: 16
        Count: 1
> ACL Data RX: Handle 16 flags 0x02 dlen 27                 #23 [hci0] 6.173580
      ATT: Read Response (0x0b) len 22
        Value: 58626f7820576972656c65737320436f6e74726f6c6c
< ACL Data TX: Handle 16 flags 0x00 dlen 7                  #24 [hci0] 6.174117
      ATT: Read Request (0x0a) len 2
        Handle: 0x0005
> HCI Event: Number of Completed Packets (0x13) plen 5      #25 [hci0] 6.201691
        Num handles: 1
        Handle: 16
        Count: 1
> ACL Data RX: Handle 16 flags 0x02 dlen 7                  #26 [hci0] 6.263606
      ATT: Read Response (0x0b) len 2
        Value: c403
< ACL Data TX: Handle 16 flags 0x00 dlen 11                 #27 [hci0] 6.264115
      ATT: Read By Group Type Request (0x10) len 6
        Handle range: 0x0001-0xffff
        Attribute group type: Primary Service (0x2800)
> HCI Event: Number of Completed Packets (0x13) plen 5      #28 [hci0] 6.291711
        Num handles: 1
        Handle: 16
        Count: 1
> ACL Data RX: Handle 16 flags 0x02 dlen 24                 #29 [hci0] 6.354907
      ATT: Read By Group Type Response (0x11) len 19
        Attribute data length: 6
        Attribute group list: 3 entries
        Handle range: 0x0001-0x0007
        UUID: Generic Access Profile (0x1800)
        Handle range: 0x0008-0x0008
        UUID: Generic Attribute Profile (0x1801)
        Handle range: 0x0009-0x0011
        UUID: Device Information (0x180a)
< ACL Data TX: Handle 16 flags 0x00 dlen 9                  #30 [hci0] 6.355491
      ATT: Write Request (0x12) len 4
        Handle: 0x0015
          Data: 0100
> HCI Event: Number of Completed Packets (0x13) plen 5      #31 [hci0] 6.381686
        Num handles: 1
        Handle: 16
        Count: 1
> ACL Data RX: Handle 16 flags 0x02 dlen 5                  #32 [hci0] 6.443614
      ATT: Write Response (0x13) len 0
< ACL Data TX: Handle 16 flags 0x00 dlen 9                  #33 [hci0] 6.444271
      ATT: Read Blob Request (0x0c) len 4
        Handle: 0x0003
        Offset: 0x0016
> HCI Event: Number of Completed Packets (0x13) plen 5      #34 [hci0] 6.471733
        Num handles: 1
        Handle: 16
        Count: 1
> ACL Data RX: Handle 16 flags 0x02 dlen 7                  #35 [hci0] 6.533595
      ATT: Read Blob Response (0x0d) len 2
        65 72                                            er              
< ACL Data TX: Handle 16 flags 0x00 dlen 11                 #36 [hci0] 6.534529
      ATT: Read By Group Type Request (0x10) len 6
        Handle range: 0x0012-0xffff
        Attribute group type: Primary Service (0x2800)
> HCI Event: Number of Completed Packets (0x13) plen 5      #37 [hci0] 6.561708
        Num handles: 1
        Handle: 16
        Count: 1
> ACL Data RX: Handle 16 flags 0x02 dlen 18                 #38 [hci0] 6.623610
      ATT: Read By Group Type Response (0x11) len 13
        Attribute data length: 6
        Attribute group list: 2 entries
        Handle range: 0x0012-0x0015
        UUID: Battery Service (0x180f)
        Handle range: 0x0016-0x0023
        UUID: Human Interface Device (0x1812)
< ACL Data TX: Handle 16 flags 0x00 dlen 11                 #39 [hci0] 6.624277
      ATT: Read By Group Type Request (0x10) len 6
        Handle range: 0x0024-0xffff
        Attribute group type: Primary Service (0x2800)
> HCI Event: Number of Completed Packets (0x13) plen 5      #40 [hci0] 6.651707
        Num handles: 1
        Handle: 16
        Count: 1
> ACL Data RX: Handle 16 flags 0x02 dlen 26                 #41 [hci0] 6.713612
      ATT: Read By Group Type Response (0x11) len 21
        Attribute data length: 20
        Attribute group list: 1 entry
        Handle range: 0x0024-0x002a
        UUID: Vendor specific (00000001-5f60-4c4f-9c83-a7953298d40d)
< ACL Data TX: Handle 16 flags 0x00 dlen 11                 #42 [hci0] 6.714428
      ATT: Read By Group Type Request (0x10) len 6
        Handle range: 0x002b-0xffff
        Attribute group type: Primary Service (0x2800)
> HCI Event: Number of Completed Packets (0x13) plen 5      #43 [hci0] 6.741720
        Num handles: 1
        Handle: 16
        Count: 1
> ACL Data RX: Handle 16 flags 0x02 dlen 9                  #44 [hci0] 6.805439
      ATT: Error Response (0x01) len 4
        Read By Group Type Request (0x10)
        Handle: 0x002b
        Error: Attribute Not Found (0x0a)

dmesg:

# dmesg -T | egrep -i 'hid|input|xpadneo'
[Sat Sep 28 13:23:52 2024] hid: raw HID events driver (C) Jiri Kosina
[Sat Sep 28 13:23:52 2024] usbcore: registered new interface driver usbhid
[Sat Sep 28 13:23:52 2024] usbhid: USB HID core driver
[Sat Sep 28 13:23:55 2024] input: Microsoft Microsoft\xc2\xae Nano Transceiver v2.0 as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.5/1-1.5:1.0/0003:045E:0800.0001/input/input0
[Sat Sep 28 13:23:55 2024] hid-generic 0003:045E:0800.0001: input,hidraw0: USB HID v1.11 Keyboard [Microsoft Microsoft\xc2\xae Nano Transceiver v2.0] on usb-3f980000.usb-1.5/input0
[Sat Sep 28 13:23:55 2024] input: Microsoft Microsoft\xc2\xae Nano Transceiver v2.0 Mouse as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.5/1-1.5:1.1/0003:045E:0800.0002/input/input1
[Sat Sep 28 13:23:55 2024] input: Microsoft Microsoft\xc2\xae Nano Transceiver v2.0 Consumer Control as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.5/1-1.5:1.1/0003:045E:0800.0002/input/input2
[Sat Sep 28 13:23:55 2024] hid-generic 0003:045E:0800.0002: input,hidraw1: USB HID v1.11 Mouse [Microsoft Microsoft\xc2\xae Nano Transceiver v2.0] on usb-3f980000.usb-1.5/input1
[Sat Sep 28 13:23:56 2024] input: Microsoft Microsoft\xc2\xae Nano Transceiver v2.0 Consumer Control as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.5/1-1.5:1.2/0003:045E:0800.0003/input/input3
[Sat Sep 28 13:23:56 2024] input: Microsoft Microsoft\xc2\xae Nano Transceiver v2.0 System Control as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.5/1-1.5:1.2/0003:045E:0800.0003/input/input5
[Sat Sep 28 13:23:56 2024] hid-generic 0003:045E:0800.0003: input,hiddev96,hidraw2: USB HID v1.11 Device [Microsoft Microsoft\xc2\xae Nano Transceiver v2.0] on usb-3f980000.usb-1.5/input2
[Sat Sep 28 13:26:02 2024] module hid_xpadneo: .gnu.linkonce.this_module section size must match the kernel's built struct module size at run time

lsusb:

# lsusb
Bus 001 Device 006: ID 045e:0800 Microsoft Corp. 
Bus 001 Device 005: ID 0b05:17ba ASUSTek Computer, Inc. N10 Nano 802.11n Network Adapter [Realtek RTL8192CU]
Bus 001 Device 004: ID 2357:0604 TP-Link 
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

lsusb verbose:

# lsusb -v -s 004

Bus 001 Device 004: ID 2357:0604 TP-Link 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass          224 Wireless
  bDeviceSubClass         1 Radio Frequency
  bDeviceProtocol         1 Bluetooth
  bMaxPacketSize0        64
  idVendor           0x2357 TP-Link
  idProduct          0x0604 
  bcdDevice            2.00
  iManufacturer           1  
  iProduct                2 TP-Link Bluetooth USB Adapter
  iSerial                 3 6083E75D449A
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x00b1
    bNumInterfaces          2
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xe0
      Self Powered
      Remote Wakeup
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           3
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              4 Bluetooth Radio
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0010  1x 16 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              4 Bluetooth Radio
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0000  1x 0 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0000  1x 0 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       1
      bNumEndpoints           2
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              4 Bluetooth Radio
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0009  1x 9 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0009  1x 9 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       2
      bNumEndpoints           2
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              4 Bluetooth Radio
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0011  1x 17 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0011  1x 17 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       3
      bNumEndpoints           2
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              4 Bluetooth Radio
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0019  1x 25 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0019  1x 25 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       4
      bNumEndpoints           2
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              4 Bluetooth Radio
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0021  1x 33 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0021  1x 33 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       5
      bNumEndpoints           2
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              4 Bluetooth Radio
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0031  1x 49 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0031  1x 49 bytes
        bInterval               1
can't get debug descriptor: Resource temporarily unavailable
Device Status:     0x0001
  Self Powered

Additional Context

JFTR, with the original 5.10.103 kernel I saw these errors in systemctl status bluetooth output:

May 03 03:17:07 raspberrypi systemd[1]: Started Bluetooth service.
May 03 03:17:07 raspberrypi bluetoothd[402]: Starting SDP server
May 03 03:17:08 raspberrypi bluetoothd[402]: Bluetooth management interface 1.18 initialized
May 03 03:17:09 raspberrypi bluetoothd[402]: Sap driver initialization failed.
May 03 03:17:09 raspberrypi bluetoothd[402]: sap-server: Operation not permitted (1)
May 03 03:17:09 raspberrypi bluetoothd[402]: Failed to set privacy: Rejected (0x0b)

With the 6.6.51 kernel (current setup I'm struggling with) I am seeing this:

# systemctl status bluetooth
● bluetooth.service - Bluetooth service
   Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2024-09-28 13:23:51 BST; 14min ago
     Docs: man:bluetoothd(8)
 Main PID: 410 (bluetoothd)
   Status: "Running"
    Tasks: 1 (limit: 2055)
   CGroup: /system.slice/bluetooth.service
           └─410 /usr/lib/bluetooth/bluetoothd

Sep 28 13:23:51 raspberrypi systemd[1]: Starting Bluetooth service...
Sep 28 13:23:51 raspberrypi bluetoothd[410]: Bluetooth daemon 5.50
Sep 28 13:23:51 raspberrypi systemd[1]: Started Bluetooth service.
Sep 28 13:23:51 raspberrypi bluetoothd[410]: Starting SDP server
Sep 28 13:23:51 raspberrypi bluetoothd[410]: Bluetooth management interface 1.22 initialized
Sep 28 13:23:51 raspberrypi bluetoothd[410]: Sap driver initialization failed.
Sep 28 13:23:51 raspberrypi bluetoothd[410]: sap-server: Operation not permitted (1)
Sep 28 13:23:51 raspberrypi bluetoothd[410]: Failed to set privacy: Rejected (0x0b)
Sep 28 13:31:31 raspberrypi bluetoothd[410]: input-hog profile accept failed for F4:6A:D7:FC:E2:4C
Sep 28 13:31:32 raspberrypi bluetoothd[410]: input-hog profile accept failed for F4:6A:D7:FC:E2:4C

Also, after I tried to disable ERTM with this:

# cat /etc/modprobe.d/bluetooth.conf 
options bluetooth disable_ertm=Y

and rebooted, I saw these errors a few times in journal logs:

Sep 28 13:47:45 raspberrypi bluetoothd[417]: input-hog profile accept failed for F4:6A:D7:FC:E2:4C
Sep 28 13:47:45 raspberrypi kernel: Bluetooth: hci0: security requested but not available
Sep 28 13:47:55 raspberrypi kernel: Bluetooth: hci0: security requested but not available

and this one in bluetoothctl after yet another remove + reconnect attempt:

Failed to pair: org.bluez.Error.AuthenticationCanceled
@defanator
Copy link
Author

Here's the module build log + modprobe errors afterwards:

xx@raspberrypi:~/git/xpadneo $ sudo ./install.sh 
* creating dkms.conf
* adding hid-xpadneo-v0.9-175-g70ef8ee folder to /usr/src
* installing module (using DKMS)

Creating symlink /var/lib/dkms/hid-xpadneo/v0.9-175-g70ef8ee/source ->
                 /usr/src/hid-xpadneo-v0.9-175-g70ef8ee

DKMS: add completed.

Kernel preparation unnecessary for this kernel.  Skipping...

Building module:
cleaning build area....
make -j4 KERNELRELEASE=6.6.51-v7+ -C /lib/modules/6.6.51-v7+/build M=/var/lib/dkms/hid-xpadneo/v0.9-175-g70ef8ee/build/src VERSION=v0.9-175-g70ef8ee modules.......
cleaning build area....

DKMS: build completed.

hid-xpadneo.ko.xz:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/6.6.51-v7+/kernel/drivers/hid/

Running the post_install script:
Not disabling ERTM, kernel version doesn't require it...
Installing modalias database...
Installing udev rules...
Reloading udev...

depmod.......

DKMS: install completed.

xx@raspberrypi:~/git/xpadneo $ sudo dkms status
hid-xpadneo, v0.9-175-g70ef8ee, 6.6.51-v7+, armv7l: installed

xx@raspberrypi:~/git/xpadneo $ sudo modprobe -v hid-xpadneo
insmod /lib/modules/6.6.51-v7+/kernel/drivers/input/ff-memless.ko.xz 
insmod /lib/modules/6.6.51-v7+/kernel/drivers/hid/hid-xpadneo.ko.xz 
modprobe: ERROR: could not insert 'hid_xpadneo': Exec format error

xx@raspberrypi:~/git/xpadneo $ dmesg -T | grep -i -- 'xpadneo'
[Sat Sep 28 14:39:26 2024] module hid_xpadneo: .gnu.linkonce.this_module section size must match the kernel's built struct module size at run time

@defanator
Copy link
Author

defanator commented Sep 28, 2024

I guess this is the issue - see vermagic still pointing to older kernel for some reason:

xx@raspberrypi:~/git/xpadneo $ modinfo hid-xpadneo
filename:       /lib/modules/6.6.51-v7+/kernel/drivers/hid/hid-xpadneo.ko.xz
version:        v0.9-175-g70ef8ee
description:    Linux kernel driver for Xbox ONE S+ gamepads (BT), incl. FF
author:         Kai Krakow <[email protected]>
author:         Florian Dollinger <[email protected]>
license:        GPL
srcversion:     2CDA9CB681685D13C24373F
alias:          hid:b0005g*v0000045Ep00000B13
alias:          hid:b0005g*v0000045Ep00000B22
alias:          hid:b0005g*v0000045Ep00000B05
alias:          hid:b0005g*v0000045Ep00000B20
alias:          hid:b0005g*v0000045Ep000002FD
alias:          hid:b0005g*v0000045Ep000002E0
depends:        ff-memless
name:           hid_xpadneo
vermagic:       5.10.103-v7+ SMP mod_unload modversions ARMv7 p2v8 
parm:           trigger_rumble_mode:(u8) Trigger rumble mode. 0: pressure, 2: disable. (byte)
parm:           rumble_attenuation:(u8) Attenuate the rumble strength: all[,triggers] 0 (none, full rumble) to 100 (max, no rumble). (array of byte)
parm:           ff_connect_notify:(bool) Connection notification using force feedback. 1: enable, 0: disable. (bool)
parm:           gamepad_compliance:(bool) Adhere to Linux Gamepad Specification by using signed axis values. 1: enable, 0: disable. (bool)
parm:           disable_deadzones:(bool) Disable dead zone handling for raw processing by Wine/Proton, confuses joydev. 0: disable, 1: enable. (bool)
parm:           enable_rolling_axis:(bool) Enable rolling axis by combining both triggers, out of spec for many games. (deprecated) 0: disable, 1: enable. (bool)
parm:           disable_shift_mode:(bool) Disable use Xbox logo button as shift. Will prohibit profile switching when enabled. 0: disable, 1: enable. (bool)
parm:           quirks:(string) Override or change device quirks, specify as: "MAC1{:,+,-}quirks1[,...16]", MAC format = 11:22:33:44:55:66, no pulse parameters = 1, no trigger rumble = 2, no motor masking = 4, use Linux button mappings = 16, use Nintendo mappings = 32, use Share button mappings = 64, reversed motor masking = 128 (array of charp)

rpi-source outputs:

xx@raspberrypi:~ $ sudo /usr/local/bin/rpi-source --tag-update

 *** SoC: BCM2836

 *** Arch: 32-bit

 *** Page Size: 4096

 *** Set update tag: 0fb4f88964fedce178bae4da05f5fd3fc0589f5a

xx@raspberrypi:~ $ sudo /usr/local/bin/rpi-source 

 *** SoC: BCM2836

 *** Arch: 32-bit

 *** Page Size: 4096

 *** Using: /usr/share/doc/raspberrypi-bootloader/changelog.Debian.gz

 *** Latest firmware revision: 41b70b52b54387bf105dfafd6b8ac4b0bb469d4d

 *** Linux source commit: 315314059f92c13bc7d34b6aaff7527aca68457c

 *** Kernel source already installed: /root/linux-315314059f92c13bc7d34b6aaff7527aca68457c

@defanator
Copy link
Author

Tried to point dkms to the kernel source location explicitly with this:

xx@raspberrypi:~/git/xpadneo $ git diff
diff --git a/install.sh b/install.sh
index 27df47f..11cbc82 100755
--- a/install.sh
+++ b/install.sh
@@ -1,4 +1,4 @@
-#!/bin/bash -e
+#!/bin/bash -ex
 
 cd "$(dirname "$0")" || exit 1
 source "lib/verbose.sh"
@@ -23,7 +23,7 @@ if [[ -z "${INSTALLED[*]}" ]]; then
     cp --recursive "${V[@]}" hid-xpadneo/. "/usr/src/hid-xpadneo-${VERSION}/."
 
     echo "* installing module (using DKMS)"
-    dkms install "${V[*]}" "hid-xpadneo/${VERSION}" --force || cat_dkms_make_log
+    dkms install "${V[*]}" "--kernelsourcedir=/root/linux-315314059f92c13bc7d34b6aaff7527aca68457c" "hid-xpadneo/${VERSION}" --force || cat_dkms_make_log
 
 else
 

But it didn't work:

xx@raspberrypi:~/git/xpadneo $ sudo ./install.sh 
++ dirname ./install.sh
+ cd .
+ source lib/verbose.sh
++ case "$1" in
+ source lib/installer.sh
++ '[' 0 -ne 0 ']'
+++ git rev-parse --show-toplevel
++ GIT_ROOT=/home/xx/git/xpadneo
+++ __version
+++ git describe --tags --dirty
++ VERSION=v0.9-175-g70ef8ee-dirty
+++ type -p dkms
++ DKMS_BIN=/usr/sbin/dkms
++ : /usr/sbin/dkms
++ INSTALLED=($(get_dkms_versions_installed))
+++ get_dkms_versions_installed
+++ /usr/sbin/dkms status
+++ tr -s ':,/ ' ' '
+++ awk -- '$1 == "hid-xpadneo" { print $2 }'
+++ sort -nu
+ [[ ! -d /sys/devices/virtual/misc/uhid ]]
+ [[ -z '' ]]
+ set -e
+ echo '* creating dkms.conf'
* creating dkms.conf
+ sed 's/"@DO_NOT_CHANGE@"/"v0.9-175-g70ef8ee-dirty"/g'
+ echo '* adding hid-xpadneo-v0.9-175-g70ef8ee-dirty folder to /usr/src'
* adding hid-xpadneo-v0.9-175-g70ef8ee-dirty folder to /usr/src
+ mkdir -p /usr/src/hid-xpadneo-v0.9-175-g70ef8ee-dirty
+ cp --recursive hid-xpadneo/. /usr/src/hid-xpadneo-v0.9-175-g70ef8ee-dirty/.
+ echo '* installing module (using DKMS)'
* installing module (using DKMS)
+ dkms install '' --kernelsourcedir=/root/linux-315314059f92c13bc7d34b6aaff7527aca68457c hid-xpadneo/v0.9-175-g70ef8ee-dirty --force

Creating symlink /var/lib/dkms/hid-xpadneo/v0.9-175-g70ef8ee-dirty/source ->
                 /usr/src/hid-xpadneo-v0.9-175-g70ef8ee-dirty

DKMS: add completed.

Preparing kernel 6.6.51-v7+ for module build:
(This is not compiling a kernel, just preparing kernel symbols)
Storing current .config to be restored when complete
Running Generic preparation routine
make mrproper..................
Warning: using /root/linux-315314059f92c13bc7d34b6aaff7527aca68457c/.config
(I hope this is the correct config for this kernel)
make oldconfig...............
make prepare-all....(bad exit status: 2)

Building module:
cleaning build area....
make -j4 KERNELRELEASE=6.6.51-v7+ -C /root/linux-315314059f92c13bc7d34b6aaff7527aca68457c M=/var/lib/dkms/hid-xpadneo/v0.9-175-g70ef8ee-dirty/build/src VERSION=v0.9-175-g70ef8ee-dirty modules....(bad exit status: 2)
Error! Bad return status for module build on kernel: 6.6.51-v7+ (armv7l)
Consult /var/lib/dkms/hid-xpadneo/v0.9-175-g70ef8ee-dirty/build/make.log for more information.
+ cat_dkms_make_log
+ local last_error=10
+ '[' -n '' ']'
+ exit 10

xx@raspberrypi:~/git/xpadneo $ cat /var/lib/dkms/hid-xpadneo/v0.9-175-g70ef8ee-dirty/build/make.log 
DKMS make.log for hid-xpadneo-v0.9-175-g70ef8ee-dirty for kernel 6.6.51-v7+ (armv7l)
Sat Sep 28 15:06:03 BST 2024
make: Entering directory '/root/linux-315314059f92c13bc7d34b6aaff7527aca68457c'
cp /var/lib/dkms/hid-xpadneo/v0.9-175-g70ef8ee-dirty/build/src/hid-xpadneo.c /var/lib/dkms/hid-xpadneo/v0.9-175-g70ef8ee-dirty/build/src/xpadneo.c
  CC [M]  /var/lib/dkms/hid-xpadneo/v0.9-175-g70ef8ee-dirty/build/src/xpadneo/core.o
  CC [M]  /var/lib/dkms/hid-xpadneo/v0.9-175-g70ef8ee-dirty/build/src/xpadneo/consumer.o
  CC [M]  /var/lib/dkms/hid-xpadneo/v0.9-175-g70ef8ee-dirty/build/src/xpadneo/keyboard.o
  CC [M]  /var/lib/dkms/hid-xpadneo/v0.9-175-g70ef8ee-dirty/build/src/xpadneo.o
In file included from ./include/asm-generic/int-ll64.h:11,
                 from ./arch/arm/include/uapi/asm/types.h:5,
                 from ./include/linux/bitops.h:4,
                 from ./include/linux/hid.h:17,
                 from /var/lib/dkms/hid-xpadneo/v0.9-175-g70ef8ee-dirty/build/src/xpadneo/../xpadneo.h:14,
                 from /var/lib/dkms/hid-xpadneo/v0.9-175-g70ef8ee-dirty/build/src/xpadneo/core.c:7:
./include/uapi/asm-generic/int-ll64.h:12:10: fatal error: asm/bitsperlong.h: No such file or directory
 #include <asm/bitsperlong.h>
          ^~~~~~~~~~~~~~~~~~~
In file included from ./include/asm-generic/int-ll64.h:11,
                 from ./arch/arm/include/uapi/asm/types.h:5,
                 from ./include/linux/bitops.h:4,
                 from ./include/linux/hid.h:17,
                 from /var/lib/dkms/hid-xpadneo/v0.9-175-g70ef8ee-dirty/build/src/xpadneo/../xpadneo.h:14,
                 from /var/lib/dkms/hid-xpadneo/v0.9-175-g70ef8ee-dirty/build/src/xpadneo/consumer.c:7:
./include/uapi/asm-generic/int-ll64.h:12:10: fatal error: asm/bitsperlong.h: No such file or directory
 #include <asm/bitsperlong.h>
          ^~~~~~~~~~~~~~~~~~~
compilation terminated.
compilation terminated.
In file included from ./include/asm-generic/int-ll64.h:11,
                 from ./arch/arm/include/uapi/asm/types.h:5,
                 from ./include/linux/bitops.h:4,
                 from ./include/linux/hid.h:17,
                 from /var/lib/dkms/hid-xpadneo/v0.9-175-g70ef8ee-dirty/build/src/xpadneo/../xpadneo.h:14,
                 from /var/lib/dkms/hid-xpadneo/v0.9-175-g70ef8ee-dirty/build/src/xpadneo/keyboard.c:7:
./include/uapi/asm-generic/int-ll64.h:12:10: fatal error: asm/bitsperlong.h: No such file or directory
 #include <asm/bitsperlong.h>
          ^~~~~~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [scripts/Makefile.build:280: /var/lib/dkms/hid-xpadneo/v0.9-175-g70ef8ee-dirty/build/src/xpadneo/core.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: *** [scripts/Makefile.build:280: /var/lib/dkms/hid-xpadneo/v0.9-175-g70ef8ee-dirty/build/src/xpadneo/consumer.o] Error 1
make[1]: *** [scripts/Makefile.build:280: /var/lib/dkms/hid-xpadneo/v0.9-175-g70ef8ee-dirty/build/src/xpadneo/keyboard.o] Error 1
In file included from ./include/asm-generic/int-ll64.h:11,
                 from ./arch/arm/include/uapi/asm/types.h:5,
                 from ./include/uapi/linux/types.h:5,
                 from ./include/linux/types.h:6,
                 from ./include/linux/limits.h:6,
                 from ./include/linux/kernel.h:7,
                 from ./include/linux/delay.h:22,
                 from /var/lib/dkms/hid-xpadneo/v0.9-175-g70ef8ee-dirty/build/src/xpadneo.c:11:
./include/uapi/asm-generic/int-ll64.h:12:10: fatal error: asm/bitsperlong.h: No such file or directory
 #include <asm/bitsperlong.h>
          ^~~~~~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [scripts/Makefile.build:280: /var/lib/dkms/hid-xpadneo/v0.9-175-g70ef8ee-dirty/build/src/xpadneo.o] Error 1
make: *** [Makefile:1825: /var/lib/dkms/hid-xpadneo/v0.9-175-g70ef8ee-dirty/build/src] Error 2
make: Leaving directory '/root/linux-315314059f92c13bc7d34b6aaff7527aca68457c'

@defanator
Copy link
Author

FWIW, got it working with the same version of xpadneo running the same Pi 2 under bookworm with kernel 6.6.31+rpt-rpi-v7 (got a completely fresh installation on separate SD card for testing).

Controller paired successfully without any noticeable issues.

Relevant info - module details:

root@raspberrypi:/# modinfo hid-xpadneo
filename:       /lib/modules/6.6.31+rpt-rpi-v7/updates/dkms/hid-xpadneo.ko.xz
version:        v0.9-175-g70ef8ee
description:    Linux kernel driver for Xbox ONE S+ gamepads (BT), incl. FF
author:         Kai Krakow <[email protected]>
author:         Florian Dollinger <[email protected]>
license:        GPL
srcversion:     A714E2DD109B5FD7A0B20B9
alias:          hid:b0005g*v0000045Ep00000B13
alias:          hid:b0005g*v0000045Ep00000B22
alias:          hid:b0005g*v0000045Ep00000B05
alias:          hid:b0005g*v0000045Ep00000B20
alias:          hid:b0005g*v0000045Ep000002FD
alias:          hid:b0005g*v0000045Ep000002E0
depends:        ff-memless
name:           hid_xpadneo
vermagic:       6.6.31+rpt-rpi-v7 SMP mod_unload modversions ARMv7 p2v8 
sig_id:         PKCS#7
signer:         DKMS module signing key
sig_key:        42:B4:FB:2B:45:63:7C:95:C8:E6:DB:FA:88:DB:11:7C:C5:B9:C6:B6
sig_hashalgo:   sha512
signature:      3D:66:44:C6:EB:07:1A:CC:B3:D3:91:A0:07:05:E6:85:13:96:24:EA:
		11:B9:47:DF:33:6C:03:1E:A6:9B:93:1D:5D:3D:C0:4E:D4:7C:67:B2:
		79:0D:39:0A:60:CA:2D:35:31:66:44:EE:59:24:68:93:01:C0:B5:07:
		8E:BC:70:B0:04:74:3D:0B:7E:25:4A:51:69:6A:93:39:C4:48:26:F5:
		DD:38:F0:FF:EF:6C:0C:06:6A:FA:23:DD:83:B5:D4:2D:9B:6E:32:10:
		E0:1B:52:3B:36:38:E4:CD:0D:22:2E:D7:6C:FE:0B:FA:E8:22:D9:21:
		FC:EA:3E:30:9B:61:50:CB:99:83:B5:C4:DF:72:36:09:64:F6:5E:49:
		B5:8D:6A:61:7D:0D:BF:35:35:EA:C6:6F:B1:F1:17:94:23:44:E0:7D:
		6E:61:35:B8:75:B4:69:F5:62:AA:C3:56:AC:E4:DD:AC:5E:5A:02:2D:
		A1:56:4E:70:02:A0:C2:87:CA:8C:CF:CA:6E:2E:6D:D1:63:C3:E0:BC:
		B1:75:81:91:B6:88:26:D9:E9:59:DC:6C:84:08:B5:E3:3E:74:E9:A5:
		62:9A:ED:CA:98:0F:A0:82:59:32:D5:38:BB:5C:F7:01:10:B8:B3:E7:
		95:F4:31:76:99:C3:9B:DC:67:80:8E:1D:7F:D1:0E:AF
parm:           trigger_rumble_mode:(u8) Trigger rumble mode. 0: pressure, 2: disable. (byte)
parm:           rumble_attenuation:(u8) Attenuate the rumble strength: all[,triggers] 0 (none, full rumble) to 100 (max, no rumble). (array of byte)
parm:           ff_connect_notify:(bool) Connection notification using force feedback. 1: enable, 0: disable. (bool)
parm:           gamepad_compliance:(bool) Adhere to Linux Gamepad Specification by using signed axis values. 1: enable, 0: disable. (bool)
parm:           disable_deadzones:(bool) Disable dead zone handling for raw processing by Wine/Proton, confuses joydev. 0: disable, 1: enable. (bool)
parm:           enable_rolling_axis:(bool) Enable rolling axis by combining both triggers, out of spec for many games. (deprecated) 0: disable, 1: enable. (bool)
parm:           disable_shift_mode:(bool) Disable use Xbox logo button as shift. Will prohibit profile switching when enabled. 0: disable, 1: enable. (bool)
parm:           quirks:(string) Override or change device quirks, specify as: "MAC1{:,+,-}quirks1[,...16]", MAC format = 11:22:33:44:55:66, no pulse parameters = 1, no trigger rumble = 2, no motor masking = 4, use Linux button mappings = 16, use Nintendo mappings = 32, use Share button mappings = 64, reversed motor masking = 128 (array of charp)

from bluetoothctl:

[Xbox Wireless Controller]# info
Device F4:6A:D7:FC:E2:4C (public)
	Name: Xbox Wireless Controller
	Alias: Xbox Wireless Controller
	Appearance: 0x03c4
	Icon: input-gaming
	Paired: yes
	Bonded: yes
	Trusted: yes
	Blocked: no
	Connected: yes
	LegacyPairing: no
	UUID: Vendor specific           (00000001-5f60-4c4f-9c83-a7953298d40d)
	UUID: Generic Access Profile    (00001800-0000-1000-8000-00805f9b34fb)
	UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
	UUID: Device Information        (0000180a-0000-1000-8000-00805f9b34fb)
	UUID: Battery Service           (0000180f-0000-1000-8000-00805f9b34fb)
	UUID: Human Interface Device    (00001812-0000-1000-8000-00805f9b34fb)
	Modalias: usb:v045Ep0B13d0522
	ManufacturerData Key: 0x0006
	ManufacturerData Value:
  03 00 80                                         ...             
	Battery Percentage: 0x44 (68)

Also, on this kernel I didn't have to play with disabling ERTM or doing any other custom stuff, things just worked out of the box.

The hid-xpadneo kernel module is not being loaded at start, but appears in lsmod output once controller is paired (perhaps this is how things should work with udev and stuff?)

Would still love to see it working under buster...

@defanator
Copy link
Author

TWIMC, if you're on buster and trying to use rpi-source to get latest kernel sources matching your updated kernel, you'll likely need this one - RPi-Distro/rpi-source#35.

@kaburkett
Copy link

kaburkett commented Oct 24, 2024

I encounter the same issue I am trying to bypass, but different versions of some things, however vermagic still 5.10 matching your problematic example exactly

When pairing Xbox Series X it also throws:

Failed to pair: org.bluez.Error.AuthenticationCanceled
pi@retropie:~ $ uname -a
Linux retropie 5.10.103-v7l+ #1529 SMP Tue Mar 8 12:24:00 GMT 2022 armv7l GNU/Linux

pi@retropie:~ $ dkms status
hid-xpadneo, v0.9.6, 5.10.103-v7l+, armv7l: installed
xpad, 0.4, 5.10.103-v7l+, armv7l: installed (original_module exists)

But my vermagic version is the same: ( 5.10.103-v7l+ SMP)

pi@retropie:~ $ modinfo hid-xpadneo
filename:       /lib/modules/5.10.103-v7l+/kernel/drivers/hid/hid-xpadneo.ko
version:        v0.9.6
description:    Linux kernel driver for Xbox ONE S+ gamepads (BT), incl. FF
author:         Kai Krakow <[email protected]>
author:         Florian Dollinger <[email protected]>
license:        GPL
srcversion:     C4A17E802EF117E0A044F94
alias:          hid:b0005g*v0000045Ep00000B13
alias:          hid:b0005g*v0000045Ep00000B22
alias:          hid:b0005g*v0000045Ep00000B05
alias:          hid:b0005g*v0000045Ep00000B20
alias:          hid:b0005g*v0000045Ep000002E0
alias:          hid:b0005g*v0000045Ep000002FD
depends:        ff-memless
name:           hid_xpadneo
vermagic:       5.10.103-v7l+ SMP mod_unload modversions ARMv7 p2v8 
parm:           trigger_rumble_mode:(u8) Trigger rumble mode. 0: pressure, 1: directional (deprecated), 2: disable. (byte)
parm:           rumble_attenuation:(u8) Attenuate the rumble strength: all[,triggers] 0 (none, full rumble) to 100 (max, no rumble). (array of byte)
parm:           ff_connect_notify:(bool) Connection notification using force feedback. 1: enable, 0: disable. (bool)
parm:           gamepad_compliance:(bool) Adhere to Linux Gamepad Specification by using signed axis values. 1: enable, 0: disable. (bool)
parm:           disable_deadzones:(bool) Disable dead zone handling for raw processing by Wine/Proton, confuses joydev. 0: disable, 1: enable. (bool)
parm:           quirks:(string) Override device quirks, specify as: "MAC1:quirks1[,...16]", MAC format = 11:22:33:44:55:66, no pulse parameters = 1, no trigger rumble = 2, no motor masking = 4, hardware profile switch = 8, use Linux button mappings = 16, use Nintendo mappings = 32, use Share button mappings = 64, reversed motor masking = 128 (array of charp)

I followed your lead and wiped the sd, starting with fresh brandnew version of raspian, installed retropie and then xpadneo ontop of that,

When trying to connect now, the status is continually flipping:

CHG] Device 40:8E:2C:4F:9B:7D Connected: no
[CHG] Device 40:8E:2C:4F:9B:7D Connected: yes
[CHG] Device 40:8E:2C:4F:9B:7D Connected: no
[CHG] Device 40:8E:2C:4F:9B:7D Connected: yes
[CHG] Device 40:8E:2C:4F:9B:7D Connected: no
[CHG] Device 40:8E:2C:4F:9B:7D Connected: yes
[CHG] Device 40:8E:2C:4F:9B:7D Connected: no
[CHG] Device 40:8E:2C:4F:9B:7D Connected: yes
[CHG] Device 40:8E:2C:4F:9B:7D Connected: no
[CHG] Device 40:8E:2C:4F:9B:7D Connected: yes
[CHG] Device 40:8E:2C:4F:9B:7D Connected: no
[CHG] Device 40:8E:2C:4F:9B:7D Connected: yes
[CHG] Device 40:8E:2C:4F:9B:7D Connected: no
[CHG] Device 40:8E:2C:4F:9B:7D Connected: yes
[CHG] Device 40:8E:2C:4F:9B:7D Connected: no
[CHG] Device 40:8E:2C:4F:9B:7D Connected: yes
[CHG] Device 40:8E:2C:4F:9B:7D Connected: no
[CHG] Device 40:8E:2C:4F:9B:7D Connected: yes
[CHG] Device 40:8E:2C:4F:9B:7D Connected: no
[CHG] Device 40:8E:2C:4F:9B:7D Connected: yes
[CHG] Device 40:8E:2C:4F:9B:7D Connected: no
[CHG] Device 40:8E:2C:4F:9B:7D Connected: yes
[CHG] Device 40:8E:2C:4F:9B:7D Connected: no
[CHG] Device 40:8E:2C:4F:9B:7D Connected: yes
[CHG] Device 40:8E:2C:4F:9B:7D Connected: no
[CHG] Device 40:8E:2C:4F:9B:7D Connected: yes
[CHG] Device 40:8E:2C:4F:9B:7D Connected: no

no messages in dmesg

I try using hid-xpadneo to get some output but get the module not found error like I think you might be mentioning here:

The hid-xpadneo kernel module is not being loaded at start, but appears in lsmod output once controller is paired (perhaps this is how things should work with udev and stuff?)

When manually attempting connection with my other remote I get

Attempting to connect to F4:6A:D7:5E:58:F8
Failed to connect: org.bluez.Error.Failed le-connection-abort-by-local

I am working through troubleshooting steps and will report back : https://atar-axis.github.io/xpadneo/#troubleshooting

@kaburkett
Copy link

For me, the issue was partly because my kernel was version 8, and when running the two commands I got a complaint.
lsmod | grep hid_xpadneo would return nothing

lsmod | grep hid_xpadneo would complain there is no xpadneo module in kernel 8. So I had to modify my pi config.txt to boot to kernel 7l

[all]
kernel=kernel7l.img

Then xpadneo was running, but it still took me a lot of connection attempts to get them paired. Finally when they reported as paired I would reboot the bluetooth service

sudo systemctl restart bluetooth without rebooting and this would make the controllers available in the retropie input config section

I also followed a reddit user's guide to modify some additional things:

1.Enabling uhid

First we need to enable the UserspaceHID if we don't do that the Controller won't connect properly and begins to connect and disconnect in a cycle and the Xbox Button will keep flashing

All you need to do is edit/create /etc/bluetooth/input.conf with your editor of choice (I prefer nano) In there paste this:

# Enable HID protocol handling in userspace input profile
# Defaults to false (HIDP handled in HIDP kernel module)
UserspaceHID=true
  1. Edit the main bluetooth config

We need to set some settings in the main bluetooth config file so xpadneo will work as intended and we also need to address the input lag Problem all you need to do is editing /etc/bluetooth/main.conf pasting in this:

[General]
Privacy = device
JustWorksRepairing = always
Class = 0x000100
FastConnectable = true

[LE]
MinConnectionInterval=7
MaxConnectionInterval=9
ConnectionLatency=0
  1. Installing xpadneo

Install bluez bluez-utils and dkms beforehand

git clone https://github.com/atar-axis/xpadneo.git
cd xpadneo
sudo ./install.sh

Afterwards Reboot your system

  1. Pairing the Series Controller with the PC
sudo bluetoothctl
scan on    
(stop the scan as soon as you see that "Xbox Wireless Controller" is popping up)
scan off (copy the Mac Address of the controller)
pair <MAC Address you've copied>
trust <MAC Address you've copied>
connect <MAC Address you've copied>

@kakra kakra added the 0 | type: enhancement New feature or request label Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0 | type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants