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
+2 -1
View File
@@ -6,7 +6,7 @@ if(NOT CMAKE_GENERATOR MATCHES "^(Ninja|Xcode)$")
endif()
cmake_minimum_required(VERSION 3.21)
project(xone_macos VERSION 0.1.27 LANGUAGES CXX Swift)
project(xone_macos VERSION 0.1.28 LANGUAGES CXX Swift)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
@@ -71,6 +71,7 @@ target_link_libraries(xone_gip PUBLIC xone_auth xone_mt76)
# Virtual HID gamepad presentation
add_library(xone_hid STATIC
"src/hid/hid_device.cpp"
"src/hid/hid_report.cpp"
)
target_include_directories(xone_hid PUBLIC "${CMAKE_SOURCE_DIR}/include")
target_compile_features(xone_hid PRIVATE cxx_std_23)