WIP: feat(host): the Steam Deck's gyro reaches Motion controls when Steam starts the game #1181
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!1181
Loading…
Reference in a new issue
No description provided.
Delete branch "zeldaootr/Longshot:deck-gyro"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Type: feat · Risk: medium · Tested on: Steam Deck OLED (SteamOS 3.9.5), headless over ssh with Steam's variables set by hand: the Deck's gyroscope is found; Linux, game-free checks · Needs: Steam Deck, Game Mode, from the Steam shortcut, by hand (aiming, and the trackpads beside Steam Input)
Why
On a Steam Deck started from Steam, the Motion controls row says "no gyro on this pad" and motion aiming gets nothing, so players build a Steam Input "Gyro to Mouse" workaround. Steam hides the Deck's built-in controls from the game (its
SDL_GAMECONTROLLER_IGNORE_DEVICES) and gives it a stand-in pad with no sensors. Valve's other pads were already taken out of that list for their gyro; the Deck's was kept in until it was tried beside Steam Input. Reported in the team's Discord thread "STEAM DECK GYRO SUPPORT".The tracker was searched (gyro, motion, six-axis, sensor): no issue or pull request covers it. #699 (a "Custom" gyro aim style) and #1171 (the gyro at rest while the Insert menu is open) are other topics; 699 also edits
host/pad_sdl.c.What changed
The Deck's built-in controls now come out of Steam's ignore list too, so SDL's Steam Deck driver opens them and Motion controls reads their gyroscope and accelerometer. Their buttons and sticks keep coming through Steam Input as the player's layout maps them (motion only beside the stand-in pad).
HOS_DECK_GYRO=0keeps the old behaviour.steam_pads_without_valveinhost/steam_pads.htakes akeep_deckflag and drops0x28de/0x1205without it;pads_startinhost/pad_sdl.csets it fromHOS_DECK_GYRO=0and logs which.docs/development.md(HOS_DECK_GYRO).tests/test_steam_pads.py.Measurements
Verdict: the gyroscope is found on a Steam Deck with this change and not without it; aiming in the game and the trackpads beside Steam Input are not yet checked by hand, so this stays work in progress. Nothing to time: an input change.
Steam Deck OLED, SteamOS 3.9.5, headless over ssh (not Game Mode),
SDL_GAMECONTROLLER_IGNORE_DEVICESand Steam's virtual-gamepad variable set by hand as Steam sets them,HOS_MOTION_DEBUG=1, the Deck standing still in its dock. The change's host code on an older development base (main9c9d69ed;host/pad_sdl.c,host/steam_pads.handhost/hos_sdl.*are the same there as on current main). All three runs loaded SDL3 and exited cleanly.Steam Deck Controllerwith a gyroscope ("taken out of Steam's ignore list", "motion controls from Steam Deck Controller")HOS_DECK_GYRO=0Once in the run the gyroscope's reading stopped changing and the game turned the motion sensors off and on again (its frozen-gyro rule); a Deck that is perfectly still reads exactly 0.000, so this may be the rule meeting a still Deck. To be looked at in the by-hand run.
Before and after every run the kernel log,
/dev/input/by-idand/proc/bus/input/deviceswere the same, and the Deck's own mouse and keyboard devices stayed listed. That does not show whether the trackpads' behaviour inside the controller changed.Flags and settings
One new switch.
HOS_DECK_GYRO=0: kept in)Testing
Tested: the three headless Deck runs above.
python -I -B tests/run_all.pyon Linux: 628 passed, 23 failed, 26 skipped; all 23 fail on main71b1edd8too (test_fsr_uniform_ownership,test_parallel_init_order,test_linux_update,test_make_game_cache,test_audio_output_devices,test_bug_report,test_bug_report_defaults,test_crt_options,test_failed_compile_keeps_objects,test_dlss_feature_size,test_hardware_report,test_guest_imported,test_lift_lookups,test_import_reach,test_linux_preflight,test_missing_nup,test_mods_size_table,test_pending_guest_import,test_replay_write_order,test_run_all_changed,test_nonuniform_image_arrays,test_walk_key,test_vk_occlusion_queries); none reads the changed files.tests/test_steam_pads.pyfails on main and passes here.host/pad_sdl.ccompiles without warnings for Linux and for Windows (llvm-mingw).Not tested: a start from the Steam shortcut in Game Mode; aiming with the gyro in the game; Steam Input's trackpads, back grips and Steam buttons beside SDL's Steam Deck driver, during play and after quitting; a Steam Deck LCD; this head in a full build of current main.
Must be tested:
Risks
What could break: SDL's Steam Deck driver may change the Deck's trackpad settings when it opens the controls; beside Steam Input that could change trackpad clicks during play or after the game exits. Only runs started by Steam on a Deck are affected; other pads and platforms behave as before.
Turning it off:
HOS_DECK_GYRO=0(inlongshot_env.txtor the launch options), or revert the commit.Compatibility: Nothing changes for saves, options, caches or the renderer's interface.
Checklist
Everyone
type(scope): description) of the status line's type.can't be run by hand is in Testing's Not testable by hand, with why. Not ticked yet: Testing's Tested names headless ssh runs with Steam variables set by hand, not a game played; Game Mode and aiming were not run.
in Risks. Not ticked yet: Risks says Steam's trackpad settings could change during play or after quitting, and that was not measured.
main. On main71b1edd8.python -I -B tests/run_all.pypasses (any failure that also fails onmainis named).third_party/untouched (a new folder with aPROVENANCE.mdinstead).When it applies
Assisted-by:/Co-Authored-By:trailers.docs/tested/for each new measured run (format indocs/tested-configurations.md). To be added with the by-hand Game Mode run.mainand passing here.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.
Possibly related, for context:
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).
**Not testable by hand:**line saying why and what stands in for it. Then tick it.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.