GameInput: DualShock 4 over Bluetooth fails immediately on ReadFile (128-byte buffer < 547-byte HIDP_CAPS.InputReportByteLength) #2465
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl#2465
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@microwave805 on GitHub · 2026-11-25 19:30 UTC · original
Static audit on
main @ c7e1799found thatcrates/xcl/src/hle/playstation.rsfails immediately on everyReadFilecall for DualShock 4 controllers connected over Bluetooth on Windows.Where
crates/xcl/src/hle/playstation.rs:111-116(read_until_gone)crates/xcl/src/hle/playstation.rs:4, 50-56, 86-97(Bluetooth DS4 matching & 1 s reconnect loop)Root cause
playstation.rsexplicitly matches DualShock 4 controllers over Bluetooth (vid&0002054c, service00001124-0000-1000-8000-00805f9b34fb, PIDs05c4/09cc), then opens the HID handle and reads into a hardcoded 128-byte buffer:The DualShock 4 Bluetooth HID report descriptor declares input report
0x19(Report Size 8, Report Count 546 →HIDP_CAPS.InputReportByteLength = 547). On Windows,hidclass.sysstrictly requiresReadFile'snNumberOfBytesToRead >= HIDP_CAPS.InputReportByteLengthon every read, even when the controller is sending 10-byte0x01or 78-byte0x11input reports. Because128 < 547,ReadFilefails immediately on the first call withERROR_INVALID_USER_BUFFER(1784).Trigger
Connect any DualShock 4 (
05c4or09cc) over Bluetooth on Windows.read_until_goneopens the device, logs"is read as the title's gamepad", failsReadFileon call 1, closes the handle, logs"was disconnected", sleeps 1 s inreader()(playstation.rs:55), and loops forever without ever reading gamepad input.Fix direction
Query
HIDP_CAPS.InputReportByteLengthviaHidD_GetPreparsedData/HidP_GetCaps(or increasebufto at least 547 bytes, e.g.[0u8; 1024], sincehidclass.sysaccepts any buffer length>= InputReportByteLength).AI use
main @ c7e1799and issue drafting.