Troubleshooting Ipega PG-9157 LE Bluetooth Gamepad
-
I'm aware that they are already several topics concerning Ipega gamepads, and even tutorials, however the advice given doesn't seem to apply in this situation, as the approriate
/dev/input/event
nodes aren't being created.The gamepad connects immediately, and works without issue in both Windows 10 and Android 7. Moreover, it also works flawlessly in Raspbian, on the very same hardware, without any configuration whatsoever.
Setup
- Raspberry Pi 4 Model B 8GB
- Recalbox 7.2.2-reloaded
- Controller: Ipega PG-9157 Ninja
Within Recalbox, the device connects are pairs successfully, however in the configuration menu it reports that no gamepads are detected. Inspecting the device in
bluetoothctl
shows that it is in fact not paired, but can be easily enough with thepair
command.Afterwards, the result is this:
[PG-9157]# info 03:21:04:15:94:27 Device 03:21:04:15:94:27 (public) Name: PG-9157 Alias: PG-9157 Appearance: 0x03c3 Icon: input-gaming Paired: yes Trusted: yes Blocked: no Connected: yes WakeAllowed: yes LegacyPairing: no 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: Human Interface Device (00001812-0000-1000-8000-00805f9b34fb) UUID: Vendor specific (91680001-1111-6666-8888-0123456789ab) UUID: Vendor specific (f000ffc0-0451-4000-b000-000000000000) Modalias: bluetooth:v1949p0402d0000
However,
evtest
shows nothing:# evtest No device specified, trying to scan all of /dev/input/event* Available devices: /dev/input/event0: vc4 /dev/input/event1: vc4 Select the device event number [0-1]:
Inspecting
/dev
shows that no device nodes are created at all, not even so much as anhidraw
. Despite this, the device does appear to be working, just not as a game pad. Whenever a button is pressed or released, data is sent which is easily discernable as a controller state, as viewed inbtmon
:Base state:
> ACL Data RX: Handle 64 flags 0x02 dlen 17 ATT: Handle Value Notification (0x1b) len 12 Handle: 0x0026 Data: 80808080ff0000000067
"A" button pressed:
> ACL Data RX: Handle 64 flags 0x02 dlen 17 ATT: Handle Value Notification (0x1b) len 12 Handle: 0x0026 Data: 80808080ff0100000067
Complete log of a reconnect is below:
# btmon Bluetooth monitor ver 5.55 = Note: Linux version 5.10.13-v7l (armv7l) = Note: Bluetooth subsystem version 2.22 = New Index: B8:27:EB:70:13:B0 (Primary,UART,hci0) = Open Index: B8:27:EB:70:13:B0 = Index Info: B8:27:EB:70:13:B0 (Cypress Semiconductor) @ MGMT Open: bluetoothd (privileged) version 1.18 > HCI Event: LE Meta Event (0x3e) plen 32 LE Advertising Report (0x02) Num reports: 1 Event type: Connectable undirected - ADV_IND (0x00) Address type: Public (0x00) Address: 03:21:04:15:94:27 (OUI 03-21-04) Data length: 20 Flags: 0x06 LE General Discoverable Mode BR/EDR Not Supported 16-bit Service UUIDs (complete): 1 entry Human Interface Device (0x1812) Appearance: Joystick (0x03c3) Name (complete): PG-9157 RSSI: -67 dBm (0xbd) < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2 Scanning: Disabled (0x00) Filter duplicates: Disabled (0x00) > HCI Event: Command Complete (0x0e) plen 4 LE Set Scan Enable (0x08|0x000c) ncmd 1 Status: Success (0x00) < HCI Command: LE Create Connection (0x08|0x000d) plen 25 Scan interval: 60.000 msec (0x0060) Scan window: 60.000 msec (0x0060) Filter policy: White list is not used (0x00) Peer address type: Public (0x00) Peer address: 03:21:04:15:94:27 (OUI 03-21-04) Own address type: Public (0x00) Min connection interval: 15.00 msec (0x000c) Max connection interval: 15.00 msec (0x000c) Connection latency: 0 (0x0000) Supervision timeout: 2000 msec (0x00c8) Min connection length: 0.000 msec (0x0000) Max connection length: 0.000 msec (0x0000) > HCI Event: Command Status (0x0f) plen 4 LE Create Connection (0x08|0x000d) ncmd 1 Status: Success (0x00) > HCI Event: LE Meta Event (0x3e) plen 19 LE Connection Complete (0x01) Status: Success (0x00) Handle: 64 Role: Master (0x00) Peer address type: Public (0x00) Peer address: 03:21:04:15:94:27 (OUI 03-21-04) Connection interval: 15.00 msec (0x000c) Connection latency: 0 (0x0000) Supervision timeout: 2000 msec (0x00c8) Master clock accuracy: 0x00 @ MGMT Event: Device Connected (0x000b) plen 33 LE Address: 03:21:04:15:94:27 (OUI 03-21-04) Flags: 0x00000000 Data length: 20 Flags: 0x06 LE General Discoverable Mode BR/EDR Not Supported 16-bit Service UUIDs (complete): 1 entry Human Interface Device (0x1812) Appearance: Joystick (0x03c3) Name (complete): PG-9157 < HCI Command: LE Read Remote Used Features (0x08|0x0016) plen 2 Handle: 64 > HCI Event: Command Status (0x0f) plen 4 LE Read Remote Used Features (0x08|0x0016) ncmd 1 Status: Success (0x00) > HCI Event: Command Complete (0x0e) plen 14 LE Read Remote Used Features (0x08|0x0016) ncmd 1 Status: Success (0x00) 00 00 00 00 00 00 00 00 00 00 > HCI Event: LE Meta Event (0x3e) plen 12 LE Read Remote Used Features (0x04) Status: Success (0x00) Handle: 64 Features: 0x3d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 LE Encryption Extended Reject Indication Slave-initiated Features Exchange LE Ping LE Data Packet Length Extension = bluetoothd: src/service.c:service_accept() input-hog profile accept failed for 03:21:04:15:94:27 < ACL Data TX: Handle 64 flags 0x00 dlen 7 ATT: Exchange MTU Request (0x02) len 2 Client RX MTU: 517 > ACL Data RX: Handle 64 flags 0x02 dlen 7 ATT: Exchange MTU Response (0x03) len 2 Server RX MTU: 131 < ACL Data TX: Handle 64 flags 0x00 dlen 7 ATT: Read Request (0x0a) len 2 Handle: 0x000f > HCI Event: Number of Completed Packets (0x13) plen 5 Num handles: 1 Handle: 64 Count: 2 > ACL Data RX: Handle 64 flags 0x02 dlen 12 ATT: Read Response (0x0b) len 7 Value: 01491902040000 < ACL Data TX: Handle 64 flags 0x00 dlen 7 ATT: Read Request (0x0a) len 2 Handle: 0x0003 > ACL Data RX: Handle 64 flags 0x02 dlen 12 ATT: Read Response (0x0b) len 7 Value: 50472d39313537 < ACL Data TX: Handle 64 flags 0x00 dlen 7 ATT: Read Request (0x0a) len 2 Handle: 0x0005 > HCI Event: Number of Completed Packets (0x13) plen 5 Num handles: 1 Handle: 64 Count: 2 > ACL Data RX: Handle 64 flags 0x02 dlen 7 ATT: Read Response (0x0b) len 2 Value: c303 < ACL Data TX: Handle 64 flags 0x00 dlen 11 ATT: Read By Type Request (0x08) len 6 Handle range: 0x0001-0xffff Attribute type: Unknown (0x2b3a) > ACL Data RX: Handle 64 flags 0x02 dlen 9 ATT: Error Response (0x01) len 4 Read By Type Request (0x08) Handle: 0x0001 Error: Attribute Not Found (0x0a) < ACL Data TX: Handle 64 flags 0x00 dlen 11 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 Num handles: 1 Handle: 64 Count: 2 > ACL Data RX: Handle 64 flags 0x02 dlen 24 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-0x000f UUID: Device Information (0x180a) < ACL Data TX: Handle 64 flags 0x00 dlen 11 ATT: Read By Group Type Request (0x10) len 6 Handle range: 0x0010-0xffff Attribute group type: Primary Service (0x2800) > ACL Data RX: Handle 64 flags 0x02 dlen 26 ATT: Read By Group Type Response (0x11) len 21 Attribute data length: 20 Attribute group list: 1 entry Handle range: 0x0010-0x0015 UUID: Vendor specific (91680001-1111-6666-8888-0123456789ab) < ACL Data TX: Handle 64 flags 0x00 dlen 11 ATT: Read By Group Type Request (0x10) len 6 Handle range: 0x0016-0xffff Attribute group type: Primary Service (0x2800) > HCI Event: Number of Completed Packets (0x13) plen 5 Num handles: 1 Handle: 64 Count: 2 > ACL Data RX: Handle 64 flags 0x02 dlen 12 ATT: Read By Group Type Response (0x11) len 7 Attribute data length: 6 Attribute group list: 1 entry Handle range: 0x0016-0x0028 UUID: Human Interface Device (0x1812) < ACL Data TX: Handle 64 flags 0x00 dlen 11 ATT: Read By Group Type Request (0x10) len 6 Handle range: 0x0029-0xffff Attribute group type: Primary Service (0x2800) > ACL Data RX: Handle 64 flags 0x02 dlen 26 ATT: Read By Group Type Response (0x11) len 21 Attribute data length: 20 Attribute group list: 1 entry Handle range: 0x0029-0x0031 UUID: Vendor specific (f000ffc0-0451-4000-b000-000000000000) < ACL Data TX: Handle 64 flags 0x00 dlen 11 ATT: Read By Group Type Request (0x10) len 6 Handle range: 0x0032-0xffff Attribute group type: Primary Service (0x2800) > HCI Event: Number of Completed Packets (0x13) plen 5 Num handles: 1 Handle: 64 Count: 2 > ACL Data RX: Handle 64 flags 0x02 dlen 9 ATT: Error Response (0x01) len 4 Read By Group Type Request (0x10) Handle: 0x0032 Error: Attribute Not Found (0x0a) = bluetoothd: src/service.c:service_accept() input-hog profile accept failed for 03:21:04:15:94:27 > ACL Data RX: Handle 64 flags 0x02 dlen 6 SMP: Security Request (0x0b) len 1 Authentication requirement: Bonding, No MITM, Legacy, No Keypresses (0x01) > ACL Data RX: Handle 64 flags 0x02 dlen 16 LE L2CAP: Connection Parameter Update Request (0x12) ident 114 len 8 Min interval: 12 Max interval: 12 Slave latency: 0 Timeout multiplier: 200 @ MGMT Event: New Connection Parameter (0x001c) plen 16 Store hint: Reserved (0x27) LE Address: 01:03:21:04:15:94 (OUI 01-03-21) Min connection interval: 12 Max connection interval: 12 Connection latency: 0 (0x0000) Supervision timeout: 200 < ACL Data TX: Handle 64 flags 0x00 dlen 10 LE L2CAP: Connection Parameter Update Response (0x13) ident 114 len 2 Result: Connection Parameters accepted (0x0000) < HCI Command: LE Connection Update (0x08|0x0013) plen 14 Handle: 64 Min connection interval: 15.00 msec (0x000c) Max connection interval: 15.00 msec (0x000c) Connection latency: 0 (0x0000) Supervision timeout: 2000 msec (0x00c8) Min connection length: 0.000 msec (0x0000) Max connection length: 0.000 msec (0x0000) > HCI Event: Command Status (0x0f) plen 4 LE Connection Update (0x08|0x0013) ncmd 1 Status: Success (0x00) > HCI Event: LE Meta Event (0x3e) plen 10 LE Connection Update Complete (0x03) Status: Success (0x00) Handle: 64 Connection interval: 15.00 msec (0x000c) Connection latency: 0 (0x0000) Supervision timeout: 2000 msec (0x00c8) > HCI Event: Number of Completed Packets (0x13) plen 5 Num handles: 1 Handle: 64 Count: 1
What stands out most is line 87, and again line 194:
= bluetoothd: src/service.c:service_accept() input-hog profile accept failed for 03:21:04:15:94:27
. Grepping the internet for this error returns a number of results, with the following possible resolution:- Ensure that the kernel is compiled with
CONFIG_UHID=y
The only line generated in
dmesg
appars to be[ 162.631750] Bluetooth: hci0: security requested but not available
Whereas on Raspbian we see the following:
[ 61.335639] input: PG-9157 Keyboard as /devices/virtual/misc/uhid/0005:1949:0402.0004/input/input7 [ 61.338929] input: PG-9157 Consumer Control as /devices/virtual/misc/uhid/0005:1949:0402.0004/input/input8 [ 61.339373] input: PG-9157 as /devices/virtual/misc/uhid/0005:1949:0402.0004/input/input9 [ 61.350670] hid-generic 0005:1949:0402.0004: input,hidraw3: BLUETOOTH HID v0.00 Keyboard [PG-9157] on AA:AA:AA:AA:AA:AA
It does appear to be using
uhid
.Is there are particular reason why this kernel module isn't included with Recalbox? Does a version exist (perhaps older version) which has it?
-
I resolved the issue by adding
uhid
to/etc/modules.conf
, so that it is loaded at system start. -