GameInput: read a DualSense and a DualShock 4's full reports over Bluetooth #2071
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2081"
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 sheazywi on 2026-11-25T03:27:19Z.
A DualSense over Bluetooth was not read (
known()skipped it), and a DualShock 4's full Bluetooth report (0x11) was ignored. This reads them: the simple 0x01 report a DualSense sends over Bluetooth, its full 0x31 report, and the DualShock 4's 0x11. USB behaviour is unchanged.What is in it
crates/xcl/src/hle/playstation.rs:parsepicks the layout by pad and report id (sharedstatedecoder);known()no longer excludes a Bluetooth DualSense; new test that the Bluetooth reports read as the same gamepad state as USB, existing tests updated.README.md: DualSense over Bluetooth.Tested
cargo build --workspacethencargo test --workspace -- --test-threads=4: all passed, 0 failed (lib: 1099 passed, 26 ignored)shaders::tests::pso_measurement_compiles_an_exact_synthetic_record(needs Developer Mode),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows)Regression run
Not tested
scripts/smoke.ps1onmainvs this head was not run; the change only touches how a PlayStation pad's HID reports are decoded.AI use
upstream-sync referenced this pull request2026-11-25 05:07:03 +00:00
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T05:26:51Z.
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!
upstream-sync referenced this pull request2026-11-25 10:09:30 +00:00
Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-28T20:18:15Z.
Nothing has happened on this PR for 3 days, so it is marked
staleand will be closed in 4 days. A push or a comment takes the mark off: rebase it ontomainif it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.Imported from ivall/xcl. Originally posted by Grimkaaah on 2026-11-30T12:05:21Z.
I compared this with the same parser in my project, which reads DualSense, DualSense Edge and DualShock 4 over USB and Bluetooth, and with Linux hid-playstation and SDL's PS4/PS5 HIDAPI drivers.
What I checked, all fine:
InputReportByteLength78, so it reads with today's 128-byte buffer.Findings:
A DS4's 0x11 report can't be reached on Windows with this PR alone.
read_until_gonestill reads into 128 bytes (playstation.rs:110). A DS4's Bluetooth collection hasInputReportByteLength547, so ReadFile fails with ERROR_INVALID_USER_BUFFER beforeparseruns (#2465). Fix: rebase on #2546 (or #2525) and say so in the PR. The read also arrives padded to 547 bytes, so the 0x11 test should use a 547-byte buffer, not 78. GitHub also shows the branch as conflicting with main, so it needs a rebase anyway.No CRC or data check on the Bluetooth full reports (playstation.rs:136 and :141). Here 12 bytes are enough for a 0x31 and 14 for a 0x11.
Fix: require at least 78 bytes, check the CRC over the first 78 bytes only (a DS4's read is padded to 547), and for 0x11 also require
r[1] & 0x80. We check the CRC the same way in our project.Optional: SDL reads a DS4's 0x12 to 0x19 as the same state report as 0x11, with the CRC over the first 78 bytes. Here they are dropped.
Not checked: we haven't run this PR, on a pad or otherwise. I didn't check the DualSense Edge's extra buttons, which stay unmapped as before.
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-01T07:18:53Z.
Triage (#1607) – head
de1798fNo open or merged PR reads the DualSense's Bluetooth reports or the DualShock 4's 0x11 report. #2546 is related but different: it sizes the HID read buffer from
HIDP_CAPS, and says a DualShock 4 over Bluetooth needs more than the current 128-byte buffer. If that is true, the 0x11 path added here is never reached until a fix like #2546 lands.In
parse, a DualSense report 0x01 is read as the full USB layout only when it is exactly 64 bytes; any other length is read as the simple layout. This depends on the read returning the device's full report length.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.