Controller gyro under Steam Input: follow-ups from #3045 (a swap on a reused hidraw node while Motion is off, Deck OLED and Windows runs) #3276
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/mods
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
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot#3276
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Follow-ups left open when #3045 (controller gyro under Steam Input,
build_core::hid_imu) merged as4d3b41c5. From BeanBot's reviews and the PR's Still to test.1. A controller swapped onto the same hidraw node while Motion controls is off keeps the old one's learned bias (BeanBot's L2, should fix)
The game keeps each controller's learned gyroscope bias by the builder's device id (
host/pad_sdl.c,motion_hid_bias). That id ishid_imu::device_id(path, plugged): the node's path hashed with the count of devices the node has had. The reader drops a node's count when a read says the device is gone, or when a look at the system's nodes no longer finds it. While Motion controls is off the reader is stopped and doesn't look, so this case slips through:/dev/hidrawN.The same window exists, much narrower, while the reader runs but a node isn't watched (a swap between two of its 2 s looks).
Idea: mix the device's own identity into the id where the system gives one. On Linux the hidraw node's
ueventhasHID_UNIQ(a Bluetooth controller's address; a USB serial where the device has one), read besideHID_IDinSys::nodes(hid_imu::hid_id's neighbour). Hash it intodevice_idwith the path and the count, so a different controller on a reused node gets another id, while one that stays connected keeps its id across Motion off and on. Two controllers that both report an emptyHID_UNIQwould still share an id. On Windows a node's path holds the device instance id, so a replacement there gets another path in most cases, but a serial-less USB device on the same port can come back with the same one.Test: a fake node whose
uniqchanges between astop()and the next poll gets another device id; one that keeps itsuniqkeeps its id (hid_imu/tests.rs, besideanother_controller_on_a_node_reused_is_another_device).2. Testing not done before the merge
mainbefore #3045. The Test Farm request on #3045 (@Beanstalk steamdeck) was never approved.pads: motion:lines inlongshot_log.txt: which controller, and whether it "is a pad SDL reads too" or "is no pad SDL opened". On Windows the reader's node paths (cfgmgr32) and SDL's (hidapi) differ in case, andhid_imu::node_idfolds it; this run would confirm they match for one Steam Controller.HOS_SANDBOX=1and a DualSense under Steam Input (PlayStation controller support on): the confined game's controllers may come under Steam's Desktop Layout, as onmain. Run so far only with PlayStation support off (the DualSense through SDL: gamepad, gyro aiming, the PS button opening Longshot's menu).Related, tracked elsewhere
Possibly related, for context:
Automated triage by BeanBot (gpt-6-luna). Nothing was run; a maintainer decides.