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

Open
opened 2026-12-05 19:46:31 +00:00 by sandymac · 1 comment
Contributor

Follow-ups left open when #3045 (controller gyro under Steam Input, build_core::hid_imu) merged as 4d3b41c5. 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 is hid_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:

  1. Linux, Motion controls on, controller A read through its hidraw node; its bias learned.
  2. Motion controls off.
  3. Unplug A, connect controller B, which gets the same /dev/hidrawN.
  4. Motion controls on: B gets A's device id, and the game restores A's bias for it until the filter learns B's (a short drift).

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 uevent has HID_UNIQ (a Bluetooth controller's address; a USB serial where the device has one), read beside HID_ID in Sys::nodes (hid_imu::hid_id's neighbour). Hash it into device_id with 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 empty HID_UNIQ would 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 uniq changes between a stop() and the next poll gets another device id; one that keeps its uniq keeps its id (hid_imu/tests.rs, beside another_controller_on_a_node_reused_is_another_device).

2. Testing not done before the merge

  • Steam Deck OLED, its own gyro (BeanBot's L5): the reader changed the built-in controls' path, but only a Deck LCD was played. Motion controls on, aim with the built-in gyro, as on main before #3045. The Test Farm request on #3045 (@Beanstalk steamdeck) was never approved.
  • Windows, the node matching in game (after BeanBot's L1 fix): Steam Input on, a Steam Controller (2026) and a DualSense:
    1. Aim with the Steam Controller's gyro, pressing its grips and clicking its trackpads while aiming: the aim must not jump, stop or switch controllers.
    2. Pick up the DualSense and aim, then go back to the Steam Controller: motion follows the one in use.
    3. Note the pads: motion: lines in longshot_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, and hid_imu::node_id folds it; this run would confirm they match for one Steam Controller.
  • Windows with HOS_SANDBOX=1 and a DualSense under Steam Input (PlayStation controller support on): the confined game's controllers may come under Steam's Desktop Layout, as on main. Run so far only with PlayStation support off (the DualSense through SDL: gamepad, gyro aiming, the PS button opening Longshot's menu).
  • #3181: HD grip haptics for the Steam Controller (2026) under Steam Input, following Steam's rumble strength (iafx, raised on #3045).
  • #3150: button prompts on Auto follow the controller in use.
Follow-ups left open when #3045 (controller gyro under Steam Input, `build_core::hid_imu`) merged as 4d3b41c5. 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 is `hid_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: 1. Linux, Motion controls on, controller A read through its hidraw node; its bias learned. 2. Motion controls off. 3. Unplug A, connect controller B, which gets the same `/dev/hidrawN`. 4. Motion controls on: B gets A's device id, and the game restores A's bias for it until the filter learns B's (a short drift). 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 `uevent` has `HID_UNIQ` (a Bluetooth controller's address; a USB serial where the device has one), read beside `HID_ID` in `Sys::nodes` (`hid_imu::hid_id`'s neighbour). Hash it into `device_id` with 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 empty `HID_UNIQ` would 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 `uniq` changes between a `stop()` and the next poll gets another device id; one that keeps its `uniq` keeps its id (`hid_imu/tests.rs`, beside `another_controller_on_a_node_reused_is_another_device`). ## 2. Testing not done before the merge - **Steam Deck OLED, its own gyro** (BeanBot's L5): the reader changed the built-in controls' path, but only a Deck LCD was played. Motion controls on, aim with the built-in gyro, as on `main` before #3045. The Test Farm request on #3045 (`@Beanstalk steamdeck`) was never approved. - **Windows, the node matching in game** (after BeanBot's L1 fix): Steam Input on, a Steam Controller (2026) and a DualSense: 1. Aim with the Steam Controller's gyro, pressing its grips and clicking its trackpads while aiming: the aim must not jump, stop or switch controllers. 2. Pick up the DualSense and aim, then go back to the Steam Controller: motion follows the one in use. 3. Note the `pads: motion:` lines in `longshot_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, and `hid_imu::node_id` folds it; this run would confirm they match for one Steam Controller. - **Windows with `HOS_SANDBOX=1` and a DualSense under Steam Input** (PlayStation controller support on): the confined game's controllers may come under Steam's Desktop Layout, as on `main`. 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 - #3181: HD grip haptics for the Steam Controller (2026) under Steam Input, following Steam's rumble strength (iafx, raised on #3045). - #3150: button prompts on Auto follow the controller in use.
Member

Possibly related, for context:

  • PR #3045 feat(input): controller gyro under Steam Input (Steam Controller, DualSense, Deck; Linux and Windows) — Merged controller gyro implementation referenced by this follow-up.
  • issue #1563 Game: Steam Input causes incorrect controller and camera behavior — Related Steam Input controller behavior, but not the same reported issue.

Automated triage by BeanBot (gpt-6-luna). Nothing was run; a maintainer decides.

Possibly related, for context: - PR #3045 feat(input): controller gyro under Steam Input (Steam Controller, DualSense, Deck; Linux and Windows) — Merged controller gyro implementation referenced by this follow-up. - issue #1563 Game: Steam Input causes incorrect controller and camera behavior — Related Steam Input controller behavior, but not the same reported issue. --- <sub>Automated triage by BeanBot (gpt-6-luna). Nothing was run; a maintainer decides.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
2 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#3276
No description provided.