Skip to content

fix: stream client's controller input no longer wakes the TV - #18

Merged
moyoseph merged 1 commit into
mainfrom
fix/stream-input-wakes-tv
Oct 5, 2026
Merged

moyoseph merged 1 commit into
mainfrom
fix/stream-input-wakes-tv

Conversation

@moyoseph

@moyoseph moyoseph commented Oct 5, 2026

Copy link
Copy Markdown
Owner

Problem

While streaming (Punktfunk), pressing a button on the client's controller powered the TV on, as if the controller were plugged into the box.

Streaming hosts inject the remote client's gamepad as a virtual device. Punktfunk emulates it as a Valve Steam Deck / Steam Controller 2 over UHID or usbip, carrying the same 28DE vendor ID as a real Steam Controller. The hidraw monitor matched it as the couch controller and, with steam_controller.wake (default on), woke the TV mid-stream. Its evdev events also counted as key presses. Nothing told the daemon a stream was running either: detection only covered Sunshine's log.

Fix

  • inputdev.is_synthetic() classifies a node by its sysfs origin: /sys/devices/virtual/… (uinput, UHID) or vhci_hcd (usbip) means injected.
  • HidrawMonitor skips virtual Valve nodes entirely.
  • InputMonitor tags virtual evdev nodes. The agent reports their input as activity with key: false, and the daemon's own WakeOnInput ignores them.
  • The daemon suspends wake-on-input while streams.streaming is set.
  • lgtvc setup hidraw-scan marks virtual pads.
  • docs/external-api.md documents Punktfunk session.started / session.ended hooks; CHANGELOG updated.

Verification

  • ruff + mypy clean; full suite green (549 passed). New tests cover the sysfs classification (physical / uinput / UHID / vhci), hidraw skip, agent key→activity-only, WakeOnInput filter, the no-wake-while-streaming gate, and the hidraw-scan marking.
  • Ran the classifier read-only on a real Bazzite box: K400 keyboard and the SC2 puck hidraw nodes stay physical; only steamos-manager's uinput device is flagged virtual.

🤖 Generated with Claude Code

Streaming hosts inject the remote client's gamepad as a virtual device.
Punktfunk emulates it as a Valve Steam Deck / Steam Controller 2 over UHID
or usbip, so the hidraw monitor (matching vendor 28DE) took it for the
couch controller and, with steam_controller.wake, powered the TV on
mid-stream; its evdev events also counted as key presses.

Classify nodes by sysfs origin (/sys/devices/virtual/... or vhci_hcd =
injected): virtual Valve hidraw nodes are skipped, virtual evdev input is
activity but never a wake (agent + daemon WakeOnInput). The daemon also
suspends wake-on-input while a remote stream is connected. hidraw-scan
marks virtual pads; docs add Punktfunk session hooks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@moyoseph
moyoseph merged commit 44bffeb into main Oct 5, 2026
14 of 18 checks passed
@moyoseph
moyoseph deleted the fix/stream-input-wakes-tv branch October 5, 2026 22:23
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