feat(host): the Steam Deck's gyro reaches Motion controls when Steam starts the game #1181

Open
zeldaootr wants to merge 8 commits from zeldaootr/Longshot:deck-gyro into main
Contributor

Summary

On a Steam Deck started from Steam, Motion controls finds no gyro: Steam hides the Deck's built-in controls from the game and gives it a stand-in pad with no sensors, so players fake gyro aiming with a Steam Input "Gyro to Mouse" layout. This PR lets the game read the Deck's own gyro beside Steam Input's pad, and turns the Deck's motion sensors on when Steam left them off. In Game Mode on a Steam Deck OLED, started from the Steam shortcut with no gyro binding in the game's Steam Input layout, the Motion controls row reads "On (gyro found)" and aiming follows the Deck, before, during and after opening Steam's overlay (zeldaootr: "everything worked great"; Testing). That run was this PR's Deck code built on an earlier main (Measurements' Baseline says what differs), not this head's own build.

What it changes, in three parts:

  1. The Deck's controls out of Steam's ignore list, whatever the list's length. Steam's SDL_GAMECONTROLLER_IGNORE_DEVICES lists Valve's pads; main already takes Valve's out (for the Steam Controller's gyro, MagicBeanDev/Hookshot#2495) but kept the Deck's (0x28de/0x1205) in. This PR takes the Deck's out too (HOS_DECK_GYRO=0 keeps it in), sizes the new list from Steam's instead of a fixed buffer, and logs a warning, with the reason, whenever Valve's pads have to stay in the list. Beside Steam Input's pad the Deck's controls give their motion only: buttons and sticks keep coming through Steam Input as the player's layout maps them.
  2. One more log line under Steam: the list's size and the Deck's entries before and after, the "after" read back from SDL, so a log tells a list SDL never got apart from a pad SDL opened with its sensors off.
  3. The Deck's motion sensors turned on when Steam left them off. Without a gyro binding in the game's Steam Input layout, Steam keeps the Deck's IMU off (and turns it off again now and then while the game runs, as around its overlay), and SDL's Steam Deck driver never turns it on. While both sensors read the very same values for over 1.2 s, the game writes the one setting that turns them on (IMU mode: raw accelerometer and gyroscope) to the Deck's controller, at most once a second, and nothing while they move. Dolphin and SteamDeckGyroDSU write the same setting. HOS_DECK_IMU=0 writes nothing. In Game Mode it turned the sensors on at the start and again each time Steam turned them off (Testing).

What went wrong on the way, and the fix it led to. Headless stands on the Deck, with a one-entry list (0x28de/0x1205) set by hand as Steam's, passed. Then the first real start from the Steam shortcut in Game Mode did nothing: one controller, Steam's stand-in pad, and no line about Valve's controllers. The cause: pads_start copied Steam's list into a fixed 4096-byte buffer, and Steam's real list on the Deck is 11,102 characters, 793 entries; steam_pads_without_valve refused it (-1) and pads_start treated that as nothing to do, without a word. The same buffer is on main (char kept[4096] in pads_start, host/pad_sdl.c line 118): main's own Steam Controller path. Fed that list, main's steam_pads_without_valve returns -1 into 4096 bytes (42 Valve entries and 10,513 characters into a buffer that fits), so on main, under a list this long, a Steam Controller stays ignored too and Motion controls finds no gyro on it, with nothing in the log. This PR fixes that path as well; it is not run with a Steam Controller here (Still to test), and the list was read on a Deck, not on a PC's Steam. The second Game Mode start then showed the sensors left off without a gyro binding (50 re-arm lines, no aiming), which part 3 answers.

Read first:

  • input: pads_start in host/pad_sdl.c (the list sized from Steam's, the warning, the before/after line); steam_pads_without_valve, steam_pads_count and steam_pads_is_deck in host/steam_pads.h.
  • input: deck_imu_poll in host/pad_sdl.c, called from motion_poll: only for the Deck's built-in controls (vendor 0x28de, product 0x1205) while they are motion only beside Steam Input's pad and the pad Motion controls reads; it opens the pad's own HID device by the path SDL opened it by, sends the 65-byte feature report 00 87 03 30 18 00 (SET_SETTINGS, IMU_MODE = 0x0018), and closes it. motion_poll's frozen-gyroscope rule leaves that pad alone (!deck_imu). host/hos_sdl.c: the pad's product id, SDL_GetHint, SDL_hid_send_feature_report.
  • switches: kill rows for HOS_DECK_GYRO and HOS_DECK_IMU in gpu/vk/switches.def; docs: docs/dev/reference/input.md, docs/user/graphics-and-controls.md (Motion).
  • tests: tests/test_steam_pads.py (runs pads_start cut from the source with a list shaped like Steam's: 11,102 characters, 793 entries, the Deck's twice, a trailing comma), tests/test_deck_imu.py, and tests/test_gyro_rearm.py's fixture.

Related: #1796 stops the frozen-gyro rule firing on a gyroscope that is merely at rest, which this PR exposes on a Deck (Risks). The two are independent: this PR's Deck path keeps its own two-sensor test and only tells main's rule to skip the Deck's pad, and either merges without the other. Whichever merges second has a one-line textual conflict on the rule's test line in motion_poll; the resolution is both conditions, if (read && !deck_imu && !memcmp(g, last_g, sizeof g) && !memcmp(a, last_a, sizeof a)), with tests/test_gyro_rearm.py's fixture keeping both its a and deck_imu = 0 (the Game Mode builds carry exactly that resolution). #699 (a "Custom" gyro aim style) also edits host/pad_sdl.c; #1171 is another topic.

Thanks to omgitsgela, whose report of the frozen-gyro rule firing on a Steam Deck LCD, 102 times in ten minutes (#1477, their comment of 2026-11-19 06:34), showed that a Deck's gyroscope reads exactly the same at rest: the IMU step's "both sensors frozen" test comes from it. First asked for in the team's Discord thread "STEAM DECK GYRO SUPPORT".

See #1477

Testing

Tested: by zeldaootr on a Steam Deck OLED (SteamOS 3.9.5, Linux 7.2.7-valve2, RADV VANGOGH Mesa 26.2.0-devel (git-5c65d4fc31), SteamOS's SDL 3, libSDL3.so.0.4.12), Motion controls On. Every Deck build below is this PR's code at the time on main 9ea65c7bf, not this head's own build; the Game Mode builds also carry #1796's two commits. The last one, v3.0.0-54-gcf94a4fec, has this head's Deck code: pads_start, deck_imu_poll and both new tests are byte for byte this head's (Measurements, Baseline).

  • Game Mode, no gyro binding, the whole PR (v3.0.0-54-gcf94a4fec), 2026-11-20, by zeldaootr: started from the Steam shortcut after removing the "As Mouse" gyro binding from the game's Steam Input layout. His words: "everything worked great", and "before launching i unset the gyro. in game it just worked, before, during, and after opening the overlay". He then played for about 31 minutes. In that session's log and in an earlier start of the same build (about 70 s): the ignore-list lines, "Steam Deck Controller" with a gyroscope beside Steam Input's pad, motion only, motion controls from "Steam Deck Controller"; then once each, at the start, the Steam Deck's motion sensors read nothing ...: turning them on and ... were off ...: turned on; 0 stopped changing re-arm lines (the build without the IMU step: 50), 0 warnings. Later, Steam turned the sensors off again and the game turned them back on: 4 [debug] ... turned on again (N times now) lines in the 31-minute session (about 12, 12, 18 and 27 minutes in, each right after a the game read no controller for 2.2 s (or 3.3 s) line, as when the game loses its input to Steam's overlay) and 1 in the short start; never a steady stream. The log does not record the overlay itself, so which recovery followed which overlay close is not known: that aiming came back after the overlay rests on zeldaootr's play. The hid: lines are in Measurements.
  • Headless on the Deck with Steam's real environment, 2026-11-20 (the game started over ssh, Game Mode running, every SDL_* and Steam* variable Steam set for the shortcut, v3.0.0-54-gcf94a4fec and the build before it): the controller's hidraw device (28de:1205) opens read-write as the game's user. Four arms (the build without the IMU step; this build; this build with Steam's overlay library preloaded as Steam does; this build with HOS_DECK_IMU=0) all logged the two ignore-list lines, both controllers, motion only, its buttons come through Steam Input's pad and motion controls from "Steam Deck Controller", 0 re-arm lines and no write (started over ssh the IMU is already on). A forced arm, where a script first wrote IMU mode 0 to the controller: the game logged the Steam Deck's motion sensors read nothing ...: turning them on, once a second until they move, then ... were off ...: turned on, and the next motion sample was already moving; the script set the mode back afterwards.
  • Second Game Mode start, 2026-11-20 (v3.0.0-52-gbb0242662: this branch's commits 1 to 6, no IMU step): the list reached SDL (taken out of Steam's ignore list (44 of its entries), now 10485 characters, 749 entries (the Steam Deck's 0)); "Steam Deck Controller" opened with a gyroscope beside Steam Input's pad, motion only, motion controls from "Steam Deck Controller", hid: 1 controller through SDL; the Motion controls row read "On (gyro found)". In the game the sticks, buttons, trackpads and the Steam and Quick Access buttons worked as usual; the back grips are unbound in that layout and were not judged. With no gyro binding, tilting did nothing: 50 its gyroscope and accelerometer stopped changing: motion sensors turned off and on again lines (both sensors identical: no IMU data at all), until zeldaootr bound the gyro "As Mouse" in Steam Input; after that there were none, aiming followed the Deck, and a mouse cursor appeared (that binding's own effect). That start is why part 3 exists.
  • First Game Mode start, 2026-11-20 (v3.0.0-48-g7e1a68a43: 5306ca05d plus #1796): nothing changed. One controller, Steam's stand-in pad (connected (SDL), Steam Input's). Cause: the 4096-byte buffer against Steam's real list (Summary). Reproduced without the Deck: pads_start cut from that commit's source and fed Steam's list gave SDL nothing and logged nothing; the fixed one gave SDL 10,485 characters with no 0x28de entry left.
  • Headless stands, 2026-11-19 (the game started over ssh, Game Mode running, the list set by hand to 0x28de/0x1205, 600 s standing in Kokiri Forest, the Deck at rest): with this PR's first two commits (5306ca05d) SDL opened "Steam Deck Controller" with a gyroscope beside "Steam Virtual Gamepad" and Motion controls read it throughout (1346 motion lines); with HOS_DECK_GYRO=0 only the virtual gamepad opened and nothing was read, as on main. Measurements.
  • Off the Deck: tests/test_deck_imu.py fails at its test commit 698f9b885 (FAIL:126 writes >= 8 && writes <= 10 and 7 more) and passes at the head. v3.0.0-54-gcf94a4fec started on this PC (Linux, llvmpipe) with every one of Steam's variables from the Deck, to the intro and out with exit 0, logging the same two list lines.

Game-free, on Linux x86-64, in the PC's job queue:

  • At this head (3131b399d on main 08994a9ee), run_all.py --changed forge/main (55 checks that read the 10 changed files): 47 passed, 8 failed (test_crash_dialog, test_dev_ab, test_frame_overlap, test_hud_layout_row, test_linux_pressure, test_present_queue_default, test_vk_occlusion_queries, test_walk_key), all 8 also failing on main 068fb8ebe below. test_steam_pads, test_deck_imu, test_gyro_rearm, test_switch_table and test_settings_table pass.
  • The whole python3 -I -B tests/run_all.py (not --strict) at 6ed99ae48 (these eight commits on main 068fb8ebe; the rebase onto 08994a9ee changed none of them, git range-diff =) and on main 068fb8ebe, back to back on this PC: here 782 passed, 72 failed, 17 skipped; main 780 passed, 73 failed, 17 skipped. Every check that fails here fails on main too; main's failures are this PC's environment (tools, modules, timing).
  • The new tests at their test commits: tests/test_steam_pads.py fails at b98aec7ff (6 failures, among them pads_start: Steam's real-sized list (11102 characters) reaches SDL without Valve's entries and HOS_DECK_GYRO=0: the Deck's entries stay, Valve's others come out, which is main's own behaviour), fails at 651759394 (steam_pads_count not there yet), passes at the head. On main 08994a9ee with this head's tests: test_steam_pads and test_deck_imu fail.
  • host/pad_sdl.c and host/hos_sdl.c compiled (-c, the build's host flags, -Wall) with gcc and clang for Linux and llvm-mingw 20261104 for Windows, at this head and on main 08994a9ee: the same warnings on both (one from a generated header; one more in hos_sdl.c from host/fullscreen_monitor.h), none from this change.
  • Rebased since onto main a104182b4 (head 8704dbc1a; the lines above name the head before it, 3131b399d on 08994a9ee). Only host/hos_sdl.c and host/hos_sdl.h conflicted: main now has hos_sdl_pad_product itself (for the Steam Controller), so this PR no longer adds it and uses main's. git range-diff: pads_start, deck_imu_poll, host/steam_pads.h and both new tests are unchanged, the rest differs in hos_sdl and in docs context. The Deck's motion-only pad still stops before main's new vibration and haptics code: pads_poll reaches continue for it before the pad is counted and before vib_choose. At 8704dbc1a and on main a104182b4, the 49 checks that read the changed host files and the switch table: 42 passed and 7 failed here, 41 and 7 on main, the same 7 on both (test_crash_dialog, test_dev_ab, test_frame_overlap, test_linux_pressure, test_present_queue_default, test_renhdrum, test_vk_occlusion_queries), the one more here being test_deck_imu. Both files compile for Linux (gcc, clang) and Windows (llvm-mingw) with the same warnings as main. Not run in the game again after the rebase.
The 72 checks that fail both here (6ed99ae48) and on main 068fb8ebe

test_appimage_player_build, test_bug_report_defaults, test_capture_readback_visibility, test_capture_read_once, test_crash_dialog, test_crt_options, test_damage_debug_menu, test_dav1d_av1, test_dev_ab, test_dev_packs, test_discover, test_display_startup_failure, test_dlss_feature_size, test_draw_stream_visibility, test_failed_compile_keeps_objects, test_frame_overlap, test_fsr3fi_hud_layer, test_fsr_image_retirement, test_fsr_uniform_ownership, test_guest_imported, test_high_fps_fixes, test_host_guest_writes, test_hud_layout_row, test_insn_fixed_convert, test_libc_hooks, test_lift_cache, test_lift_lookups, test_linux_preflight, test_linux_pressure, test_linux_tools, test_linux_update, test_log_open_failure, test_make_game_cache, test_make_game_ngx, test_mise_build, test_missing_nup, test_mods_list, test_mods_size_table, test_native_zstd, test_ngx_sdk, test_nonuniform_image_arrays, test_nup_codec, test_nup_read_name, test_nup_stand_in, test_nup_verify, test_parallel_init_order, test_pending_guest_import, test_pipeline_play_cache, test_prepare_cache_save, test_prepare_stall, test_present_queue_default, test_present_source_crop, test_present_thread, test_profiling_mode, test_prompt_guide_lines, test_prompt_hand_guides, test_prompt_picture_tint, test_prompt_speed, test_psychov35_fsr3_fg, test_readback_timeout_source, test_replay_write_order, test_slow_frames, test_song_note_cue, test_staging_burst, test_texel_buffer_ownership, test_thinlto_tls, test_upscaler_rows, test_vbytes (times out at 600 s), test_vcore_escape, test_vk_occlusion_queries, test_walk, test_walk_key. Main also fails test_pipeline_cache_save.

Still to test:

  • Steam Deck OLED, Game Mode, from the Steam shortcut, this head built on current main, no gyro binding: one start, load a save and aim, open and close the Steam overlay once, expecting the same hid: lines as the v3.0.0-54-gcf94a4fec start in Measurements (turning them on, turned on, 0 stopped changing lines, no [warn] hid: line) and aiming as there (by hand: zeldaootr)
  • The same start: after quitting, the trackpads and the Steam and Quick Access buttons in Steam's library, then in Desktop Mode (trackpad as mouse, left trackpad scroll), expecting them as before the game started (by hand: zeldaootr)
  • Steam Deck OLED, Game Mode, with gyro bound "As Mouse" in the game's Steam Input layout and this build: expecting no IMU line at all (nothing written while the sensors move), and noting whether the aim moves twice as far (Steam's mouse and Motion controls both following the gyro) (by hand: zeldaootr)
  • Steam Deck LCD, Game Mode, from the Steam shortcut, no gyro binding: load a save, aim, open and close the overlay, expecting "On (gyro found)", aiming that follows the Deck, and the same hid: lines (by hand: someone with a Deck LCD)
  • Linux, a Steam Controller, the game started from Steam: aim with the gyro, expecting hid: Valve's controllers (the Steam Deck's too) taken out of Steam's ignore list (N of its entries) and the SDL's controller ignore list line in the log, and the gyro aiming (by hand: someone with a Steam Controller)
  • Windows, the game started from Steam, a Steam Controller or any other pad: expecting the same two list lines (or, without a list, none), the pad playing as on main, and a Steam Controller's gyro aiming (by hand: someone on Windows with Steam)

Measurements

Verdict: it works on a Steam Deck OLED in Game Mode: with no gyro binding in Steam Input, the game turned the Deck's motion sensors on at the start (one turned on line) and after each of the 4 times Steam turned them off in a 31-minute session, 0 re-arm lines against 50 in the build without the IMU step, and aiming followed the Deck by zeldaootr's play. The list fix before it opened the Deck's controls with a gyroscope where the earlier build opened only Steam's stand-in pad. No frame time measured: an input change, which reads two sensors per poll and, only while they are frozen, writes 65 bytes at most once a second (it turned the sensors on 5 times in the 31-minute session).

Baseline: not main, and not this head's own build. Every column is a build on main 9ea65c7bf with #1796's two commits: 7e1a68a43 is this PR's earlier head 5306ca05d, whose list code is main's 4096-byte buffer with the Deck's entry also taken out, so under Steam's real list it left the list as main does; bb0242662 adds the list fix (this branch's commits 3 to 6); cf94a4fec adds the IMU step (this branch's commits 7 and 8, 698f9b885 and 3131b399d, cherry-picked). Why cf94a4fec's results hold for this head: git range-diff 9ea65c7bf..cf94a4fec 08994a9ee..3131b399d and a diff of the files show pads_start, deck_imu_poll, tests/test_deck_imu.py and tests/test_steam_pads.py identical, and host/steam_pads.h differing in one comment only. What differs: (1) host/hos_sdl.c: 9ea65c7bf predates main's HID calls (added for the DualSense's haptics, #405), so the build carries its own copy of hos_sdl_pad_path, hos_sdl_hid_open and hos_sdl_hid_close where this head uses main's, which are the same but for hos_sdl_hid_open also asking for SDL_hid_write (every SDL3 has it); (2) the frozen-gyro rule's line in motion_poll has #1796's accelerometer condition in the build and main's gyro-only one here, and the Deck's motion-only pad skips that rule either way (!deck_imu); (3) the rest of main since 9ea65c7bf, among it the new vibration code, which a motion-only pad never reaches (pads_poll moves on before it); (4) docs/dev/reference/input.md is not in the build. Main itself was not started from the shortcut; HOS_DECK_GYRO=0 gives main's list (the stands below).
Setup: Steam Deck OLED, SteamOS 3.9.5 (Linux 7.2.7-valve2), RADV VANGOGH Mesa 26.2.0-devel (git-5c65d4fc31), SDL 3 (libSDL3.so.0.4.12), 16 GB; Game Mode, started from zeldaootr's Steam shortcut, Steam Input on, Steam's overlay preloaded; Motion controls On. What each start's log says was opened and read, its IMU and stopped changing lines and warnings, its length from the log's 5-second vi: lines (and vk: status: lines, one per 600 frames); Motion controls' row and the aiming by hand. One start or session each: counts, not timings.

Before: PR @ 7e1a68a43 (5306ca05d + PR 1796) Before, no IMU step: PR @ bb0242662 (commits 1-6 + PR 1796) After: this PR @ cf94a4fec (3131b399d's Deck code + PR 1796), first start After: this PR @ cf94a4fec, play session
gyro binding in Steam Input not noted none, then "As Mouse" partway none none
Steam's list (SDL_GAMECONTROLLER_IGNORE_DEVICES) 11,102 characters, 793 entries (the Deck's 2), left as Steam set it, no log line taken out ... (44 of its entries); now 10485 characters, 749 entries (the Steam Deck's 0) the same the same
pads opened Steam's stand-in pad only the stand-in pad, and "Steam Deck Controller" with a gyroscope, motion only the same the same
motion controls from none "Steam Deck Controller" "Steam Deck Controller" "Steam Deck Controller"
read nothing ...: turning them on / were off ...: turned on (no such step) (no such step) 1 / 1 1 / 1
[debug] ... turned on again (no such step) (no such step) 1 4 (about 12, 12, 18, 27 min in)
stopped changing re-arm lines none (no gyro pad) 50, until the binding 0 0
[warn] lines 0 0 0 0
length (vi: lines × 5 s; frames) not noted about 5.7 min (68; 13,351 frames, 22 status lines) about 70 s (14; 2,712 frames, 4 status lines) about 31 min (367; 62,420 frames, 104 status lines)
aiming, by hand not noted nothing until the binding, then followed the Deck (and a mouse cursor) not noted apart from the session "it just worked, before, during, and after opening the overlay" (zeldaootr)

(Two more starts of cf94a4fec on the Deck that day were headless, without Steam's variables: no stand-in pad, so the Deck's controls play directly, the IMU step does not apply, 0 IMU lines and 0 re-arm lines.)

before (7e1a68a43), Game Mode, the only controller line:
hid: controller "Steam Deck Controller" connected (SDL), Steam Input's; guid=030079f6de280000ff11000001000000

after (cf94a4fec), Game Mode, the play session, no gyro binding (mapping strings left out):
[hos host] hid: Valve's controllers (the Steam Deck's too) taken out of Steam's ignore list (44 of its entries), for their motion sensors
[hos host] hid: SDL's controller ignore list: Steam's 11102 characters, 793 entries (the Steam Deck's 2); now 10485 characters, 749 entries (the Steam Deck's 0)
[hos host] hid: SDL controller support ready (DualSense, DualShock 4, Switch Pro, Xbox and others)
[hos host] hid: controller "Steam Deck Controller" connected (SDL), with a gyroscope; guid=0300f617de2800000512000000036800; mapping=available; mapping-name="Steam Deck Controller"
[hos host] hid: controller "Steam Deck Controller" connected (SDL), Steam Input's; guid=030079f6de280000ff11000001000000; mapping=available; mapping-name="Steam Virtual Gamepad"
[hos host] hid: "Steam Deck Controller": motion only, its buttons come through Steam Input's pad
[hos host] hid: motion controls from "Steam Deck Controller"
[hos host] hid: 51 controls from longshot_options.ini
[hos host] hid: "Steam Deck Controller": the Steam Deck's motion sensors read nothing (Steam turns them off without a gyro binding): turning them on, once a second until they move (HOS_DECK_IMU=0 not to)
[hos host] hid: "Steam Deck Controller": the Steam Deck's motion sensors were off (Steam turns them off without a gyro binding): turned on
[hos sead::MainThread] hid: the game reads npad 0 (No.1, lr 0x83489670)
[hos sead::MainThread] hid: 1 controller through SDL
[hos sead::MainThread] hid: six-axis handles: 2 asked for, 3 reported
[hos BaseProcExecutor2] hid: the game read no controller for 2.2 s (lr 0x83489670)
[hos host] [debug] hid: "Steam Deck Controller": the Steam Deck's motion sensors turned on again (2 times now)
[hos BaseProcExecutor3] hid: the game read no controller for 2.2 s (lr 0x83489670)
[hos host] [debug] hid: "Steam Deck Controller": the Steam Deck's motion sensors turned on again (3 times now)
[hos BaseProcExecutor1] hid: the game read no controller for 3.3 s (lr 0x83489670)
[hos host] [debug] hid: "Steam Deck Controller": the Steam Deck's motion sensors turned on again (4 times now)
[hos ModuleSystemWorker5] hid: the game read no controller for 2.2 s (lr 0x83489670)
[hos host] [debug] hid: "Steam Deck Controller": the Steam Deck's motion sensors turned on again (5 times now)

bb0242662, Game Mode, no gyro binding (after the same list and pad lines):
[hos host] hid: "Steam Deck Controller": its gyroscope and accelerometer stopped changing: motion sensors turned off and on again   (50 times, until the binding)

main's steam_pads_without_valve (08994a9ee), fed Steam's list from the Deck:
list 11102 chars; into 4096: -1, out ""; into 20000: 42, out 10513 chars

Headless stands, 2026-11-19 (Steam Deck OLED as above, Game Mode running, the game started over ssh, HOS_HEADLESS=1, the list set by hand; Kokiri Forest, Link standing, 600 s each after the save loaded, the Deck at rest on AC, back to back). Reproduce: SDL_GAMECONTROLLER_IGNORE_DEVICES=0x28de/0x1205 SDL_GAMECONTROLLER_ALLOW_STEAM_VIRTUAL_GAMEPAD=1 HOS_MOTION_DEBUG=1 HOS_HEADLESS=1 RX_VK_PRECOMPILE=0 (plus HOS_DECK_GYRO=0), load a save, leave the Deck still, read longshot_log.txt. Main itself ran this way on 2026-11-16 (a main 9c9d69ed runtime): the virtual gamepad only, no motion, as the HOS_DECK_GYRO=0 column.

Before, HOS_DECK_GYRO=0: PR @ 5306ca05d After: PR @ 5306ca05d
pads opened "Steam Virtual Gamepad" only "Steam Virtual Gamepad", and "Steam Deck Controller" with a gyroscope
motion controls from none once, "Steam Deck Controller"
motion debug lines in 600 s 0 1346, accel about (0, -0.88, -0.36) G, gyro +0.000
re-arm lines (main's gyro-only rule) 0 5 (0 with #1796, the same stand)
exit 0 0

The switches:

Switch Kind Ships at What chose it
HOS_DECK_GYRO kill on: started from Steam, the Deck's built-in controls come out of Steam's ignore list the Game Mode starts above (gyro found; Steam Input's sticks, buttons, trackpads, Steam and Quick Access buttons fine in the game) and the stands; =0 is main's behaviour. After quitting is not yet checked (Still to test)
HOS_DECK_IMU kill on: while the Deck's two sensors read nothing, the IMU setting is written at most once a second the Game Mode starts above: on, the sensors were turned on at the start and after each of Steam's later offs, 0 re-arm lines and aiming without a gyro binding; without the step (bb0242662, which is what =0 does) 50 re-arm lines and no aiming. Measured on a Steam Deck OLED only: a Deck LCD is Still to test

Risks

  • A write to a device Steam also manages. The IMU step sends a feature report to the Deck's controller beside SDL and Steam: only for the Deck's built-in controls, only while both sensors read the very same values (an IMU that is on moves the accelerometer by its last bit even on a table: 0 re-arms in 600 s at rest in the stands), at most once a second, and nothing while they move, so a gyro binding in Steam Input is left to Steam. One setting (IMU mode) in a SET_SETTINGS of length 3, no trackpad, lizard-mode or haptics setting; the 65 bytes are checked by tests/test_deck_imu.py. On the Deck OLED those bytes turned the IMU on, and Steam turning it off again (4 times in 31 minutes) was answered each time, never a steady back and forth. A Deck LCD's controller is not yet run. Nothing is put back at exit; Steam sets it again when its overlay closes or its layout changes. While it is on, the IMU draws power as it does with a gyro binding. HOS_DECK_IMU=0 turns this part off.
  • A gyro binding in Steam Input together with this PR: Steam's mouse and Motion controls would both follow the gyro where the game aims with motion. The bb0242662 start with "As Mouse" bound showed aiming that followed the Deck and a mouse cursor; whether the aim moved twice as far was not judged (Still to test). Removing the binding, or Motion controls Off, leaves one of the two.
  • SDL's Steam Deck driver beside Steam Input. Once SDL opens the Deck's controls it clears their digital mappings, sets both trackpads' modes to none (lizard mode off) and feeds the controller's watchdog. In the Game Mode sessions the sticks, buttons, trackpads and the Steam and Quick Access buttons were fine in the game; after quitting (Steam's UI, Desktop Mode's trackpad mouse) is not yet checked. HOS_DECK_GYRO=0 keeps the Deck's controls in Steam's list, as on main.
  • A Deck at rest without #1796: started from Steam, the IMU step takes the Deck's pad (motion only beside Steam Input's pad) out of main's frozen-gyro rule, so main's re-arms at rest (5 in 600 s in stand A, which had neither) stop for that pad, whichever merges first; with HOS_DECK_IMU=0 it has main's rule again. Started outside Steam (no stand-in pad, omgitsgela's case) the Deck's pad keeps main's rule: that is #1796's to fix.
  • Other pads: the list is now sized from Steam's, so Valve's other pads (the Steam Controller) come out of a long list as they were meant to; their motion-only handling is main's, unchanged. Non-Valve pads, runs not started by Steam and Windows without Steam's list are unchanged. Not run with a Steam Controller or on Windows (Still to test).
  • After updating: saves, longshot_options.ini, the caches and the renderer's interface are untouched. Two new log lines under Steam, two more on a Deck whose sensors Steam left off, and a warning when Valve's pads stay in the list. A revert is enough to undo it.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit. [head 8704dbc1a on main a104182b4]
  • Tested on my own PC, in the game for a change the game runs, as Testing says. [in Game Mode on the Steam Deck OLED, the whole PR, no gyro binding: v3.0.0-54-gcf94a4fec, this head's Deck code on main 9ea65c7bf with PR 1796, not this head's own build; what differs is in Measurements' Baseline. The head's own build on current main is Still to test]
  • mise run test passes (any failure that also fails on main is named). [the whole run_all.py at 6ed99ae48 on main 068fb8ebe, the same commits, against main 068fb8ebe; the changed-file checks at this head]
  • Measured against main, or Measurements says why there is nothing to measure. [what the log shows per build and start in Game Mode, against the earlier builds that the Baseline line names (main's list code in 7e1a68a43, no IMU step in bb0242662); no frame time, and Measurements says why]
  • 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. [the 4096-byte buffer, on main too: tests/test_steam_pads.py fails at b98aec7ff for it and on main, passes here; tests/test_deck_imu.py fails on main and passes here]
  • A switch added or changed: it ships at the default the measurements chose, with its row in gpu/vk/switches.def. [HOS_DECK_GYRO and HOS_DECK_IMU both on, chosen by the Game Mode starts on the Steam Deck OLED (Measurements, the switches); both rows are in; a Deck LCD is Still to test]
  • A check under tests/ that reads changed source is updated, not weakened. [tests/test_gyro_rearm.py's fixture gets deck_imu = 0; tests/test_steam_pads.py extended]
  • Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. [host/pad_sdl.c and host/hos_sdl.c compiled for both at this head; the HID path is SDL's own, passed through]
  • Docs updated.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested. [the head's own build in Game Mode, the controls after quitting, a gyro binding together with this, a Deck LCD, a Steam Controller and Windows not run]
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). [the Steam Deck OLED only: no Deck LCD, no PC with a Steam Controller]
  • Approved in review, every comment answered. [no review yet]
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold. [Forgejo runs no CI yet; the head 8704dbc1a is pushed, on main a104182b4; the Game Mode numbers are from cf94a4fec on main 9ea65c7bf, the same Deck code (Measurements, Baseline), not yet run again on current main]
## Summary On a Steam Deck started from Steam, Motion controls finds no gyro: Steam hides the Deck's built-in controls from the game and gives it a stand-in pad with no sensors, so players fake gyro aiming with a Steam Input "Gyro to Mouse" layout. This PR lets the game read the Deck's own gyro beside Steam Input's pad, and turns the Deck's motion sensors on when Steam left them off. In Game Mode on a Steam Deck OLED, started from the Steam shortcut with **no gyro binding** in the game's Steam Input layout, the Motion controls row reads "On (gyro found)" and aiming follows the Deck, before, during and after opening Steam's overlay (zeldaootr: "everything worked great"; Testing). That run was this PR's Deck code built on an earlier `main` (Measurements' Baseline says what differs), not this head's own build. What it changes, in three parts: 1. **The Deck's controls out of Steam's ignore list, whatever the list's length.** Steam's `SDL_GAMECONTROLLER_IGNORE_DEVICES` lists Valve's pads; main already takes Valve's out (for the Steam Controller's gyro, https://git.magicbean.dev/MagicBeanDev/Hookshot/pulls/2495) but kept the Deck's (`0x28de/0x1205`) in. This PR takes the Deck's out too (`HOS_DECK_GYRO=0` keeps it in), sizes the new list from Steam's instead of a fixed buffer, and logs a warning, with the reason, whenever Valve's pads have to stay in the list. Beside Steam Input's pad the Deck's controls give their motion only: buttons and sticks keep coming through Steam Input as the player's layout maps them. 2. **One more log line under Steam:** the list's size and the Deck's entries before and after, the "after" read back from SDL, so a log tells a list SDL never got apart from a pad SDL opened with its sensors off. 3. **The Deck's motion sensors turned on when Steam left them off.** Without a gyro binding in the game's Steam Input layout, Steam keeps the Deck's IMU off (and turns it off again now and then while the game runs, as around its overlay), and SDL's Steam Deck driver never turns it on. While both sensors read the very same values for over 1.2 s, the game writes the one setting that turns them on (IMU mode: raw accelerometer and gyroscope) to the Deck's controller, at most once a second, and nothing while they move. Dolphin and SteamDeckGyroDSU write the same setting. `HOS_DECK_IMU=0` writes nothing. In Game Mode it turned the sensors on at the start and again each time Steam turned them off (Testing). **What went wrong on the way, and the fix it led to.** Headless stands on the Deck, with a one-entry list (`0x28de/0x1205`) set by hand as Steam's, passed. Then the first real start from the Steam shortcut in Game Mode did nothing: one controller, Steam's stand-in pad, and no line about Valve's controllers. The cause: `pads_start` copied Steam's list into a fixed 4096-byte buffer, and Steam's real list on the Deck is 11,102 characters, 793 entries; `steam_pads_without_valve` refused it (-1) and `pads_start` treated that as nothing to do, without a word. The same buffer is on main (`char kept[4096]` in `pads_start`, `host/pad_sdl.c` line 118): main's own Steam Controller path. Fed that list, main's `steam_pads_without_valve` returns -1 into 4096 bytes (42 Valve entries and 10,513 characters into a buffer that fits), so on main, under a list this long, a Steam Controller stays ignored too and Motion controls finds no gyro on it, with nothing in the log. This PR fixes that path as well; it is not run with a Steam Controller here (Still to test), and the list was read on a Deck, not on a PC's Steam. The second Game Mode start then showed the sensors left off without a gyro binding (50 re-arm lines, no aiming), which part 3 answers. Read first: - input: `pads_start` in `host/pad_sdl.c` (the list sized from Steam's, the warning, the before/after line); `steam_pads_without_valve`, `steam_pads_count` and `steam_pads_is_deck` in `host/steam_pads.h`. - input: `deck_imu_poll` in `host/pad_sdl.c`, called from `motion_poll`: only for the Deck's built-in controls (vendor 0x28de, product 0x1205) while they are motion only beside Steam Input's pad and the pad Motion controls reads; it opens the pad's own HID device by the path SDL opened it by, sends the 65-byte feature report `00 87 03 30 18 00` (SET_SETTINGS, IMU_MODE = 0x0018), and closes it. `motion_poll`'s frozen-gyroscope rule leaves that pad alone (`!deck_imu`). `host/hos_sdl.c`: the pad's product id, `SDL_GetHint`, `SDL_hid_send_feature_report`. - switches: `kill` rows for `HOS_DECK_GYRO` and `HOS_DECK_IMU` in `gpu/vk/switches.def`; docs: `docs/dev/reference/input.md`, `docs/user/graphics-and-controls.md` (Motion). - tests: `tests/test_steam_pads.py` (runs `pads_start` cut from the source with a list shaped like Steam's: 11,102 characters, 793 entries, the Deck's twice, a trailing comma), `tests/test_deck_imu.py`, and `tests/test_gyro_rearm.py`'s fixture. Related: https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/1796 stops the frozen-gyro rule firing on a gyroscope that is merely at rest, which this PR exposes on a Deck (Risks). The two are independent: this PR's Deck path keeps its own two-sensor test and only tells main's rule to skip the Deck's pad, and either merges without the other. Whichever merges second has a one-line textual conflict on the rule's test line in `motion_poll`; the resolution is both conditions, `if (read && !deck_imu && !memcmp(g, last_g, sizeof g) && !memcmp(a, last_a, sizeof a))`, with `tests/test_gyro_rearm.py`'s fixture keeping both its `a` and `deck_imu = 0` (the Game Mode builds carry exactly that resolution). https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/699 (a "Custom" gyro aim style) also edits `host/pad_sdl.c`; https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/1171 is another topic. Thanks to omgitsgela, whose report of the frozen-gyro rule firing on a Steam Deck LCD, 102 times in ten minutes (https://git.magicbean.dev/MagicBeanDev/Longshot/issues/1477, their comment of 2026-11-19 06:34), showed that a Deck's gyroscope reads exactly the same at rest: the IMU step's "both sensors frozen" test comes from it. First asked for in the team's Discord thread "STEAM DECK GYRO SUPPORT". See https://git.magicbean.dev/MagicBeanDev/Longshot/issues/1477 ## Testing **Tested:** by zeldaootr on a Steam Deck OLED (SteamOS 3.9.5, Linux 7.2.7-valve2, RADV VANGOGH Mesa 26.2.0-devel (git-5c65d4fc31), SteamOS's SDL 3, `libSDL3.so.0.4.12`), Motion controls On. Every Deck build below is this PR's code at the time on main 9ea65c7bf, not this head's own build; the Game Mode builds also carry https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/1796's two commits. The last one, v3.0.0-54-gcf94a4fec, has this head's Deck code: `pads_start`, `deck_imu_poll` and both new tests are byte for byte this head's (Measurements, Baseline). - **Game Mode, no gyro binding, the whole PR (v3.0.0-54-gcf94a4fec), 2026-11-20, by zeldaootr:** started from the Steam shortcut after removing the "As Mouse" gyro binding from the game's Steam Input layout. His words: "everything worked great", and "before launching i unset the gyro. in game it just worked, before, during, and after opening the overlay". He then played for about 31 minutes. In that session's log and in an earlier start of the same build (about 70 s): the ignore-list lines, "Steam Deck Controller" `with a gyroscope` beside Steam Input's pad, `motion only`, `motion controls from "Steam Deck Controller"`; then once each, at the start, `the Steam Deck's motion sensors read nothing ...: turning them on` and `... were off ...: turned on`; **0** `stopped changing` re-arm lines (the build without the IMU step: 50), **0** warnings. Later, Steam turned the sensors off again and the game turned them back on: 4 `[debug] ... turned on again (N times now)` lines in the 31-minute session (about 12, 12, 18 and 27 minutes in, each right after a `the game read no controller for 2.2 s` (or 3.3 s) line, as when the game loses its input to Steam's overlay) and 1 in the short start; never a steady stream. The log does not record the overlay itself, so which recovery followed which overlay close is not known: that aiming came back after the overlay rests on zeldaootr's play. The `hid:` lines are in Measurements. - **Headless on the Deck with Steam's real environment, 2026-11-20** (the game started over ssh, Game Mode running, every `SDL_*` and `Steam*` variable Steam set for the shortcut, v3.0.0-54-gcf94a4fec and the build before it): the controller's hidraw device (28de:1205) opens read-write as the game's user. Four arms (the build without the IMU step; this build; this build with Steam's overlay library preloaded as Steam does; this build with `HOS_DECK_IMU=0`) all logged the two ignore-list lines, both controllers, `motion only, its buttons come through Steam Input's pad` and `motion controls from "Steam Deck Controller"`, 0 re-arm lines and no write (started over ssh the IMU is already on). A forced arm, where a script first wrote IMU mode 0 to the controller: the game logged `the Steam Deck's motion sensors read nothing ...: turning them on, once a second until they move`, then `... were off ...: turned on`, and the next motion sample was already moving; the script set the mode back afterwards. - **Second Game Mode start, 2026-11-20** (v3.0.0-52-gbb0242662: this branch's commits 1 to 6, no IMU step): the list reached SDL (`taken out of Steam's ignore list (44 of its entries)`, `now 10485 characters, 749 entries (the Steam Deck's 0)`); "Steam Deck Controller" opened `with a gyroscope` beside Steam Input's pad, `motion only`, `motion controls from "Steam Deck Controller"`, `hid: 1 controller through SDL`; the Motion controls row read "On (gyro found)". In the game the sticks, buttons, trackpads and the Steam and Quick Access buttons worked as usual; the back grips are unbound in that layout and were not judged. With no gyro binding, tilting did nothing: **50** `its gyroscope and accelerometer stopped changing: motion sensors turned off and on again` lines (both sensors identical: no IMU data at all), until zeldaootr bound the gyro "As Mouse" in Steam Input; after that there were none, aiming followed the Deck, and a mouse cursor appeared (that binding's own effect). That start is why part 3 exists. - **First Game Mode start, 2026-11-20** (v3.0.0-48-g7e1a68a43: 5306ca05d plus https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/1796): nothing changed. One controller, Steam's stand-in pad (`connected (SDL), Steam Input's`). Cause: the 4096-byte buffer against Steam's real list (Summary). Reproduced without the Deck: `pads_start` cut from that commit's source and fed Steam's list gave SDL nothing and logged nothing; the fixed one gave SDL 10,485 characters with no `0x28de` entry left. - **Headless stands, 2026-11-19** (the game started over ssh, Game Mode running, the list set by hand to `0x28de/0x1205`, 600 s standing in Kokiri Forest, the Deck at rest): with this PR's first two commits (5306ca05d) SDL opened "Steam Deck Controller" with a gyroscope beside "Steam Virtual Gamepad" and Motion controls read it throughout (1346 motion lines); with `HOS_DECK_GYRO=0` only the virtual gamepad opened and nothing was read, as on main. Measurements. - **Off the Deck**: `tests/test_deck_imu.py` fails at its test commit 698f9b885 (`FAIL:126 writes >= 8 && writes <= 10` and 7 more) and passes at the head. v3.0.0-54-gcf94a4fec started on this PC (Linux, llvmpipe) with every one of Steam's variables from the Deck, to the intro and out with exit 0, logging the same two list lines. Game-free, on Linux x86-64, in the PC's job queue: - At this head (3131b399d on main 08994a9ee), `run_all.py --changed forge/main` (55 checks that read the 10 changed files): 47 passed, 8 failed (`test_crash_dialog`, `test_dev_ab`, `test_frame_overlap`, `test_hud_layout_row`, `test_linux_pressure`, `test_present_queue_default`, `test_vk_occlusion_queries`, `test_walk_key`), all 8 also failing on main 068fb8ebe below. `test_steam_pads`, `test_deck_imu`, `test_gyro_rearm`, `test_switch_table` and `test_settings_table` pass. - The whole `python3 -I -B tests/run_all.py` (not `--strict`) at 6ed99ae48 (these eight commits on main 068fb8ebe; the rebase onto 08994a9ee changed none of them, `git range-diff` `=`) and on main 068fb8ebe, back to back on this PC: here 782 passed, 72 failed, 17 skipped; main 780 passed, 73 failed, 17 skipped. Every check that fails here fails on main too; main's failures are this PC's environment (tools, modules, timing). - The new tests at their test commits: `tests/test_steam_pads.py` fails at b98aec7ff (6 failures, among them `pads_start: Steam's real-sized list (11102 characters) reaches SDL without Valve's entries` and `HOS_DECK_GYRO=0: the Deck's entries stay, Valve's others come out`, which is main's own behaviour), fails at 651759394 (`steam_pads_count` not there yet), passes at the head. On main 08994a9ee with this head's tests: `test_steam_pads` and `test_deck_imu` fail. - `host/pad_sdl.c` and `host/hos_sdl.c` compiled (`-c`, the build's host flags, `-Wall`) with gcc and clang for Linux and llvm-mingw 20261104 for Windows, at this head and on main 08994a9ee: the same warnings on both (one from a generated header; one more in `hos_sdl.c` from `host/fullscreen_monitor.h`), none from this change. - Rebased since onto main a104182b4 (head 8704dbc1a; the lines above name the head before it, 3131b399d on 08994a9ee). Only `host/hos_sdl.c` and `host/hos_sdl.h` conflicted: main now has `hos_sdl_pad_product` itself (for the Steam Controller), so this PR no longer adds it and uses main's. `git range-diff`: `pads_start`, `deck_imu_poll`, `host/steam_pads.h` and both new tests are unchanged, the rest differs in `hos_sdl` and in docs context. The Deck's motion-only pad still stops before main's new vibration and haptics code: `pads_poll` reaches `continue` for it before the pad is counted and before `vib_choose`. At 8704dbc1a and on main a104182b4, the 49 checks that read the changed host files and the switch table: 42 passed and 7 failed here, 41 and 7 on main, the same 7 on both (`test_crash_dialog`, `test_dev_ab`, `test_frame_overlap`, `test_linux_pressure`, `test_present_queue_default`, `test_renhdrum`, `test_vk_occlusion_queries`), the one more here being `test_deck_imu`. Both files compile for Linux (gcc, clang) and Windows (llvm-mingw) with the same warnings as main. Not run in the game again after the rebase. <details><summary>The 72 checks that fail both here (6ed99ae48) and on main 068fb8ebe</summary> `test_appimage_player_build`, `test_bug_report_defaults`, `test_capture_readback_visibility`, `test_capture_read_once`, `test_crash_dialog`, `test_crt_options`, `test_damage_debug_menu`, `test_dav1d_av1`, `test_dev_ab`, `test_dev_packs`, `test_discover`, `test_display_startup_failure`, `test_dlss_feature_size`, `test_draw_stream_visibility`, `test_failed_compile_keeps_objects`, `test_frame_overlap`, `test_fsr3fi_hud_layer`, `test_fsr_image_retirement`, `test_fsr_uniform_ownership`, `test_guest_imported`, `test_high_fps_fixes`, `test_host_guest_writes`, `test_hud_layout_row`, `test_insn_fixed_convert`, `test_libc_hooks`, `test_lift_cache`, `test_lift_lookups`, `test_linux_preflight`, `test_linux_pressure`, `test_linux_tools`, `test_linux_update`, `test_log_open_failure`, `test_make_game_cache`, `test_make_game_ngx`, `test_mise_build`, `test_missing_nup`, `test_mods_list`, `test_mods_size_table`, `test_native_zstd`, `test_ngx_sdk`, `test_nonuniform_image_arrays`, `test_nup_codec`, `test_nup_read_name`, `test_nup_stand_in`, `test_nup_verify`, `test_parallel_init_order`, `test_pending_guest_import`, `test_pipeline_play_cache`, `test_prepare_cache_save`, `test_prepare_stall`, `test_present_queue_default`, `test_present_source_crop`, `test_present_thread`, `test_profiling_mode`, `test_prompt_guide_lines`, `test_prompt_hand_guides`, `test_prompt_picture_tint`, `test_prompt_speed`, `test_psychov35_fsr3_fg`, `test_readback_timeout_source`, `test_replay_write_order`, `test_slow_frames`, `test_song_note_cue`, `test_staging_burst`, `test_texel_buffer_ownership`, `test_thinlto_tls`, `test_upscaler_rows`, `test_vbytes` (times out at 600 s), `test_vcore_escape`, `test_vk_occlusion_queries`, `test_walk`, `test_walk_key`. Main also fails `test_pipeline_cache_save`. </details> **Still to test:** - Steam Deck OLED, Game Mode, from the Steam shortcut, this head built on current `main`, no gyro binding: one start, load a save and aim, open and close the Steam overlay once, expecting the same `hid:` lines as the v3.0.0-54-gcf94a4fec start in Measurements (`turning them on`, `turned on`, 0 `stopped changing` lines, no `[warn] hid:` line) and aiming as there (by hand: zeldaootr) - The same start: after quitting, the trackpads and the Steam and Quick Access buttons in Steam's library, then in Desktop Mode (trackpad as mouse, left trackpad scroll), expecting them as before the game started (by hand: zeldaootr) - Steam Deck OLED, Game Mode, with gyro bound "As Mouse" in the game's Steam Input layout and this build: expecting no IMU line at all (nothing written while the sensors move), and noting whether the aim moves twice as far (Steam's mouse and Motion controls both following the gyro) (by hand: zeldaootr) - Steam Deck LCD, Game Mode, from the Steam shortcut, no gyro binding: load a save, aim, open and close the overlay, expecting "On (gyro found)", aiming that follows the Deck, and the same `hid:` lines (by hand: someone with a Deck LCD) - Linux, a Steam Controller, the game started from Steam: aim with the gyro, expecting `hid: Valve's controllers (the Steam Deck's too) taken out of Steam's ignore list (N of its entries)` and the `SDL's controller ignore list` line in the log, and the gyro aiming (by hand: someone with a Steam Controller) - Windows, the game started from Steam, a Steam Controller or any other pad: expecting the same two list lines (or, without a list, none), the pad playing as on main, and a Steam Controller's gyro aiming (by hand: someone on Windows with Steam) ## Measurements **Verdict:** it works on a Steam Deck OLED in Game Mode: with no gyro binding in Steam Input, the game turned the Deck's motion sensors on at the start (one `turned on` line) and after each of the 4 times Steam turned them off in a 31-minute session, 0 re-arm lines against 50 in the build without the IMU step, and aiming followed the Deck by zeldaootr's play. The list fix before it opened the Deck's controls with a gyroscope where the earlier build opened only Steam's stand-in pad. No frame time measured: an input change, which reads two sensors per poll and, only while they are frozen, writes 65 bytes at most once a second (it turned the sensors on 5 times in the 31-minute session). Baseline: not main, and not this head's own build. Every column is a build on main 9ea65c7bf with https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/1796's two commits: 7e1a68a43 is this PR's earlier head 5306ca05d, whose list code is main's 4096-byte buffer with the Deck's entry also taken out, so under Steam's real list it left the list as main does; bb0242662 adds the list fix (this branch's commits 3 to 6); cf94a4fec adds the IMU step (this branch's commits 7 and 8, 698f9b885 and 3131b399d, cherry-picked). Why cf94a4fec's results hold for this head: `git range-diff 9ea65c7bf..cf94a4fec 08994a9ee..3131b399d` and a diff of the files show `pads_start`, `deck_imu_poll`, `tests/test_deck_imu.py` and `tests/test_steam_pads.py` identical, and `host/steam_pads.h` differing in one comment only. What differs: (1) `host/hos_sdl.c`: 9ea65c7bf predates main's HID calls (added for the DualSense's haptics, https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/405), so the build carries its own copy of `hos_sdl_pad_path`, `hos_sdl_hid_open` and `hos_sdl_hid_close` where this head uses main's, which are the same but for `hos_sdl_hid_open` also asking for `SDL_hid_write` (every SDL3 has it); (2) the frozen-gyro rule's line in `motion_poll` has https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/1796's accelerometer condition in the build and main's gyro-only one here, and the Deck's motion-only pad skips that rule either way (`!deck_imu`); (3) the rest of `main` since 9ea65c7bf, among it the new vibration code, which a motion-only pad never reaches (`pads_poll` moves on before it); (4) `docs/dev/reference/input.md` is not in the build. Main itself was not started from the shortcut; `HOS_DECK_GYRO=0` gives main's list (the stands below). Setup: Steam Deck OLED, SteamOS 3.9.5 (Linux 7.2.7-valve2), RADV VANGOGH Mesa 26.2.0-devel (git-5c65d4fc31), SDL 3 (`libSDL3.so.0.4.12`), 16 GB; Game Mode, started from zeldaootr's Steam shortcut, Steam Input on, Steam's overlay preloaded; Motion controls On. What each start's log says was opened and read, its IMU and `stopped changing` lines and warnings, its length from the log's 5-second `vi:` lines (and `vk: status:` lines, one per 600 frames); Motion controls' row and the aiming by hand. One start or session each: counts, not timings. | | Before: PR @ 7e1a68a43 (5306ca05d + PR 1796) | Before, no IMU step: PR @ bb0242662 (commits 1-6 + PR 1796) | After: this PR @ cf94a4fec (3131b399d's Deck code + PR 1796), first start | After: this PR @ cf94a4fec, play session | |---|---|---|---|---| | gyro binding in Steam Input | not noted | none, then "As Mouse" partway | none | none | | Steam's list (`SDL_GAMECONTROLLER_IGNORE_DEVICES`) | 11,102 characters, 793 entries (the Deck's 2), left as Steam set it, no log line | `taken out ... (44 of its entries)`; `now 10485 characters, 749 entries (the Steam Deck's 0)` | the same | the same | | pads opened | Steam's stand-in pad only | the stand-in pad, and "Steam Deck Controller" `with a gyroscope`, `motion only` | the same | the same | | `motion controls from` | none | "Steam Deck Controller" | "Steam Deck Controller" | "Steam Deck Controller" | | `read nothing ...: turning them on` / `were off ...: turned on` | (no such step) | (no such step) | 1 / 1 | 1 / 1 | | `[debug] ... turned on again` | (no such step) | (no such step) | 1 | 4 (about 12, 12, 18, 27 min in) | | `stopped changing` re-arm lines | none (no gyro pad) | 50, until the binding | 0 | 0 | | `[warn]` lines | 0 | 0 | 0 | 0 | | length (`vi:` lines × 5 s; frames) | not noted | about 5.7 min (68; 13,351 frames, 22 status lines) | about 70 s (14; 2,712 frames, 4 status lines) | about 31 min (367; 62,420 frames, 104 status lines) | | aiming, by hand | not noted | nothing until the binding, then followed the Deck (and a mouse cursor) | not noted apart from the session | "it just worked, before, during, and after opening the overlay" (zeldaootr) | (Two more starts of cf94a4fec on the Deck that day were headless, without Steam's variables: no stand-in pad, so the Deck's controls play directly, the IMU step does not apply, 0 IMU lines and 0 re-arm lines.) ``` before (7e1a68a43), Game Mode, the only controller line: hid: controller "Steam Deck Controller" connected (SDL), Steam Input's; guid=030079f6de280000ff11000001000000 after (cf94a4fec), Game Mode, the play session, no gyro binding (mapping strings left out): [hos host] hid: Valve's controllers (the Steam Deck's too) taken out of Steam's ignore list (44 of its entries), for their motion sensors [hos host] hid: SDL's controller ignore list: Steam's 11102 characters, 793 entries (the Steam Deck's 2); now 10485 characters, 749 entries (the Steam Deck's 0) [hos host] hid: SDL controller support ready (DualSense, DualShock 4, Switch Pro, Xbox and others) [hos host] hid: controller "Steam Deck Controller" connected (SDL), with a gyroscope; guid=0300f617de2800000512000000036800; mapping=available; mapping-name="Steam Deck Controller" [hos host] hid: controller "Steam Deck Controller" connected (SDL), Steam Input's; guid=030079f6de280000ff11000001000000; mapping=available; mapping-name="Steam Virtual Gamepad" [hos host] hid: "Steam Deck Controller": motion only, its buttons come through Steam Input's pad [hos host] hid: motion controls from "Steam Deck Controller" [hos host] hid: 51 controls from longshot_options.ini [hos host] hid: "Steam Deck Controller": the Steam Deck's motion sensors read nothing (Steam turns them off without a gyro binding): turning them on, once a second until they move (HOS_DECK_IMU=0 not to) [hos host] hid: "Steam Deck Controller": the Steam Deck's motion sensors were off (Steam turns them off without a gyro binding): turned on [hos sead::MainThread] hid: the game reads npad 0 (No.1, lr 0x83489670) [hos sead::MainThread] hid: 1 controller through SDL [hos sead::MainThread] hid: six-axis handles: 2 asked for, 3 reported [hos BaseProcExecutor2] hid: the game read no controller for 2.2 s (lr 0x83489670) [hos host] [debug] hid: "Steam Deck Controller": the Steam Deck's motion sensors turned on again (2 times now) [hos BaseProcExecutor3] hid: the game read no controller for 2.2 s (lr 0x83489670) [hos host] [debug] hid: "Steam Deck Controller": the Steam Deck's motion sensors turned on again (3 times now) [hos BaseProcExecutor1] hid: the game read no controller for 3.3 s (lr 0x83489670) [hos host] [debug] hid: "Steam Deck Controller": the Steam Deck's motion sensors turned on again (4 times now) [hos ModuleSystemWorker5] hid: the game read no controller for 2.2 s (lr 0x83489670) [hos host] [debug] hid: "Steam Deck Controller": the Steam Deck's motion sensors turned on again (5 times now) bb0242662, Game Mode, no gyro binding (after the same list and pad lines): [hos host] hid: "Steam Deck Controller": its gyroscope and accelerometer stopped changing: motion sensors turned off and on again (50 times, until the binding) main's steam_pads_without_valve (08994a9ee), fed Steam's list from the Deck: list 11102 chars; into 4096: -1, out ""; into 20000: 42, out 10513 chars ``` Headless stands, 2026-11-19 (Steam Deck OLED as above, Game Mode running, the game started over ssh, `HOS_HEADLESS=1`, the list set by hand; Kokiri Forest, Link standing, 600 s each after the save loaded, the Deck at rest on AC, back to back). Reproduce: `SDL_GAMECONTROLLER_IGNORE_DEVICES=0x28de/0x1205 SDL_GAMECONTROLLER_ALLOW_STEAM_VIRTUAL_GAMEPAD=1 HOS_MOTION_DEBUG=1 HOS_HEADLESS=1 RX_VK_PRECOMPILE=0` (plus `HOS_DECK_GYRO=0`), load a save, leave the Deck still, read `longshot_log.txt`. Main itself ran this way on 2026-11-16 (a main 9c9d69ed runtime): the virtual gamepad only, no motion, as the `HOS_DECK_GYRO=0` column. | | Before, HOS_DECK_GYRO=0: PR @ 5306ca05d | After: PR @ 5306ca05d | |---|---|---| | pads opened | "Steam Virtual Gamepad" only | "Steam Virtual Gamepad", and "Steam Deck Controller" with a gyroscope | | `motion controls from` | none | once, "Steam Deck Controller" | | motion debug lines in 600 s | 0 | 1346, accel about (0, -0.88, -0.36) G, gyro +0.000 | | re-arm lines (main's gyro-only rule) | 0 | 5 (0 with https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/1796, the same stand) | | exit | 0 | 0 | **The switches:** | Switch | Kind | Ships at | What chose it | |---|---|---|---| | `HOS_DECK_GYRO` | kill | on: started from Steam, the Deck's built-in controls come out of Steam's ignore list | the Game Mode starts above (gyro found; Steam Input's sticks, buttons, trackpads, Steam and Quick Access buttons fine in the game) and the stands; `=0` is main's behaviour. After quitting is not yet checked (Still to test) | | `HOS_DECK_IMU` | kill | on: while the Deck's two sensors read nothing, the IMU setting is written at most once a second | the Game Mode starts above: on, the sensors were turned on at the start and after each of Steam's later offs, 0 re-arm lines and aiming without a gyro binding; without the step (bb0242662, which is what `=0` does) 50 re-arm lines and no aiming. Measured on a Steam Deck OLED only: a Deck LCD is Still to test | ## Risks - **A write to a device Steam also manages.** The IMU step sends a feature report to the Deck's controller beside SDL and Steam: only for the Deck's built-in controls, only while both sensors read the very same values (an IMU that is on moves the accelerometer by its last bit even on a table: 0 re-arms in 600 s at rest in the stands), at most once a second, and nothing while they move, so a gyro binding in Steam Input is left to Steam. One setting (IMU mode) in a SET_SETTINGS of length 3, no trackpad, lizard-mode or haptics setting; the 65 bytes are checked by `tests/test_deck_imu.py`. On the Deck OLED those bytes turned the IMU on, and Steam turning it off again (4 times in 31 minutes) was answered each time, never a steady back and forth. A Deck LCD's controller is not yet run. Nothing is put back at exit; Steam sets it again when its overlay closes or its layout changes. While it is on, the IMU draws power as it does with a gyro binding. `HOS_DECK_IMU=0` turns this part off. - **A gyro binding in Steam Input together with this PR:** Steam's mouse and Motion controls would both follow the gyro where the game aims with motion. The bb0242662 start with "As Mouse" bound showed aiming that followed the Deck and a mouse cursor; whether the aim moved twice as far was not judged (Still to test). Removing the binding, or Motion controls Off, leaves one of the two. - **SDL's Steam Deck driver beside Steam Input.** Once SDL opens the Deck's controls it clears their digital mappings, sets both trackpads' modes to none (lizard mode off) and feeds the controller's watchdog. In the Game Mode sessions the sticks, buttons, trackpads and the Steam and Quick Access buttons were fine in the game; after quitting (Steam's UI, Desktop Mode's trackpad mouse) is not yet checked. `HOS_DECK_GYRO=0` keeps the Deck's controls in Steam's list, as on main. - **A Deck at rest without https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/1796:** started from Steam, the IMU step takes the Deck's pad (motion only beside Steam Input's pad) out of main's frozen-gyro rule, so main's re-arms at rest (5 in 600 s in stand A, which had neither) stop for that pad, whichever merges first; with `HOS_DECK_IMU=0` it has main's rule again. Started outside Steam (no stand-in pad, omgitsgela's case) the Deck's pad keeps main's rule: that is https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/1796's to fix. - **Other pads:** the list is now sized from Steam's, so Valve's other pads (the Steam Controller) come out of a long list as they were meant to; their motion-only handling is main's, unchanged. Non-Valve pads, runs not started by Steam and Windows without Steam's list are unchanged. Not run with a Steam Controller or on Windows (Still to test). - After updating: saves, `longshot_options.ini`, the caches and the renderer's interface are untouched. Two new log lines under Steam, two more on a Deck whose sensors Steam left off, and a warning when Valve's pads stay in the list. A revert is enough to undo it. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. [head 8704dbc1a on main a104182b4] - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. [in Game Mode on the Steam Deck OLED, the whole PR, no gyro binding: v3.0.0-54-gcf94a4fec, this head's Deck code on main 9ea65c7bf with PR 1796, not this head's own build; what differs is in Measurements' Baseline. The head's own build on current `main` is Still to test] - [x] `mise run test` passes (any failure that also fails on `main` is named). [the whole `run_all.py` at 6ed99ae48 on main 068fb8ebe, the same commits, against main 068fb8ebe; the changed-file checks at this head] - [x] Measured against `main`, or Measurements says why there is nothing to measure. [what the log shows per build and start in Game Mode, against the earlier builds that the Baseline line names (main's list code in 7e1a68a43, no IMU step in bb0242662); no frame time, and Measurements says why] - [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. [the 4096-byte buffer, on main too: `tests/test_steam_pads.py` fails at b98aec7ff for it and on main, passes here; `tests/test_deck_imu.py` fails on main and passes here] - [x] A switch added or changed: it ships at the default the measurements chose, with its row in `gpu/vk/switches.def`. [`HOS_DECK_GYRO` and `HOS_DECK_IMU` both on, chosen by the Game Mode starts on the Steam Deck OLED (Measurements, the switches); both rows are in; a Deck LCD is Still to test] - [x] A check under `tests/` that reads changed source is updated, not weakened. [`tests/test_gyro_rearm.py`'s fixture gets `deck_imu = 0`; `tests/test_steam_pads.py` extended] - [x] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. [`host/pad_sdl.c` and `host/hos_sdl.c` compiled for both at this head; the HID path is SDL's own, passed through] - [x] Docs updated. - [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. [the head's own build in Game Mode, the controls after quitting, a gyro binding together with this, a Deck LCD, a Steam Controller and Windows not run] - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). [the Steam Deck OLED only: no Deck LCD, no PC with a Steam Controller] - [ ] Approved in review, every comment answered. [no review yet] - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. [Forgejo runs no CI yet; the head 8704dbc1a is pushed, on main a104182b4; the Game Mode numbers are from cf94a4fec on main 9ea65c7bf, the same Deck code (Measurements, Baseline), not yet run again on current `main`]
`tests/test_steam_pads.py` now expects `steam_pads_without_valve` to take
the Deck's `0x28de/0x1205` entry out of `SDL_GAMECONTROLLER_IGNORE_DEVICES`
too, unless asked to keep it (`keep_deck`, for `HOS_DECK_GYRO=0`), and
checks that the Deck's controls give their motion only beside Steam
Input's pad. Fails on main, which keeps the Deck's entry and has no
`keep_deck`.

Assisted-by: Claude
feat(host): the Steam Deck's gyro reaches Motion controls when Steam starts the game
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 8s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
31dc503fd3
Started from Steam, the game gets Steam's `SDL_GAMECONTROLLER_IGNORE_DEVICES`,
which lists the Deck's built-in controls (`0x28de/0x1205`), so SDL opened
only Steam Input's stand-in pad, which has no sensors: the Motion controls
row said "no gyro on this pad" and players set up Steam Input's gyro to
mouse instead. Valve's other pads already came out of that list for the
same reason; the Deck's was kept because SDL's Steam Deck driver writes its
trackpad settings (lizard mode off) as it opens it.

- `host/steam_pads.h`: `steam_pads_without_valve` takes the Deck's entry
  out too, unless `keep_deck`.
- `host/pad_sdl.c`: `pads_start` passes `keep_deck` from `HOS_DECK_GYRO=0`
  and says which it did. Beside the stand-in pad the Deck's controls give
  their motion only (`steam_pads_motion_only`, unchanged): buttons and
  sticks keep coming through Steam Input as the player's layout maps them.
- README (Motion controls) and `docs/development.md` (`HOS_DECK_GYRO`).

Not yet run on a Deck: whether Steam Input's trackpads keep working beside
SDL's driver is the open question.

Assisted-by: Claude
Author
Contributor

Tested in game: Steam Deck OLED, SteamOS 3.9.5, headless over ssh with Steam's controller variables set by hand: with the change SDL3 opens Steam Deck Controller with a gyroscope and Motion controls reads it; main and HOS_DECK_GYRO=0 open only Steam's virtual gamepad. Not yet run from the Steam shortcut in Game Mode.

Tested in game: Steam Deck OLED, SteamOS 3.9.5, headless over ssh with Steam's controller variables set by hand: with the change SDL3 opens Steam Deck Controller with a gyroscope and Motion controls reads it; main and HOS_DECK_GYRO=0 open only Steam's virtual gamepad. Not yet run from the Steam shortcut in Game Mode.
Member

Possibly related, for context:

  • PR #699 WIP: feat(input): custom gyro aiming with per-item aim detection — Overlapping input code: gyro aiming PR also edits host/pad_sdl.c.
Possibly related, for context: - PR #699 WIP: feat(input): custom gyro aiming with per-item aim detection — Overlapping input code: gyro aiming PR also edits host/pad_sdl.c.
Owner

Brought up to the ready-for-review standard (#1454): the checklist's Everyone list has two new boxes, added here from what this PR's description and comments show (please check they match what you know).

  • Tested on my own PC: not ticked: Testing's Tested names headless ssh runs with Steam variables set by hand, not a game played; Game Mode and aiming were not run. Run it yourself on your PC (in the game, for a change the game runs) and say where and what you saw in Testing's Tested; or, when the fix's own case can't be run by hand, add a **Not testable by hand:** line saying why and what stands in for it. Then tick it.
  • Nothing gets worse that I know of: not ticked: Risks says Steam's trackpad settings could change during play or after quitting, and that was not measured. Measure that cost and state it in Risks, then tick it.
Brought up to the [ready-for-review standard](https://git.magicbean.dev/MagicBeanDev/Longshot/src/branch/main/CONTRIBUTING.md#ready-for-review-out-of-wip) (#1454): the checklist's Everyone list has two new boxes, added here from what this PR's description and comments show (please check they match what you know). - *Tested on my own PC*: not ticked: Testing's Tested names headless ssh runs with Steam variables set by hand, not a game played; Game Mode and aiming were not run. Run it yourself on your PC (in the game, for a change the game runs) and say where and what you saw in Testing's *Tested*; or, when the fix's own case can't be run by hand, add a `**Not testable by hand:**` line saying why and what stands in for it. Then tick it. - *Nothing gets worse that I know of*: not ticked: Risks says Steam's trackpad settings could change during play or after quitting, and that was not measured. Measure that cost and state it in Risks, then tick it.
zeldaootr force-pushed deck-gyro from 31dc503fd3
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 8s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
to 2ccf1040c5
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 4s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
2026-11-19 21:10:38 +00:00
Compare
Author
Contributor

Rebased onto main a433db328; the change gained a kill row for HOS_DECK_GYRO in gpu/vk/switches.def, which main's tests/test_switch_table.py now asks for, and the test commit is unchanged. Three ten-minute headless stands on a Steam Deck OLED (built at 5306ca05d on main 9ea65c7bf) are now in Measurements and docs/tested/: with this PR the Deck's gyro is found and read beside Steam's virtual gamepad, and with HOS_DECK_GYRO=0 only the virtual gamepad opens and there is no motion. The same stands show the frozen-gyro rule turning a resting Deck's sensors off and on 5 times in 600 s with this PR alone, and 0 times with #1796, so this PR should merge after that one. Still open, and the reason it stays WIP: the by-hand run in Game Mode from the Steam shortcut (aiming, buttons, trackpads, back grips, Steam and Quick Access buttons, after quitting and in Desktop Mode), by zeldaootr.

Rebased onto main a433db328; the change gained a `kill` row for `HOS_DECK_GYRO` in `gpu/vk/switches.def`, which main's `tests/test_switch_table.py` now asks for, and the test commit is unchanged. Three ten-minute headless stands on a Steam Deck OLED (built at 5306ca05d on main 9ea65c7bf) are now in Measurements and `docs/tested/`: with this PR the Deck's gyro is found and read beside Steam's virtual gamepad, and with `HOS_DECK_GYRO=0` only the virtual gamepad opens and there is no motion. The same stands show the frozen-gyro rule turning a resting Deck's sensors off and on 5 times in 600 s with this PR alone, and 0 times with https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/1796, so this PR should merge after that one. Still open, and the reason it stays WIP: the by-hand run in Game Mode from the Steam shortcut (aiming, buttons, trackpads, back grips, Steam and Quick Access buttons, after quitting and in Desktop Mode), by zeldaootr.
zeldaootr force-pushed deck-gyro from 2ccf1040c5
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 4s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
to 3131b399da
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 4s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
2026-11-20 04:40:59 +00:00
Compare
Author
Contributor

Two Game Mode starts from the Steam shortcut on a Steam Deck OLED. The first did nothing (only Steam's stand-in pad opened, with nothing in the log): pads_start copied Steam's real ignore list, 11,102 characters and 793 entries, into a fixed 4096-byte buffer and gave up without a word; main's Steam Controller path has the same buffer, so this fixes it too. With the list sized from Steam's and a warning whenever Valve's pads must stay in it, the second start opened the Deck's controls with a gyroscope beside Steam Input's pad and Motion controls read "On (gyro found)"; tilting did nothing until a gyro binding in Steam Input (50 frozen-sensor lines before it), because Steam leaves the Deck's IMU off without one, and with "As Mouse" bound aiming followed the Deck. The last two commits add the step that turns the IMU on when both sensors read nothing (deck_imu_poll, HOS_DECK_IMU, tests/test_deck_imu.py); it is test-first and smoke-run only, not yet run in Game Mode. The docs(tested) commit is dropped, since main removed the tested-configurations catalogue (the other eight commits unchanged, git range-diff =), and the description follows the new template. It stays WIP until the IMU step has run on the Deck.

Two Game Mode starts from the Steam shortcut on a Steam Deck OLED. The first did nothing (only Steam's stand-in pad opened, with nothing in the log): `pads_start` copied Steam's real ignore list, 11,102 characters and 793 entries, into a fixed 4096-byte buffer and gave up without a word; main's Steam Controller path has the same buffer, so this fixes it too. With the list sized from Steam's and a warning whenever Valve's pads must stay in it, the second start opened the Deck's controls with a gyroscope beside Steam Input's pad and Motion controls read "On (gyro found)"; tilting did nothing until a gyro binding in Steam Input (50 frozen-sensor lines before it), because Steam leaves the Deck's IMU off without one, and with "As Mouse" bound aiming followed the Deck. The last two commits add the step that turns the IMU on when both sensors read nothing (`deck_imu_poll`, `HOS_DECK_IMU`, `tests/test_deck_imu.py`); it is test-first and smoke-run only, not yet run in Game Mode. The `docs(tested)` commit is dropped, since main removed the tested-configurations catalogue (the other eight commits unchanged, `git range-diff` `=`), and the description follows the new template. It stays WIP until the IMU step has run on the Deck.
Author
Contributor

The IMU step ran in Game Mode: zeldaootr started v3.0.0-54-gcf94a4fec (this head's Deck code on main 9ea65c7bf with #1796, not this head's own build; Measurements' Baseline says what differs) from the Steam shortcut on a Steam Deck OLED with no gyro binding in Steam Input, and aiming followed the Deck before, during and after opening the overlay ("everything worked great"). In a 31-minute session and a 70 s start the log has the two IMU lines once each at the start, 4 and 1 later turned on again recoveries, 0 re-arm lines (50 in the build without the step) and no warning; a headless forced-off check on the Deck also turned the sensors back on. Testing, Measurements, Risks and the three Ready-for-review / When-it-applies boxes are updated to match. Still open: this head built on current main in Game Mode, the trackpads and Steam buttons after quitting and in Desktop Mode, a gyro binding together with this, a Steam Deck LCD, a Steam Controller, and Windows.

The IMU step ran in Game Mode: zeldaootr started v3.0.0-54-gcf94a4fec (this head's Deck code on main 9ea65c7bf with https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/1796, not this head's own build; Measurements' Baseline says what differs) from the Steam shortcut on a Steam Deck OLED with no gyro binding in Steam Input, and aiming followed the Deck before, during and after opening the overlay ("everything worked great"). In a 31-minute session and a 70 s start the log has the two IMU lines once each at the start, 4 and 1 later `turned on again` recoveries, 0 re-arm lines (50 in the build without the step) and no warning; a headless forced-off check on the Deck also turned the sensors back on. Testing, Measurements, Risks and the three Ready-for-review / When-it-applies boxes are updated to match. Still open: this head built on current `main` in Game Mode, the trackpads and Steam buttons after quitting and in Desktop Mode, a gyro binding together with this, a Steam Deck LCD, a Steam Controller, and Windows.
zeldaootr changed title from WIP: feat(host): the Steam Deck's gyro reaches Motion controls when Steam starts the game to feat(host): the Steam Deck's gyro reaches Motion controls when Steam starts the game 2026-11-20 06:34:19 +00:00
zeldaootr force-pushed deck-gyro from 3131b399da
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 4s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
to 8704dbc1ae
All checks were successful
PR description / Description follows the template (pull_request_target) Successful in 11s
2026-11-20 18:47:53 +00:00
Compare
Author
Contributor

Rebased onto main a104182b4 (head 8704dbc1a). Only host/hos_sdl.c and host/hos_sdl.h conflicted: main now has hos_sdl_pad_product itself, so this PR uses main's and no longer adds it. pads_start, deck_imu_poll, host/steam_pads.h and the two new tests are unchanged (git range-diff). The Deck's motion-only pad still stops before main's new vibration and haptics code. The checks that read the changed files give the same failures here and on main; both files compile for Linux and Windows. Not run in the game again after the rebase.

Rebased onto main a104182b4 (head 8704dbc1a). Only `host/hos_sdl.c` and `host/hos_sdl.h` conflicted: main now has `hos_sdl_pad_product` itself, so this PR uses main's and no longer adds it. `pads_start`, `deck_imu_poll`, `host/steam_pads.h` and the two new tests are unchanged (`git range-diff`). The Deck's motion-only pad still stops before main's new vibration and haptics code. The checks that read the changed files give the same failures here and on main; both files compile for Linux and Windows. Not run in the game again after the rebase.
Author
Contributor

Rebased onto main 87c0d7b4d (head 97bd6fb59), which now has #1796. The two touch the same lines: the frozen-gyro rule here now has both conditions, main's "and the accelerometer is frozen too" and this PR's "not the Deck's own controls". That is the combination the Game Mode test build ran (this PR's code with 1796's two commits). The three gyro checks pass at this head. Not run in the game again after the rebase.

Rebased onto main 87c0d7b4d (head 97bd6fb59), which now has https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/1796. The two touch the same lines: the frozen-gyro rule here now has both conditions, main's "and the accelerometer is frozen too" and this PR's "not the Deck's own controls". That is the combination the Game Mode test build ran (this PR's code with 1796's two commits). The three gyro checks pass at this head. Not run in the game again after the rebase.
zeldaootr force-pushed deck-gyro from 8704dbc1ae
All checks were successful
PR description / Description follows the template (pull_request_target) Successful in 11s
to 97bd6fb594
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 4s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
2026-11-20 23:27:11 +00:00
Compare
Author
Contributor

Rebased onto main 6e1521a70 (head 56201f8a6). Main now marks the Deck's own controls so their trackpad mouse doesn't also fire mouse bindings; its new checks and helper are kept beside this PR's. pads_start and deck_imu_poll are unchanged, and the Deck's motion-only pad still leaves the per-pad loop before it is counted and before any button, Sprint or vibration handling. The three gyro checks pass at this head; not run in the game again after the rebase.

Rebased onto main 6e1521a70 (head 56201f8a6). Main now marks the Deck's own controls so their trackpad mouse doesn't also fire mouse bindings; its new checks and helper are kept beside this PR's. `pads_start` and `deck_imu_poll` are unchanged, and the Deck's motion-only pad still leaves the per-pad loop before it is counted and before any button, Sprint or vibration handling. The three gyro checks pass at this head; not run in the game again after the rebase.
zeldaootr force-pushed deck-gyro from 97bd6fb594
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 4s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
to 56201f8a66
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request) Blocked by required conditions
PR description / Description follows the template (pull_request_target) Successful in 4s
2026-11-21 02:19:37 +00:00
Compare
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request) Blocked by required conditions
PR description / Description follows the template (pull_request_target) Successful in 4s
This pull request doesn't have enough approvals yet. 0 of 1 approvals granted.
Some workflows are waiting to be reviewed.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'deck-gyro:zeldaootr-deck-gyro'
git switch 'zeldaootr-deck-gyro'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 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!1181
No description provided.