fix(host/input): serve Switch Pro SPI reads by range, not exact pairs #444

Merged
enricobuehler merged 1 commits from worktree-switchpro-spi-range into main 2026-08-29 15:18:15 +00:00
1 Commits
Author SHA1 Message Date
enricobuehler 0f20e72d03 fix(host/input): serve Switch Pro SPI reads by range, not exact pairs
ci / docs-site (pull_request) Successful in 1m4s
ci / web (pull_request) Failing after 1m19s
ci / bun-nix (pull_request) Successful in 23s
ci / rust-arm64 (pull_request) Successful in 3m9s
ci / docs-drift (pull_request) Successful in 2m2s
android / android (pull_request) Successful in 8m56s
ci / rust (pull_request) Successful in 10m39s
Both sticks on a virtual Switch Pro sat in the top-right corner under
Steam, reaching centre only at full down-left. Buttons and motion were
fine, and the kernel's own evdev node read correctly throughout.

The SPI-flash handler matched an exact (address, length) pair, and those
pairs came from hid-nintendo. Steam does not use the kernel driver here;
it uses SDL's HIDAPI Switch driver, which reads the same calibration as
18 bytes at 0x603D and 22 at 0x8010. Neither matched, so both fell to
the zero-fill path — which echoes the requested address, so SDL accepted
the reply and parsed a zeroed calibration. A zero centre is never
subtracted, leaving every raw axis value positive.

Serve reads by range from a modelled flash image, so every consumer gets
the same bytes whatever shape it asks for. What hid-nintendo receives is
byte-identical, and the IMU block already used SDL's length, so motion is
untouched. The caller loses its zero-fill fallback.
2026-08-29 16:56:17 +02:00