Skip to content

Commit e48fc2e

Browse files
fix(steam-deck): use native USB hidraw path on Linux
1 parent 741b708 commit e48fc2e

4 files changed

Lines changed: 11 additions & 16 deletions

File tree

docs/platform-support.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,15 @@ provides it separately on the UHID event.
150150

151151
Steam Deck retains Valve's native identity and emits the 64-byte Deck state
152152
packet periodically so SDL's direct HIDAPI path can initialize before the first
153-
client input arrives. Its UHID endpoint uses the Bluetooth HID transport tag:
154-
this remains visible to HIDAPI while avoiding the USB-only `hid-steam` match
155-
that otherwise suppresses the virtual endpoint's reports when a direct HID
156-
client opens it. The Generic Desktop/Game Pad descriptor remains available as
157-
an evdev fallback. The backend answers the unit-serial feature query used during
158-
Linux registration, accepts the desktop-mapping/settings commands used by SDL,
159-
and forwards native `0xEB` rumble requests through the portable output callback.
160-
Each submitted native packet carries an advancing sequence number.
153+
client input arrives. Its UHID endpoint keeps Valve's USB transport identity so
154+
Linux `hid-steam` can expose the dedicated hidraw client expected by SDL. When
155+
that client opens, `hid-steam` hands the native report stream to userspace; the
156+
Generic Desktop/Game Pad descriptor remains available as an evdev fallback when
157+
no direct HID client owns it. The backend answers the unit-serial feature query
158+
used during Linux registration, accepts the desktop-mapping/settings commands
159+
used by SDL, and forwards native `0xEB` rumble requests through the portable
160+
output callback. Each submitted native packet carries an advancing sequence
161+
number.
161162

162163
The backend opens `/dev/uhid` in nonblocking mode, matching the original
163164
asynchronous gamepad registration path. Its event reader is active before

src/platform/linux/uhid_backend.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -324,12 +324,6 @@ namespace lvh::detail {
324324
// virtual endpoint.
325325
return BUS_VIRTUAL;
326326
}
327-
if (profile.gamepad_kind == GamepadProfileKind::steam_deck) {
328-
// hid-steam matches the Deck's USB identity and suppresses its input
329-
// while a hidraw client is open. BUS_VIRTUAL avoids that driver but is
330-
// filtered out by hidapi, so use its other supported HID transport.
331-
return BUS_BLUETOOTH;
332-
}
333327
return to_uhid_bus(profile.bus_type);
334328
}
335329

tests/fixtures/linux_backend_test_hooks.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1695,7 +1695,7 @@ namespace lvh::detail::test {
16951695
options.metadata.stable_id = "linux-steam-deck";
16961696

16971697
UhidGamepad gamepad {descriptors[0]};
1698-
auto event = create_started_profile_uhid_gamepad(gamepad, 11, options, descriptors[1], BUS_BLUETOOTH, result);
1698+
auto event = create_started_profile_uhid_gamepad(gamepad, 11, options, descriptors[1], BUS_USB, result);
16991699
gamepad.set_output_callback([&result](const GamepadOutput &output) {
17001700
if (output.kind == GamepadOutputKind::rumble) {
17011701
++result.output.callback_count;

tests/unit/test_linux_backend.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ TEST_F(LinuxBackendTest, TranslatesMouseButtonsAndBusTypes) {
124124
EXPECT_EQ(lvh::detail::test::linux_uhid_bus(lvh::BusType::bluetooth), BUS_BLUETOOTH);
125125
EXPECT_EQ(lvh::detail::test::linux_gamepad_uhid_bus(lvh::GamepadProfileKind::xbox_series), BUS_USB);
126126
EXPECT_EQ(lvh::detail::test::linux_gamepad_uhid_bus(lvh::GamepadProfileKind::switch_pro), BUS_VIRTUAL);
127-
EXPECT_EQ(lvh::detail::test::linux_gamepad_uhid_bus(lvh::GamepadProfileKind::steam_deck), BUS_BLUETOOTH);
127+
EXPECT_EQ(lvh::detail::test::linux_gamepad_uhid_bus(lvh::GamepadProfileKind::steam_deck), BUS_USB);
128128
EXPECT_EQ(lvh::detail::test::linux_uinput_bus(lvh::BusType::bluetooth), BUS_BLUETOOTH);
129129

130130
EXPECT_EQ(lvh::detail::test::linux_pen_tool(lvh::PenToolType::pen), BTN_TOOL_PEN);

0 commit comments

Comments
 (0)