GameInput: the Sony pad reader takes reports as long as Windows gives them #421
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/readmet3xt-lab--foxhound!421
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-421"
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?
@retroiffy on GitHub · 2026-12-02 06:03 UTC · original
retroiffy:sony-pad-report-lengths→main· +109 −7 · 1 files · 72 commits · closed without mergingThe raw-HID reader for Sony pads reads each input report into a fixed 128-byte buffer. Over Bluetooth on Windows, a DualShock 4's top-level collection reports
InputReportByteLength547, andReadFilerefuses a buffer shorter than that. The reader thread then ends at its first read, the 1 s enumeration finds the pad again, and this repeats for the whole session without a reading. That once-a-second rediscovery is probably what #419 shows ("a Sony pad on raw HID ... kind=Ds4" once per second, Bluetooth HID service path).What changes, all in
gameinput/hid.rs:report_lengths:HidD_GetPreparsedData+HidP_GetCapsgive the collection's input, feature and output report lengths (0 when they cannot be read).input_len.max(128), so short USB reports behave as before.OutputReportByteLength. The pad's own bytes, including the CRC, stay where they are.bluetooth(path, input_len):bluetooth_path(path)from #254, or input reports longer than the 64 bytes these pads send over USB.Overlap: #390 pads rumble output reports through a write handle of its own. If that lands first, the output-padding part here can be dropped and only the reader buffer and feature length kept. I am happy to rebase.
Tested on Windows 11 with a DualShock 4 (pid 09cc) paired over Bluetooth:
cargo test --locked -p victory-hle --lib gameinput::hid: 15 passed, including two new tests: a Bluetooth service path is taken as Bluetooth and a USB path is not, and output reports are padded to the length Windows asks for.cargo clippy -p victory-hle --all-targets --locked -- -D warnings: clean.connected_sony_pads -- --ignored --nocaptureread the paired pad continuously for 10 s. Before the change, the same pad was rediscovered once a second with no reading (203 times in a 3-minute session log).🤖 Generated with Claude Code
Pull request closed