mirror of
https://github.com/safijari/openpuck.git
synced 2026-11-03 22:30:22 +00:00
[PR #251] [CLOSED] Fix DS4 descriptor, PS Create/Options remap, and PS motion axes #259
Labels
No labels
pull-request
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
safijari/openpuck#259
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?
📋 Pull Request Information
Original PR: https://github.com/safijari/openpuck/pull/251
Author: @safijari
Created: 8/24/2026
Status: ❌ Closed
Base:
main← Head:fix-playstation-modes📝 Commits (5)
268dd50Fix DS4 descriptor, PS Create/Options remap, and PS motion axes0a9bd78Merge branch 'main' into fix-playstation-modes571864bGuarantee the clean PlayStation modes are non-composite4b28a68Add the clean PlayStation modes to the panel's mode buttonsee6f148DS4: declare the full genuine report descriptor, not just the reports we use📊 Changes
7 files changed (+178 additions, -57 deletions)
View changed files
📝
OpenPuck/OpenPuck.ino(+10 -1)📝
OpenPuck/gamepad_util.cpp(+40 -12)📝
OpenPuck/gamepad_util.h(+23 -2)📝
OpenPuck/mode_hidgyro.cpp(+63 -25)📝
OpenPuck/mode_ps5.cpp(+12 -15)📝
README.md(+25 -0)📝
docs/index.html(+5 -2)📄 Description
Fixes #223, fixes #118, and most of #202.
All three issues turned out to be separate PlayStation-mode bugs.
DS4 mode was dead on Windows/macOS
#202 ("DS4 does not work whatsoever"), #118 ("as if the thing was bricked"), and @ming1455's comment.
The DS4 report descriptor declared the four stick usages (X/Y/Z/Rz) with the hat's item —
Logical Max 7, Report Size 4, Report Count 1— so the whole stick block collapsed into a single 4-bit field. Walking the descriptor, input report 0x01 declared 60 bytes whilehidGyroBuild()sends 64.Two consequences, both fatal:
HIDAPI_DriverPS4_IsPacketValid,SDL_hidapi_ps4.c:if (size >= 64 && !(data[31] & 0x04))) — every report thrown away.Linux hidraw hands back the full 64 bytes the device actually wrote, which is why the mode worked there and nowhere else. Replaced with the genuine DualShock 4 descriptor (verified: 63 payload + id = 64, output 0x05 = 31 B, features 0x04/0x02 = 36 B).
"Create" pressed Options, "Options" pressed nothing
#223.
The config panel offers remap code 9 = Create and 10 = Options (and Back/Start, Minus/Plus for the other types). But
tritonFromCode/psOrBackCodemapped 9 →TB_VIEW, whichpsShouldersByteemits as Options, and 10 →TB_QAM, which no mode turns into a host button at all.TB_VIEW/TB_MENUare named backwards with respect to the physical buttons (see the note intriton.h).Now 9 →
TB_MENU(Create / Back / Minus) and 10 →TB_VIEW(Options / Start / Plus). This also fixes the same inversion for a QAM remap in Xbox mode, where code 9 ("Back") was landing on Start.DS5/DS4 motion axes and sensitivity
#118, and the reversed Cemu gyro reported in #202.
Ground truth is SDL's own SC2 driver (
SDL_hidapi_steam_triton.c), which maps both gyro and accel asX ← +x, Y ← +z, Z ← −y. The gyro used exactly that permutation; the accel was passed through unpermuted. That put gravity on PS Z instead of PS Y and gave the accel the opposite handedness to the gyro — so anything that fuses the two (Cemu, rpcs3, console motion) latched into a rotated solution, while Steam and Switch modes read correctly. Same class of bug as the Switch IMU handedness fix.Both modes now share
psImuPack(), which applies the one permutation to gyro and accel alike and halves the accel into the PS pads' 8192-counts/g scale (the SC2 is ±2g over the full int16, ~16384 counts/g).The calibration feature report was wrong too: the old
2844/2844gyro pair makeshid-playstation/hid-sony— and rpcs3, which parses the same report — compute a sensitivity 16× too high. SDL escaped it only by rejecting the calibration as "bad" and falling back to raw.4096/256lands the correctraw/16deg/s on every stack, so the "super sensitive G" @Surge4315 attributed to rpcs3 should be gone as well. Windows/Steam sensitivity is unchanged (it was already using the correct fallback); Linux/SteamOS and rpcs3 are the ones that change.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.