Skip to content

Don't restart a controller that was already hidden for its session - #119

Open
mlopezsegura wants to merge 1 commit into
masterfrom
fix/gamepad-skip-restart-when-jailed
Open

mlopezsegura wants to merge 1 commit into
masterfrom
fix/gamepad-skip-restart-when-jailed

Conversation

@mlopezsegura

Copy link
Copy Markdown
Collaborator

Related to #11 (wired Elite 2 dropping after about a minute).

When a physical controller appeared while another session was running, HidePhysical restarted it, so that session couldn't keep a handle it opened in the first instant. But a known controller's HidHide jail stays in place while it's unplugged, asleep or re-enumerating (JailAbsent, and the jail isn't removed when the node goes away). So when it reappears for the same session, nobody else could have opened it, and the restart only shakes a controller that is still starting.

In the reporter's bundle, the Elite 2's 045E:02FF part re-enumerated about once a minute while a stream session was running, and successful restarts weren't logged, so OpenStreamMS couldn't be ruled out.

  • Remember which session each physical node was jailed for (_jailedFor), and skip the restart when it reappears for the same one.
  • A controller seen for the first time since the service started, or one moving to another session, is restarted as before.
  • Log every restart, including the ones that succeed, and say when Windows postpones one.

Tests: full suite (210) passes; this path needs real devices and HidHide, so it has no unit test. Not tried with a GIP controller (none on this PC).

🤖 Generated with Claude Code

…session

When a physical controller appeared while another session was running,
OpenStreamMS restarted it so that session couldn't keep a handle it opened
before the controller was hidden. But a known controller's HidHide jail
stays in place while it's unplugged, asleep or re-enumerating, so when it
comes back for the same session nobody else could have opened it, and the
restart only shook a controller that was still starting. With a wired
Elite 2, part of it came and went about once a minute (#11).

Remember which session each physical node was jailed for, skip that restart
when it reappears for the same one, and log every controller restart,
including the ones that succeed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant