Behaviour-preserving cleanup, to do after the raw-HID lightbar fix has soaked in real use. Follow-up to the shipped fix (38a1fc3, 2f128e6; see docs/decisions/steam-coexistence.md).
Why
The lightbar is now driven by a raw HID colour report (controller-led lightbar-raw) that clears the DualSense firmware "light out" latch directly. Several pieces in controller-manager.py exist only for the old, now-disproven assumption that a driver rebind was the only way to clear that latch. With the raw path they are dead weight:
ControllerInstance.apply_mode adoption rearm (the if adopt and not target and hidraw_holders(...) block that forces hidraw_gate("rearm", …)): its sole job was to rebind a freshly-paired, Steam-held pad to clear the latch. The raw _apply_led at the end of apply_mode now clears it — and in native mode we do not want to revoke Steam's fd anyway. Removing it also drops a driver rebind + node renumber from every first adoption (faster, less churn).
_latch_risk + the rearm branch in watch_holders (fires when a raw fd closed): the "rebind → fresh lightbar setup" rationale is gone. Keep only what is still needed for fd revocation / security, if anything — confirm the gate's restore/block paths already cover revocation without this.
Keep (unrelated to the latch): _repaint_at delayed re-assert (Steam re-stomps with its own colour, not just the latch), _assert_at backstop, refresh_led renumber detection, player-LED re-assert, the whole hidraw gate (security).
Order of work — do NOT skip step 1
Step 1 — harden tests FIRST (lock in behaviour, then refactor against it)
A refactor may only claim "behaviour-preserving" if tests pin the behaviour before the code moves.
Run bash scripts/validate-repo.sh green before touching daemon code.
Step 2 — remove the dead latch machinery (only after step 1 is green + fix soaked)
Acceptance
validate-repo.sh green; all tests/ pass.
- Live: native (blue) + xbox (green), both pads, mode switches, Steam running — no regression vs. the shipped fix; adoption at least as fast.
- Diff removes complexity without changing observable behaviour (bar the possibly shorter native-switch latency).
Behaviour-preserving cleanup, to do after the raw-HID lightbar fix has soaked in real use. Follow-up to the shipped fix (
38a1fc3,2f128e6; seedocs/decisions/steam-coexistence.md).Why
The lightbar is now driven by a raw HID colour report (
controller-led lightbar-raw) that clears the DualSense firmware "light out" latch directly. Several pieces incontroller-manager.pyexist only for the old, now-disproven assumption that a driver rebind was the only way to clear that latch. With the raw path they are dead weight:ControllerInstance.apply_modeadoption rearm (theif adopt and not target and hidraw_holders(...)block that forceshidraw_gate("rearm", …)): its sole job was to rebind a freshly-paired, Steam-held pad to clear the latch. The raw_apply_ledat the end ofapply_modenow clears it — and in native mode we do not want to revoke Steam's fd anyway. Removing it also drops a driver rebind + node renumber from every first adoption (faster, less churn)._latch_risk+ therearmbranch inwatch_holders(fires when a raw fd closed): the "rebind → fresh lightbar setup" rationale is gone. Keep only what is still needed for fd revocation / security, if anything — confirm the gate'srestore/blockpaths already cover revocation without this.Keep (unrelated to the latch):
_repaint_atdelayed re-assert (Steam re-stomps with its own colour, not just the latch),_assert_atbackstop,refresh_ledrenumber detection, player-LED re-assert, the whole hidraw gate (security).Order of work — do NOT skip step 1
Step 1 — harden tests FIRST (lock in behaviour, then refactor against it)
A refactor may only claim "behaviour-preserving" if tests pin the behaviour before the code moves.
test_lightbar_latch.py): assert the resting colour is written when a native pad is adopted while Steam holds it — asserted on the colour reachingled_set_rawwith the pad's hidraw, independent of whether a rearm happened. (Today Scenario A couples the two; decouple them.)rearm(onlyrestore). Add as pending/xfail now, flip when the code changes.test_reconcile.pyScenario F to assert the hidraw target._repaint_at) — guard against deleting it with the latch code (test_steam_ownership.py).test_multi_pad.py). Covers the two-firmware finding at the daemon level.Run
bash scripts/validate-repo.shgreen before touching daemon code.Step 2 — remove the dead latch machinery (only after step 1 is green + fix soaked)
apply_mode(confirm colour-on-adoption test still passes; confirm native-mode Steam fd is intentionally not revoked)._latch_riskand thewatch_holdersrearm branch, preserving any still-needed fd revocation via the existing gate paths._repaint_at/_assert_atonly if the soak shows the native-mode "few seconds until blue" is worth shortening (with the adoption rearm gone there may be no rebind to race).Acceptance
validate-repo.shgreen; alltests/pass.