GameInput: size PlayStation HID reads for the collection #2515
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2525"
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?
Imported from ivall/xcl. Originally posted by loyodea on 2026-11-25T21:35:14Z.
Fixes #2465. XCL used a fixed 128-byte buffer for Windows HID reads. A DualShock 4 Bluetooth HID collection can advertise a 547-byte maximum. Size the read buffer from the collection capabilities and keep the previous fallback when the capability is unavailable.
What is in it
playstation.rsqueries the existing HID handle, releases the preparsed data, and uses the advertised input report length. A synthetic regression covers Bluetooth, USB, fallback sizing, and parsing.Cargo.tomlenables the required bindings in the existingwindows-sysdependency. The README describes the input behavior.Tested
cargo +stable-x86_64-pc-windows-gnu test -j 4 -p xcl --lib hle::playstation::tests: 3 passed, 0 failed, 0 ignored. The regression failed before the fix with a 128-byte buffer where it expected 547 bytes.cargo +stable-x86_64-pc-windows-gnu test -j 4 --workspace --no-fail-fast -- --test-threads=4: 1,420 passed, 4 failed, 46 ignored. The four GPU failures also appeared on an independent checkout of the same base and earlier clean upstream. Eight SKIPPED notices covered six unsupported per-lane paths, driver-cache measurement without Developer Mode, and the opt-in heap-window path.Regression run
Paired real-title smoke runs are pending. This draft remains blocked on those runs.
Not tested
Physical DualShock 4 Bluetooth, retail titles, MSVC, release, and other GPU vendors.
AI use
OpenAI Codex with GPT-6.2 Sol (extra-high reasoning for the implementation and final checks) updated the code and regression and ran the tests.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T21:54:08Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
Imported from ivall/xcl. Originally posted by xpatfussy69x on 2026-11-25T22:21:46Z.
Test run on exact head
09dda60(09dda60869b741c6193277fe7f5d7dc4ab12d428, on its base6d12f58), clean tree.Tested
cargo test --workspace -- --test-threads=4: 1424 passed, 0 failed, 46 ignoredV_MUL_F16/V_PK_MUL_F16/V_CVT_F16_F32(onmaintoo)cargo test -p xcl --lib read_buffer_matches_the_hid: 1 passed, 0 failedread_buffer_matches_the_hid_collection_input_report_length: okRegression run (60 s, default settings, a retail title)
main:
this PR:
No crash or device removal; frames 101 % of
main's, peak commit 100 %.Not tested
main(tested on its own base; it merges intoe1d84b7without conflicts)AI use
Imported from ivall/xcl. Originally posted by SlopTart on 2026-11-25T22:49:55Z.
Tested: current PR head merged onto current
origin/main(clean), Linux (Arch, kernel 7.2.15), Mesa 26.2.5 RADV, Radeon RX 7900 XT (NAVI31), cargo targetx86_64-pc-windows-gnurun under wine-11.0 (Proton), rustc 1.94.0, vkd3d-proton 3.1 with the XCL patch, official MS DXC (binaries 2026-09-29).gpu_suite (cold cache): 164 passed / 3 failed, no crashes. The three are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, promoted-UAV-clear driver gap, PR #2490); none caused by this PR.Targeted run of
read_buffer_matches_the_hid_collection_input_report_length: passed. GameInput, CPU-side, fine under the Wine lane. Note the test drives the size computation from the HID report descriptor, not a real pad, so it verifies the parsing path rather than device input.Not tested: retail titles (no title data on this lane, counts only).
AI use: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting.
Imported from ivall/xcl. Originally posted by throny on 2026-11-26T00:58:36Z.
Two contributors checked independently and found that #2546 solves the same problem (for #2465) in a different way: #1607, group D120. You may want to compare them with the other author and agree on one, or say in the PR why both are needed.
This is a hint from the community triage in #1607, not a maintainer decision.
AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.
Imported from ivall/xcl. Originally posted by loyodea on 2026-11-26T18:53:30Z.
Thanks for flagging #2546. Both patches query
HIDP_CAPS.InputReportByteLengthon the open HID handle, so one patch can address #2465. This PR uses the existingwindows-sysbindings and tests the 547-byte buffer and standard0x01report with synthetic data. #2546 adds a 1,024-byte fallback when the capabilities query fails. Thanks also for the Windows and Wine test reports. The sizing test passed on both, and physical DualShock 4 Bluetooth verification remains open.Imported from ivall/xcl. Originally posted by Grimkaaah on 2026-11-30T12:05:19Z.
I compared this with the same HID read path in my project, which reads DualSense, DualSense Edge and DualShock 4 over USB and Bluetooth with ReadFile. I also checked it against hidapi's Windows backend and SDL's PS4/PS5 HIDAPI drivers.
What I checked, all fine:
InputReportByteLengthis what hidapi does. Windows pads each report to that length, so a DS4's 0x01 report over Bluetooth arrives as 547 bytes, andparseonly needs 10 or more.Findings:
buf[0]on a 0-byte read (here playstation.rs:149 still logsbuf[0]whenn == 0). I'd keep one: #2546 as it is, or this one with finding 1 fixed.Note for #2465, beyond this diff: once a DS4 over Bluetooth has been switched to its full report 0x11,
parsedrops it (playstation.rs:166), and the pad gives no input. Steam Input, DS4Windows or an SDL game switch it by reading the calibration report. #2081 reads 0x11.Not checked: we haven't run this PR, on a pad or otherwise.
AI use: Claude Code (Claude Opus 5.5) reviewed this by comparing it with the same mechanism in my project, Victory Grimkaaah.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T08:16:42Z.
Triage (#1607) – head
09dda60#2546 makes the same change in
playstation.rsread_until_gone. Both size theReadFilebuffer fromHidD_GetPreparsedData+HidP_GetCapsInputReportByteLengthin place of[0u8; 128]. This PR binds them through a newWin32_Devices_HumanInterfaceDevicewindows-sys feature, and #2546 throughraw-dylibas other modules on main do.If the caps query fails,
report_buffer(0)here falls back to 128 bytes, which is the size that fails for a Bluetooth DualShock 4 (547). #2546 falls back to 1024.#2546 has a green
Build and testcheck. This PR has no build run yet.Recommendation: close (duplicate of #2546).
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Imported from ivall/xcl. Originally posted by throny on 2026-12-01T15:58:57Z.
Closing as superseded: the same change is in #2546 (open, mergeable, required checks green). From Foniass's rechecked close list on #1607, checked again by script just now. If something here is still missing, say so and reopen it, or ask and I will.
AI use: Claude Code (Claude Opus 5.5).
Pull request closed