Files
DroidDeck/tools
George VineandKurt Himebauch 5dd973587f Fix: Remote Play gets the Steam Deck, Steam Deck Controller, Stream Controller, and touch controls (#2033)
* fix: Remote Play gets the Steam Deck controller

Steam's Remote Play client reads the controller itself from its own
streaming_client process. The input preload only exposed the virtual
Deck controller (and the DualShock 4 / DualSense pads that share its
code) to the process named steam, so in Steam Deck controller mode
streaming_client was refused /dev/hidraw16 and the stream got no input:

  streaming_clien: deck: /dev/hidraw16 refused: not the Steam client

streaming_client now sees the same Deck, DualShock 4 and DualSense pads
as Steam. Each opener gets its own report stream from the read-only
ring, so the two processes do not compete for input. The Steam
Controller paths stay Steam-only: the paired controller's feature and
output slot is serialised only within one process.

Fixes #1860

* fix: Remote Play also gets the Steam Controller and touch controls

streaming_client now opens the Steam Controller pads (the app's
emulated one and a paired controller) and Steam's touch controller,
like the Steam Deck pad.

A paired controller's feature request and output slots, and the touch
controller's state, are shared with the app and written under a
seqlock that expects one writer. Their writers now also take a flock
on a lock file in the hook directory, so Steam and streaming_client
take turns. touch_state() was a template holding its own static mutex,
so each caller had a separate one; it now shares a single mutex.

The pad type and touch plug watchers run in streaming_client too, so
it gets the udev events for mode switches and replugs; those only reach
the process that injects them. Poking /dev watchers and moving event0
on the shared filesystem stay with Steam, so they happen once.

* fix: the shared slot lock fails safe and never waits forever

If the lock file cannot be opened or locked, ProcessSlotLock used to
carry on unlocked. Steam alone is still a single writer then, exactly
as before streaming_client could open these devices, so it carries on;
streaming_client now leaves the paired controller's feature and output
slots and the touch state alone instead (feature reads fail with EIO).
The first failure is logged.

The wait for the lock is now bounded: a session freeze can stop the
process holding it, and writers wait with controller_mutex held, so an
unbounded flock could stall all input in the other process. Feature
reads wait up to their 500 ms reply timeout, outputs 100 ms and touch
state 20 ms. When the deadline passes the lock is held by the other
process, so neither proceeds; the operation is skipped and logged.

* fix: Steam no longer turns motion off under its Remote Play client

Steam and streaming_client both set the Deck pad's IMU mode, and both
wrote the one word Android reads to decide whether to feed the gyro.
Steam keeps toggling its own mode during a stream, so it could switch
motion off while the Remote Play layout needed it, and the client never
re-sent an unchanged mode.

Each process now has its own word. Android reads motion while either
wants it, and ignores the Remote Play word once that process is gone.

* fix: Remote Play decides motion while Steam has set no mode

Until Steam published its IMU mode, Android reported the mode as unknown
without reading the Remote Play client's word, so a Remote Play request
to stop motion had no effect. The word that has been set now decides,
and the mode stays unknown only while neither process has set one.

The rule moves into ImuModes so it can be tested on the JVM.

---------

Co-authored-by: Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com>
2026-11-15 09:55:25 -05:00
..