Add HID gamepad quirk fallback for broken SDP records
Get series with b4
b4 am [email protected]Versions newest first
- v2 Latest3 patches 2 repliesIn review
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | src: add HMAC-SHA256 to bt_crypto using kernel AF_ALGsrc/ src/ | +71 | 1 reply | |
| 2/3 | input: add HID gamepad quirk fallback for broken SDP recordsprofiles/ profiles/ profiles/ +2 more | +46 | 1 reply | |
| 3/3 | tools: add bluez-quirkctl for managing quirk profilesMakefile.tools tools/ | +183 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.
Cover letter [PATCH BlueZ v2 0/3] Add HID gamepad quirk fallback for broken SDP records
From: Pakrohk <[email protected]>
This patch series adds a modular quirk system that provides HID report descriptor fallbacks for third-party Bluetooth gamepads with incomplete or malformed SDP records.
Problem:
Third-party Bluetooth HID gamepads (notably TG170W / DualShock 4 v2 clones, VID:PID 054c:09cc) expose incomplete HID SDP records. BlueZ's extract_hid_record() fails with -ENOENT, preventing HIDP registration. The Bluetooth link is active but no /dev/input/event* device is created. Windows and Android handle this gracefully by falling back to known HID descriptors. BlueZ does not.
Solution:
A two-tier quirk system that activates only when SDP parsing fails for a specifically matched device. Does not globally weaken HID parsing.
hidp_add_connection()
-> extract_hid_record() // normal SDP path
-> FAILS (-ENOENT)
-> gamepad_quirk_apply() // check built-in + external quirks
-> inject fallback HID descriptor
-> continue HIDP setup normallyPatch [1] adds HMAC-SHA256 to the internal bt_crypto library using the kernel AF_ALG interface, following the existing cmac(aes) pattern. This replaces the previous openssl CLI dependency.
Patch [2] adds the core quirk system: built-in quirk for TG170W/DS4 v2, external quirk profile loader with HMAC signature verification, and the device.c integration point.
Patch [3] adds bluez-quirkctl, a CLI tool for managing external quirk profiles (validate, install, list, remove).
External quirk profiles are JSON files installed to /var/lib/bluez/quirks/ with HMAC-SHA256 signatures, loaded at bluetoothd startup. This enables community-maintained gamepad support without BlueZ source modifications.
Testing:
- TG170W / DualShock 4 v2 (054c:09cc): buttons, sticks, touchpad verified via evtest
- Kernel creates three input devices: Wireless Controller, Wireless Controller Motion Sensors, Wireless Controller Touchpad
- External profile validation, installation, loading tested end-to-end
- Tampered profiles rejected by signature verification
---
Patch 1: src: add HMAC-SHA256 to bt_crypto using kernel AF_ALG Patch 2: input: add HID gamepad quirk fallback for broken SDP records Patch 3: tools: add bluez-quirkctl for managing quirk profiles
Signature · 1 line
2.49.0