fix(host): the Deck's IMU setting is read where the reply puts it, so its sensors are turned on #2802

Merged
HumanBean merged 2 commits from omgitsgela/Longshot:fix/deck-imu-mode-readback into main 2026-11-29 16:35:11 +00:00
Member

Summary

Started by Steam, SDL opens only Steam Input's stand-in pad, which has no sensors, so the Deck's own state report is the
only gyro there is. Its accelerometer and gyroscope fields stay zero until the controller's IMU mode says to send them.
host/deck_imu.c reads that mode before writing it, so it can put it back, and that read assumed a fixed layout: the
setting number at byte 1, the (setting, low, high) triples from byte 2. A GET_SETTINGS_VALUES reply is an id, then a
byte count, then the triples, so the count sat where the setting number was read, nothing ever matched, no enable was
written, and every sample stayed zero.

The Motion controls row still said "gyro found", because the source counted as present once a report arrived rather than
from what it carried: 2,000 valid type-9 reports in 8 s, six fields zero.

The first commit reads the reply where it says its values are and by its own count, reads the mode again every three
seconds while the stream is dead, writes only the raw accel and gyro bits over the value that is current, and restores
only a value this reader wrote.

The second commit fixes presence, which the review caught: it counted only a sample that changed, so a Deck lying
still (same gravity, zero rate, again and again) lost motion after three seconds, and the SDL caller then reset the
filter and its learned bias when a sample finally did change. Presence now follows the newest report carrying a nonzero
sample, changed or not, inside the same three second window. Six zero fields mean the sensors are off, and no report at
all still means the node or Steam's hold on it changed, so the bounded mode re-read is unchanged.

To see the bug on main: start a Deck build from a Steam shortcut with Steam running, then read the game's log. It picks
the Deck's built-in controls and prints that the IMU setting could not be read; a read-only probe of the same hidraw
node shows well-formed reports with zero accel and zero gyro, and the Motion controls row says "gyro found" anyway.

Read deck_imu_read_setting, then deck_imu_present and the liveness block in deck_imu_poll.

Testing

Tested: Steam Deck LCD (VANGOGH, RADV, SteamOS 7.2.7-valve2-neptune), the same build started from a Steam shortcut
in Desktop Mode with Steam running and in Game Mode. Motion controls On reports gyro found, motion aiming works, the
log shows motion controls from the Steam Deck's built-in controls, the IMU mode reads 0x0018 while the reader holds
it, and it is back to Steam's value once Motion controls is turned off. With the switch off, Deck motion is gone and
buttons and sticks still work, so the fallback is the source when it is on and nothing when it is off.

The presence rule is covered game-free rather than by holding the Deck still for three seconds: tests/deck_imu_transport.c
compiles the production reader against simulated hidraw replies and now includes a 3.6 s still-pad stream (presence
holds, every poll returns the same reading) and a 3.6 s zero stream (presence lapses and the mode is asked about again).

Still to test:

  • Steam Deck OLED (Galileo): start from a Steam shortcut, Motion controls On, expecting gyro aiming (by hand).

Suite on this machine: tests/run_all.py --strict (Linux, CXX=g++) reports the same 211 failures on main and on
this branch, every one of them a test that needs a tool this machine does not have (clang, clang++); this branch
adds none. mise run test itself cannot run here: its pinned ruff and pre-commit need uv >= 0.12.10 and this
machine has 0.11.26. CI has both. The new transport check is declared Windows-skipped, which is what the Windows runner
needs, instead of being picked up and failing to compile there.

Measurements

Verdict: the bug reproduces on main and is gone here. The transport check fails on main and passes on this PR;
in the game the same hidraw stream that carried six zero fields on main carries live values here, and a still pad keeps
them.

Setup: Steam Deck LCD, RADV, SteamOS 7.2.7-valve2; Desktop Mode started from a Steam shortcut; the reader's own log, a
read-only probe of the Deck's hidraw state report, and tests/deck_imu_transport.c (run by
tests/test_deck_imu_transport.py), which compiles the production reader with the ioctls and read replaced.

Before: main @ 01d6878b After: this PR @ 67ed06ce
tests/test_deck_imu_transport.py builds against main and fails: deck_imu_read_setting returns -1 for a reply that names the setting passes: framing, actual count, zero stream, late reply, still pad, ownership
IMU setting found in a GET_SETTINGS_VALUES reply never (the count byte is read as the setting number) 0x0030 = 0x0000 on the Deck, 0x0018 once written
Deck state report fields, 8 s with Steam running 2,000 reports, accel and gyro all zero live accel and gyro; the row reports gyro found from them
A still pad's repeated nonzero samples past 3 s presence lapses, motion status cleared, filter and learned bias reset on the next change presence holds and every poll returns the same reading

Risks

The reader writes one controller setting that Steam also owns. It writes only the raw accel and gyro bits, over the value
it just read, and restores that value only while the setting still equals what it wrote; a value Steam changed in the
meantime is left alone. HOS_DECK_IMU=0 turns the whole fallback off. Presence needs a nonzero sample inside three
seconds, so a pad whose sensors are on but which has stopped reporting is treated as gone, as before. Nothing changes
for other pads, for sessions without Steam, or for a pad whose own sensors SDL can already read.

Nothing changes after updating: no options keys, no saves, no caches.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named).
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A fix: a game-free test that fails on main and passes here.
  • Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.
## Summary Started by Steam, SDL opens only Steam Input's stand-in pad, which has no sensors, so the Deck's own state report is the only gyro there is. Its accelerometer and gyroscope fields stay zero until the controller's IMU mode says to send them. `host/deck_imu.c` reads that mode before writing it, so it can put it back, and that read assumed a fixed layout: the setting number at byte 1, the `(setting, low, high)` triples from byte 2. A `GET_SETTINGS_VALUES` reply is an id, then a byte count, then the triples, so the count sat where the setting number was read, nothing ever matched, no enable was written, and every sample stayed zero. The Motion controls row still said "gyro found", because the source counted as present once a report arrived rather than from what it carried: 2,000 valid type-9 reports in 8 s, six fields zero. The first commit reads the reply where it says its values are and by its own count, reads the mode again every three seconds while the stream is dead, writes only the raw accel and gyro bits over the value that is current, and restores only a value this reader wrote. The second commit fixes presence, which the review caught: it counted only a sample that *changed*, so a Deck lying still (same gravity, zero rate, again and again) lost motion after three seconds, and the SDL caller then reset the filter and its learned bias when a sample finally did change. Presence now follows the newest report carrying a nonzero sample, changed or not, inside the same three second window. Six zero fields mean the sensors are off, and no report at all still means the node or Steam's hold on it changed, so the bounded mode re-read is unchanged. To see the bug on `main`: start a Deck build from a Steam shortcut with Steam running, then read the game's log. It picks the Deck's built-in controls and prints that the IMU setting could not be read; a read-only probe of the same hidraw node shows well-formed reports with zero accel and zero gyro, and the Motion controls row says "gyro found" anyway. Read `deck_imu_read_setting`, then `deck_imu_present` and the liveness block in `deck_imu_poll`. ## Testing **Tested:** Steam Deck LCD (VANGOGH, RADV, SteamOS 7.2.7-valve2-neptune), the same build started from a Steam shortcut in Desktop Mode with Steam running and in Game Mode. Motion controls On reports `gyro found`, motion aiming works, the log shows `motion controls from the Steam Deck's built-in controls`, the IMU mode reads `0x0018` while the reader holds it, and it is back to Steam's value once Motion controls is turned off. With the switch off, Deck motion is gone and buttons and sticks still work, so the fallback is the source when it is on and nothing when it is off. The presence rule is covered game-free rather than by holding the Deck still for three seconds: `tests/deck_imu_transport.c` compiles the production reader against simulated hidraw replies and now includes a 3.6 s still-pad stream (presence holds, every poll returns the same reading) and a 3.6 s zero stream (presence lapses and the mode is asked about again). **Still to test:** - Steam Deck OLED (Galileo): start from a Steam shortcut, Motion controls On, expecting gyro aiming (by hand). **Suite on this machine:** `tests/run_all.py --strict` (Linux, `CXX=g++`) reports the same 211 failures on `main` and on this branch, every one of them a test that needs a tool this machine does not have (`clang`, `clang++`); this branch adds none. `mise run test` itself cannot run here: its pinned `ruff` and `pre-commit` need `uv` >= 0.12.10 and this machine has 0.11.26. CI has both. The new transport check is declared Windows-skipped, which is what the Windows runner needs, instead of being picked up and failing to compile there. ## Measurements **Verdict:** the bug reproduces on `main` and is gone here. The transport check fails on `main` and passes on this PR; in the game the same hidraw stream that carried six zero fields on `main` carries live values here, and a still pad keeps them. Setup: Steam Deck LCD, RADV, SteamOS 7.2.7-valve2; Desktop Mode started from a Steam shortcut; the reader's own log, a read-only probe of the Deck's hidraw state report, and `tests/deck_imu_transport.c` (run by `tests/test_deck_imu_transport.py`), which compiles the production reader with the ioctls and `read` replaced. | | Before: main @ 01d6878b | After: this PR @ 67ed06ce | |---|---|---| | `tests/test_deck_imu_transport.py` | builds against `main` and fails: `deck_imu_read_setting` returns -1 for a reply that names the setting | passes: framing, actual count, zero stream, late reply, still pad, ownership | | IMU setting found in a `GET_SETTINGS_VALUES` reply | never (the count byte is read as the setting number) | `0x0030 = 0x0000` on the Deck, `0x0018` once written | | Deck state report fields, 8 s with Steam running | 2,000 reports, accel and gyro all zero | live accel and gyro; the row reports `gyro found` from them | | A still pad's repeated nonzero samples past 3 s | presence lapses, motion status cleared, filter and learned bias reset on the next change | presence holds and every poll returns the same reading | ## Risks The reader writes one controller setting that Steam also owns. It writes only the raw accel and gyro bits, over the value it just read, and restores that value only while the setting still equals what it wrote; a value Steam changed in the meantime is left alone. `HOS_DECK_IMU=0` turns the whole fallback off. Presence needs a nonzero sample inside three seconds, so a pad whose sensors are on but which has stopped reporting is treated as gone, as before. Nothing changes for other pads, for sessions without Steam, or for a pad whose own sensors SDL can already read. Nothing changes after updating: no options keys, no saves, no caches. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [x] `mise run test` passes (any failure that also fails on `main` is named). - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A fix: a game-free test that fails on `main` and passes here. - [x] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold.
fix(host): the Deck's IMU setting is read where the reply puts it, so its sensors are turned on
Some checks failed
CI / What the change needs (pull_request) Successful in 16s
PR description / Title and description (pull_request_target) Successful in 16s
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been skipped
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been skipped
CI / Third-party parts and guide screenshots (pull_request) Failing after 25s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Successful in 37s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Failing after 3m54s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 1m56s
CI / Website build and checks (pull_request) Failing after 1m19s
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Failing after 19m50s
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Failing after 38m46s
c864bb0750
Steam Input's stand-in pad has no sensors, so the Deck's own state report is the
only gyro there is, and its accelerometer and gyroscope fields stay zero until
the controller's IMU mode says to send them. The mode is read first so it can be
put back, and that read assumed a fixed layout: the setting number at byte 1 and
the triples from byte 2. A reply to GET_SETTINGS_VALUES is an id, then a byte
count, then (setting, low, high) triples, and the count sat where the setting
number was read, so no setting ever matched, no enable was written, and every
sample stayed zero.

The row still said "gyro found", because presence came from a report arriving
rather than from what it carried: 2,000 valid type-9 reports in 8 s reported
six zero fields. Presence now needs a nonzero sample that changed in the last
three seconds, and the mode is read again every three seconds while the stream
is dead, not while it is live, writing only the raw accel and gyro bits over
whatever value is current and restoring only a value this reader wrote.

tests/deck_imu_transport.c compiles the reader itself with the ioctls and read
replaced: a zero stream, a reply that arrives late, a short reply and another
report's reply.

Co-authored-by: Hermes Agent <hermes@localhost>
Author
Member

Tested in game: Steam Deck LCD (VANGOGH, RADV), SteamOS 7.2.7-valve2-neptune, one build started from a Steam shortcut in Desktop Mode with Steam running, and in Game Mode. Motion controls On reports gyro found and gyro aiming works; the log shows the Deck's built-in controls as the source; the IMU mode reads 0x0018 while the reader holds it and is back to Steam's value once it is off. With Motion controls off, Deck motion is gone and buttons and sticks still work.

Tested in game: Steam Deck LCD (VANGOGH, RADV), SteamOS 7.2.7-valve2-neptune, one build started from a Steam shortcut in Desktop Mode with Steam running, and in Game Mode. Motion controls On reports gyro found and gyro aiming works; the log shows the Deck's built-in controls as the source; the IMU mode reads 0x0018 while the reader holds it and is back to Steam's value once it is off. With Motion controls off, Deck motion is gone and buttons and sticks still work.
Author
Member

@review — ready. The sensor path is the whole change and it is provable without a Deck: tests/test_deck_imu_transport.py builds the reader against fake hidraw replies and fails on main (deck_imu_read_setting returns -1 for a reply that names the setting). Related: #2803, found on the same build.

@review — ready. The sensor path is the whole change and it is provable without a Deck: `tests/test_deck_imu_transport.py` builds the reader against fake hidraw replies and fails on `main` (`deck_imu_read_setting` returns -1 for a reply that names the setting). Related: #2803, found on the same build.
BeanBot left a comment

Recommendation: Request changes. The fix works in the reported Steam Deck LCD run, but the new test cannot build on Windows, and valid unchanged sensor readings are eventually treated as a disconnected gyro.

The change reads the Deck’s IMU setting using the reply’s count and enables raw motion data while preserving other setting bits. It also changes presence detection and adds a simulated transport test; the remaining costs are a Windows test failure and loss of motion presence for a stable sample.

Blocking (2): must change before merging.

  1. L1 tests/test_deck_imu_transport.py:30: The new test is selected on Windows but compiles a Linux-only source unconditionally. (more on the line) Do: Declare the test Linux-only for run_all and handle direct invocation on other platforms, or provide a portable transport harness.
  2. L4: The check CI / Third-party parts and guide screenshots (pull_request) fails on this head and passes on the base branch: Failing after 25s.

Should fix (1): not blocking, but worth doing before merging.

  • L2 host/deck_imu.c:260: A valid nonzero reading stops counting as present if its quantized values remain unchanged for three seconds. (more on the line) Do: Distinguish a zero or otherwise known disabled stream from valid repeated nonzero samples, and add a test covering a stable live stream longer than three seconds.

Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)

  • L3: The Steam Deck OLED path is still untested. When: The changed hidraw setting and report handling also serve OLED Decks, but the supplied in-game result covers only the LCD model. Do: Run the stated Steam shortcut motion-aiming and setting-restoration check on a Steam Deck OLED.

@fix can do L1, L2 and L4.

Checks: Still running: 6 checks.

More: does it help, other systems, switches, what was read

Does it help: Yes on the tested Steam Deck LCD: the author reports 2,000 zero-valued reports over 8 seconds on main, live sensor values and working gyro aiming on this head, and a transport test that fails on main and passes here. Steam Deck OLED remains untested.

Other systems: The production reader is Linux-only and is used when motion is enabled and SDL has no pad sensors; other pads take precedence. Windows uses the production stub, but the new test includes Linux-only headers unconditionally. OLED behavior remains to be checked.

Switches: No switches added, changed, or removed. Existing HOS_DECK_IMU defaults to enabled and can disable the fallback.

Reviewed: c864bb0750 against 01d6878b3f: Read AGENTS.md, CONTRIBUTING.md, the pull request template, standards, all three changed files, the Deck IMU header, the relevant pad callers, test-runner selection, the commit, and the supplied comments and CI status. Skimmed the remainder of the test runner. docs/review-checklist.md was absent; no generated files or translations changed.; nothing run (a code review).

Checked and fine:

  • The reply parser bounds its triples by both the reported byte count and ioctl return length.
  • The simulated reply exercises the original framing failure and verifies preservation of unrelated mode bits.
  • The commit records AI assistance; the diff contains no game-derived files, generated files, API version changes, or switch-table changes.

Testing: Read-only review; no project code, tests, or builds were run. The supplied CI status has one head-only failure, which the bot records separately, and several checks still running.

Overlaps and merge order: The supplied comment mentions related issue #2803; no overlapping pull request was identified in the available material.


Automated code review by BeanBot (gpt-6.1-terra), asked for by omgitsgela. Nothing was run; a maintainer decides.

**Recommendation: Request changes.** The fix works in the reported Steam Deck LCD run, but the new test cannot build on Windows, and valid unchanged sensor readings are eventually treated as a disconnected gyro. The change reads the Deck’s IMU setting using the reply’s count and enables raw motion data while preserving other setting bits. It also changes presence detection and adds a simulated transport test; the remaining costs are a Windows test failure and loss of motion presence for a stable sample. **Blocking (2)**: must change before merging. 1. **L1** `tests/test_deck_imu_transport.py:30`: The new test is selected on Windows but compiles a Linux-only source unconditionally. (more on the line) **Do:** Declare the test Linux-only for run_all and handle direct invocation on other platforms, or provide a portable transport harness. 2. **L4**: The check `CI / Third-party parts and guide screenshots (pull_request)` fails on this head and passes on the base branch: Failing after 25s. **Should fix (1)**: not blocking, but worth doing before merging. - **L2** `host/deck_imu.c:260`: A valid nonzero reading stops counting as present if its quantized values remain unchanged for three seconds. (more on the line) **Do:** Distinguish a zero or otherwise known disabled stream from valid repeated nonzero samples, and add a test covering a stable live stream longer than three seconds. **Testing before merging (1)** (runs on the systems it can change; it doesn't hold the recommendation) - **L3**: The Steam Deck OLED path is still untested. *When:* The changed hidraw setting and report handling also serve OLED Decks, but the supplied in-game result covers only the LCD model. **Do:** Run the stated Steam shortcut motion-aiming and setting-restoration check on a Steam Deck OLED. `@fix` can do L1, L2 and L4. **Checks:** Still running: 6 checks. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes on the tested Steam Deck LCD: the author reports 2,000 zero-valued reports over 8 seconds on main, live sensor values and working gyro aiming on this head, and a transport test that fails on main and passes here. Steam Deck OLED remains untested. **Other systems:** The production reader is Linux-only and is used when motion is enabled and SDL has no pad sensors; other pads take precedence. Windows uses the production stub, but the new test includes Linux-only headers unconditionally. OLED behavior remains to be checked. **Switches:** No switches added, changed, or removed. Existing HOS_DECK_IMU defaults to enabled and can disable the fallback. **Reviewed:** c864bb0750d7 against 01d6878b3f14: Read AGENTS.md, CONTRIBUTING.md, the pull request template, standards, all three changed files, the Deck IMU header, the relevant pad callers, test-runner selection, the commit, and the supplied comments and CI status. Skimmed the remainder of the test runner. docs/review-checklist.md was absent; no generated files or translations changed.; nothing run (a code review). **Checked and fine:** - The reply parser bounds its triples by both the reported byte count and ioctl return length. - The simulated reply exercises the original framing failure and verifies preservation of unrelated mode bits. - The commit records AI assistance; the diff contains no game-derived files, generated files, API version changes, or switch-table changes. **Testing:** Read-only review; no project code, tests, or builds were run. The supplied CI status has one head-only failure, which the bot records separately, and several checks still running. **Overlaps and merge order:** The supplied comment mentions related issue #2803; no overlapping pull request was identified in the available material. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by omgitsgela. Nothing was run; a maintainer decides.</sub>
host/deck_imu.c Outdated
@ -268,2 +259,2 @@
imu_same_ns = 0;
}
const int nonzero = accel[0] || accel[1] || accel[2] || gyro[0] || gyro[1] || gyro[2];
if (nonzero && (!imu_have_prev || memcmp(accel, imu_prev_a, sizeof imu_prev_a) ||
Member

L2 (should fix): A valid nonzero reading stops counting as present if its quantized values remain unchanged for three seconds.

When: With a stationary Deck producing the same gravity sample and zero angular velocity, reports continue arriving but imu_change_ns expires; polling returns no motion and presence is lost until a sample changes.

Do: Distinguish a zero or otherwise known disabled stream from valid repeated nonzero samples, and add a test covering a stable live stream longer than three seconds.

**L2** (should fix): A valid nonzero reading stops counting as present if its quantized values remain unchanged for three seconds. *When:* With a stationary Deck producing the same gravity sample and zero angular velocity, reports continue arriving but imu_change_ns expires; polling returns no motion and presence is lost until a sample changes. **Do:** Distinguish a zero or otherwise known disabled stream from valid repeated nonzero samples, and add a test covering a stable live stream longer than three seconds.
@ -0,0 +27,4 @@
with tempfile.TemporaryDirectory() as d:
exe = Path(d) / "deck_imu_transport"
# (only -Wall: the reader carries warnings of its own that are not this check's to fail on)
built = subprocess.run([a.cc, "-std=c11", "-Wall", "-I", str(ROOT / "host"), "-o", str(exe), str(SOURCE)],
Member

L1 (blocking): The new test is selected on Windows but compiles a Linux-only source unconditionally.

When: On Windows, run_all discovers this test and invokes it with the C compiler; tests/deck_imu_transport.c includes sys/ioctl.h and exercises Linux-only reader internals, so the test cannot build.

Do: Declare the test Linux-only for run_all and handle direct invocation on other platforms, or provide a portable transport harness.

**L1** (blocking): The new test is selected on Windows but compiles a Linux-only source unconditionally. *When:* On Windows, run_all discovers this test and invokes it with the C compiler; tests/deck_imu_transport.c includes sys/ioctl.h and exercises Linux-only reader internals, so the test cannot build. **Do:** Declare the test Linux-only for run_all and handle direct invocation on other platforms, or provide a portable transport harness.
Author
Member

CI note: Third-party parts and guide screenshots fails here because it fails on main too. scripts/check_guide_screenshots.py --review-sources on origin/main (01d6878b) says REVIEW REQUIRED: settings-graphics.png: game/oot_cheat_items.h changed since reviewed revision 3c74597e, from #2785; neither branch touches game/. The rest of the checks are running.

CI note: `Third-party parts and guide screenshots` fails here because it fails on `main` too. `scripts/check_guide_screenshots.py --review-sources` on `origin/main` (`01d6878b`) says `REVIEW REQUIRED: settings-graphics.png: game/oot_cheat_items.h changed since reviewed revision 3c74597e`, from #2785; neither branch touches `game/`. The rest of the checks are running.
futondestroyer left a comment

Recommendation: Request changes. The LCD run shows the reply framing fix restores motion aiming. Two issues remain before merge.

  • The new hidraw transport fixture is selected by the native Windows strict runner and requires Linux ioctl headers and the Linux reader. Please declare it Linux-only in the runner and handle direct invocation on Windows. Linux CI passed the fixture in 1.2 s. The Windows Host C check builds the production stub only. Game-free CI
  • A controller sending fresh, identical nonzero samples for three seconds will lose motion presence even though its reports continue. The SDL caller then clears motion state and resets the filter, including learned bias, when the next changed sample arrives. Please separate the settings recheck from motion presence and cover repeated nonzero reports past the timeout while preserving the all-zero and no-report cases.

The author reports 2,000 valid reports with all six sensor fields zero on main, then live sensors and restoration of the Steam setting on the Steam Deck LCD. Repeat the Steam shortcut, aiming and setting-restoration check on OLED. The Guide failure names a changed file outside this PR and also reproduces on the base. LCD test · Guide attribution

Reviewed all three changed files at c864bb0750d7e4d5943e00f5372b6598694a5f2c against 01d6878b3f148e68d7a9080133d193e1fb7c2973. No game or tests run in this review.

**Recommendation: Request changes.** The LCD run shows the reply framing fix restores motion aiming. Two issues remain before merge. - The new hidraw transport fixture is selected by the native Windows strict runner and requires Linux ioctl headers and the Linux reader. Please declare it Linux-only in the runner and handle direct invocation on Windows. Linux CI passed the fixture in 1.2 s. The Windows Host C check builds the production stub only. [Game-free CI](https://git.magicbean.dev/MagicBeanDev/Longshot/actions/runs/57577/jobs/7) - A controller sending fresh, identical nonzero samples for three seconds will lose motion presence even though its reports continue. The SDL caller then clears motion state and resets the filter, including learned bias, when the next changed sample arrives. Please separate the settings recheck from motion presence and cover repeated nonzero reports past the timeout while preserving the all-zero and no-report cases. The author reports 2,000 valid reports with all six sensor fields zero on main, then live sensors and restoration of the Steam setting on the Steam Deck LCD. Repeat the Steam shortcut, aiming and setting-restoration check on OLED. The Guide failure names a changed file outside this PR and also reproduces on the base. [LCD test](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2802#issuecomment-90077) · [Guide attribution](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2802#issuecomment-90102) Reviewed all three changed files at `c864bb0750d7e4d5943e00f5372b6598694a5f2c` against `01d6878b3f148e68d7a9080133d193e1fb7c2973`. No game or tests run in this review.
host/deck_imu.c Outdated
@ -206,3 +212,3 @@
/* A reading, not a vendor id: a Valve node is often the mouse or the keyboard interface of the same device, so
presence follows the state report itself, and lapses when the reports stop. Nothing scans the device here. */
return imu_fd >= 0 && imu_held && now_ns - imu_last_ns < 3000000000LL;
return imu_fd >= 0 && imu_held && now_ns - imu_change_ns < 3000000000LL;
Member

[P2] Keep fresh, valid nonzero reports present when the samples happen to repeat. This three-second change timestamp causes motion_poll to clear motion status and reset the filter (and learned bias) on the next changing sample. Keep the settings recheck separate and add a stable nonzero stream test beyond three seconds.

[P2] Keep fresh, valid nonzero reports present when the samples happen to repeat. This three-second change timestamp causes motion_poll to clear motion status and reset the filter (and learned bias) on the next changing sample. Keep the settings recheck separate and add a stable nonzero stream test beyond three seconds.
@ -0,0 +13,4 @@
import tempfile
ROOT = Path(__file__).resolve().parents[1]
RUN_ALL_ARGS = ["--cc", "{cc}"]
Member

[P2] Declare the transport fixture Linux-only for run_all and guard direct invocation. The fixture includes Linux ioctl headers and needs the Linux reader; native Windows strict checks will otherwise schedule a test they cannot compile. The cross-compiled production stub does not exercise the fixture.

[P2] Declare the transport fixture Linux-only for run_all and guard direct invocation. The fixture includes Linux ioctl headers and needs the Linux reader; native Windows strict checks will otherwise schedule a test they cannot compile. The cross-compiled production stub does not exercise the fixture.
fix(host): a still pad keeps its motion, and the transport check is Linux only
Some checks failed
CI / What the change needs (pull_request) Successful in 16s
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been skipped
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been skipped
CI / Third-party parts and guide screenshots (pull_request) Failing after 22s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Successful in 20s
PR description / Title and description (pull_request_target) Successful in 6s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Failing after 3m30s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 2m19s
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Failing after 15m28s
CI / Website build and checks (pull_request) Failing after 1m27s
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Failing after 35m2s
67ed06ced3
A deck lying still sends the same nonzero sample again and again: same gravity, zero rate. Presence counted only a
sample that changed, so after three seconds without one the reader said there was no motion; the SDL caller then
clears motion state and resets the filter, learned bias included, when the next sample does change.

Presence now follows the newest report carrying a nonzero sample, whether or not it differs from the one before it,
inside the same three second window. Six zero fields are what the sensors being off looks like, and no report at all
still means the node or Steam's hold on it changed, so that path is unchanged: the setting is read again at bounded
intervals while the stream carries no reading, and put back only when it still equals what was written.

tests/deck_imu_transport.c now holds a still pad for 3.6 s (presence holds, every poll returns the same reading), then
a zero stream for 3.6 s (presence lapses and the setting is asked about again), then the ownership check.

The transport check compiles the Linux reader, so tests/test_deck_imu_transport.py declares itself Windows-skipped for
the runner and says so instead of compiling when run there directly.

Co-authored-by: Hermes Agent <hermes@localhost>
Author
Member

Both review items are fixed on the head (67ed06ce).

  • L1: tests/test_deck_imu_transport.py now declares RUN_ALL_SKIP = {"windows": ...} for the runner, and when it is run directly off Linux it says why and returns instead of trying to compile the Linux reader.
  • L2: presence no longer needs a changed sample. It follows the newest report that carries a nonzero sample, changed or not, inside the same three second window, so a pad lying still keeps its motion and the filter and learned bias are not reset when it moves again. Six zero fields still mean the sensors are off, and no reports still mean the node or Steam's hold on it changed, so the bounded mode re-read and the restore-only-what-we-wrote rule are unchanged. tests/deck_imu_transport.c now holds a still pad for 3.6 s (presence holds although every reading is identical), then a zero stream for 3.6 s (presence lapses and the mode is asked about again), then the ownership check.
  • L4: it reproduces on the base, not here. scripts/check_guide_screenshots.py --review-sources on origin/main (01d6878b) says REVIEW REQUIRED: settings-graphics.png: game/oot_cheat_items.h changed since reviewed revision 3c74597e, which is #2785; this diff touches no game/ file.
  • OLED: still untested and still in Still to test. I do not have one to hand.
Both review items are fixed on the head (`67ed06ce`). - **L1**: `tests/test_deck_imu_transport.py` now declares `RUN_ALL_SKIP = {"windows": ...}` for the runner, and when it is run directly off Linux it says why and returns instead of trying to compile the Linux reader. - **L2**: presence no longer needs a *changed* sample. It follows the newest report that carries a nonzero sample, changed or not, inside the same three second window, so a pad lying still keeps its motion and the filter and learned bias are not reset when it moves again. Six zero fields still mean the sensors are off, and no reports still mean the node or Steam's hold on it changed, so the bounded mode re-read and the restore-only-what-we-wrote rule are unchanged. `tests/deck_imu_transport.c` now holds a still pad for 3.6 s (presence holds although every reading is identical), then a zero stream for 3.6 s (presence lapses and the mode is asked about again), then the ownership check. - **L4**: it reproduces on the base, not here. `scripts/check_guide_screenshots.py --review-sources` on `origin/main` (`01d6878b`) says `REVIEW REQUIRED: settings-graphics.png: game/oot_cheat_items.h changed since reviewed revision 3c74597e`, which is #2785; this diff touches no `game/` file. - **OLED**: still untested and still in Still to test. I do not have one to hand.
Owner
@review
BeanBot left a comment

Recommendation: Approve. The code is ready: only testing is left. The LCD test shows that the fix restores Deck motion, and repeated nonzero samples now remain present. The Steam Deck OLED run is still needed. Recommend approval; not approved on the forge.

The reader parses the IMU setting reply correctly, enables the sensors while preserving other mode bits, and keeps motion present for a stationary Deck. The change adds a simulated hidraw transport test and bounded retries.

Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)

  • L3: The Steam Deck OLED path is still untested. When: The changed hidraw setting and report handling also serve OLED Decks, but the supplied in-game result covers only the LCD model. Do: Run the stated Steam shortcut motion-aiming and setting-restoration check on a Steam Deck OLED.

Since the last review (on c864bb0750)
Resolved: L1 (The new test is selected on Windows but compiles a Linux-only source unconditionally.); L2 (A valid nonzero reading stops counting as present if its quantized values remain unchanged…)
Still open: L3 (The Steam Deck OLED path is still untested.); L4 (The check CI / Third-party parts and guide screenshots (pull_request) fails on this head…)

Checks: Failing on this head, which is behind its base, where they pass: CI / Third-party parts and guide screenshots (pull_request), CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request), CI / Game-free checks (run_all.py, part 1/2) (pull_request), CI / Website build and checks (pull_request), CI / Game-free checks (run_all.py, part 2/2) (pull_request). @rebase (or @fix) brings it up to date and runs them again; not held against it.

More: does it help, other systems, switches, what was read

Does it help: Yes: the author reports 2,000 all-zero reports over 8 seconds on main, followed by live sensor values and working motion aiming on the LCD Deck with this change.

Other systems: The reader is Linux-only and is used as a fallback when SDL has no sensor source. The Windows stub is unchanged; OLED hardware remains untested.

Switches: No switches added, changed or removed. The existing HOS_DECK_IMU switch defaults on and can disable the fallback.

Reviewed: 67ed06ced3 against 01d6878b3f: Read all three changed files, both diffs, the commits, AGENTS.md, CONTRIBUTING.md and the pull request template. Skimmed the runner declarations and caller references; the adjacent Tooling rules and docs/review-checklist.md were unavailable.; nothing run (a code review).

Checked and fine:

  • The fix retains the three-second expiry and bounded setting recheck for a zero stream.
  • The fix does not remove the IMU reply parsing or sensor enablement.

Testing: No commands that build or run project code were executed. The author reports successful LCD in-game testing and a passing simulated transport check; OLED remains to test.

Overlaps and merge order: None found in the supplied pull request information.


Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.

**Recommendation: Approve.** The code is ready: only testing is left. The LCD test shows that the fix restores Deck motion, and repeated nonzero samples now remain present. The Steam Deck OLED run is still needed. Recommend approval; not approved on the forge. The reader parses the IMU setting reply correctly, enables the sensors while preserving other mode bits, and keeps motion present for a stationary Deck. The change adds a simulated hidraw transport test and bounded retries. **Testing before merging (1)** (runs on the systems it can change; it doesn't hold the recommendation) - **L3**: The Steam Deck OLED path is still untested. *When:* The changed hidraw setting and report handling also serve OLED Decks, but the supplied in-game result covers only the LCD model. **Do:** Run the stated Steam shortcut motion-aiming and setting-restoration check on a Steam Deck OLED. **Since the last review** (on c864bb0750d7) Resolved: L1 (The new test is selected on Windows but compiles a Linux-only source unconditionally.); L2 (A valid nonzero reading stops counting as present if its quantized values remain unchanged…) Still open: L3 (The Steam Deck OLED path is still untested.); L4 (The check `CI / Third-party parts and guide screenshots (pull_request)` fails on this head…) **Checks:** Failing on this head, which is behind its base, where they pass: `CI / Third-party parts and guide screenshots (pull_request)`, `CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request)`, `CI / Game-free checks (run_all.py, part 1/2) (pull_request)`, `CI / Website build and checks (pull_request)`, `CI / Game-free checks (run_all.py, part 2/2) (pull_request)`. `@rebase` (or `@fix`) brings it up to date and runs them again; not held against it. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes: the author reports 2,000 all-zero reports over 8 seconds on main, followed by live sensor values and working motion aiming on the LCD Deck with this change. **Other systems:** The reader is Linux-only and is used as a fallback when SDL has no sensor source. The Windows stub is unchanged; OLED hardware remains untested. **Switches:** No switches added, changed or removed. The existing HOS_DECK_IMU switch defaults on and can disable the fallback. **Reviewed:** 67ed06ced36f against 01d6878b3f14: Read all three changed files, both diffs, the commits, AGENTS.md, CONTRIBUTING.md and the pull request template. Skimmed the runner declarations and caller references; the adjacent Tooling rules and docs/review-checklist.md were unavailable.; nothing run (a code review). **Checked and fine:** - The fix retains the three-second expiry and bounded setting recheck for a zero stream. - The fix does not remove the IMU reply parsing or sensor enablement. **Testing:** No commands that build or run project code were executed. The author reports successful LCD in-game testing and a passing simulated transport check; OLED remains to test. **Overlaps and merge order:** None found in the supplied pull request information. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
HumanBean deleted branch fix/deck-imu-mode-readback 2026-11-29 16:35:12 +00:00
Author
Member

For the record after the merge: the head that landed (67ed06ce) was built on a Steam Deck LCD and run in the condition Steam's grab creates (SDL with no pad sensors, Steam's launch variables set). hid: motion controls from the Steam Deck's built-in controls, read from the controller appeared once across about 150 s with the pad left alone, no IMU mode unavailable, no stopped changing, clean exit. Under the change-only rule it would have lapsed after three seconds and been selected again.

For the record after the merge: the head that landed (67ed06ce) was built on a Steam Deck LCD and run in the condition Steam's grab creates (SDL with no pad sensors, Steam's launch variables set). `hid: motion controls from the Steam Deck's built-in controls, read from the controller` appeared once across about 150 s with the pad left alone, no `IMU mode unavailable`, no `stopped changing`, clean exit. Under the change-only rule it would have lapsed after three seconds and been selected again.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!2802
No description provided.