feat: add Xbox One HID report layout and mapping

Phase 4 foundation, independent of the presentation mechanism:

- hid/hid_report.hpp: standard Xbox One report layout (64-byte input:
  buttons/guide/triggers/sticks; 64-byte output: motors), the HID
  report descriptor, and GIP state to report mapping.
- make_input_report(): remaps GIP button bits to the standard Xbox
  bitmask, scales 10-bit triggers to 8-bit, sticks pass through.
- parse_output_report(): extracts motor intensities from output
  reports for the rumble relay; malformed reports stop the motors.
- test_hid: unit tests for the mapping, scaling, and descriptor.

Report packing verified with a descriptor walker: input and output
are exactly 64 bytes each. Next step is presentation via DriverKit,
which needs a Developer ID with the DriverKit entitlement.

Co-Authored-By: qwen3.8-27b@q3_k_xl: implemented HID report layer
This commit is contained in:
portersky
2026-08-29 15:39:03 +02:00
parent 73c026218d
commit fafca4c265
7 changed files with 534 additions and 6 deletions
+14 -4
View File
@@ -49,6 +49,10 @@ and exposes connected controllers as HID gamepads.
- C API + Swift app: async session (fast probe; firmware + radio on a worker
thread), state display (idle/starting/ready/error), controller list with
live input monitor, battery level, and a rumble test button.
- Phase 4 (HID) started: standard Xbox One report layout, HID report
descriptor, and GIP-to-report mapping implemented in `src/hid/` and unit
tested. Remaining: present the reports as a virtual device via a DriverKit
extension (needs a Developer ID with the DriverKit entitlement).
The dongle LED is driven at chip level for pairing and client lifecycle.
Phase 3 is complete. Next: Phase 4 (virtual HID gamepad) and Phase 5 (app
@@ -153,7 +157,7 @@ Extract the protocol logic from Linux kernel code into standalone C.
- `ieee80211_*` → custom 802.11 frame builders
- `cfg80211_*` → nothing (no regulatory domain reporting needed)
### Phase 4: Virtual HID Gamepad (new)
### Phase 4: Virtual HID Gamepad (in progress)
**src/hid/**
@@ -164,10 +168,16 @@ Extract the protocol logic from Linux kernel code into standalone C.
- **IOHIDSystem user-space**: Create virtual HID device entirely in
user-space. May not work for all games.
- **Gamepad wrapper**: Lower-level, translate input events to HID reports.
- Map Xbox controller buttons/sticks/triggers to standard Xbox 360/One HID
report descriptor
- Handle force feedback (rumble): send back to dongle via GIP
- Map Xbox controller buttons/sticks/triggers to standard Xbox One HID
report descriptor: done. `hid/hid_report.hpp` defines the 64-byte
input/output report layout and the HID report descriptor; GIP state maps
to input reports via `make_input_report()` (unit tested).
- Handle force feedback (rumble): send back to dongle via GIP. TX is done
(Phase 3); output-report parsing for the relay is implemented in
`parse_output_report()`.
- Battery status reporting
- Remaining: present the reports as a virtual device (DriverKit extension).
Needs a Developer ID with the DriverKit entitlement to build and load.
### Phase 5: macOS App (new)