Skip to contentSkip to conversation

HID: hid-steam: Fix issues with disabling both gamepad mode and lizard mode

PATCH Applied Vicki Pfau 2 participants 2 messages Jan 16, 2025 – Feb 3, 2025

Subsystems (2)
lore
Share & tools
lore

Vicki Pfau

author maintainer
#0 lore raw

PATCH 1/1 HID: hid-steam: Fix issues with disabling both gamepad mode and lizard mode

When lizard mode is disabled, there were two issues:

1. Switching between gamepad mode and desktop mode still functioned, even though desktop mode did not. This lead to the ability to "break" gamepad mode by holding down the Options key even while lizard mode is disabled

2. If you were in desktop mode when lizard mode is disabled, you would immediately enter this faulty mode.

This patch properly disables the ability to switch between gamepad mode and the faulty desktop mode by holding the Options key, as well as effectively removing the faulty mode by bypassing the early returns if lizard mode is disabled.

---
 drivers/hid/hid-steam.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/hid/hid-steam.c +3 -3
index af38fc8eb34f..b008fd0834b9 100644
@@ -1050,10 +1050,10 @@ static void steam_mode_switch_cb(struct work_struct *work)
 							struct steam_device, mode_switch);
 	unsigned long flags;
 	bool client_opened;
-	steam->gamepad_mode = !steam->gamepad_mode;
 	if (!lizard_mode)
 		return;
 
+	steam->gamepad_mode = !steam->gamepad_mode;
 	if (steam->gamepad_mode)
 		steam_set_lizard_mode(steam, false);
 	else {
@@ -1599,7 +1599,7 @@ static void steam_do_deck_input_event(struct steam_device *steam,
 		schedule_delayed_work(&steam->mode_switch, 45 * HZ / 100);
 	}
 
-	if (!steam->gamepad_mode)
+	if (!steam->gamepad_mode && lizard_mode)
 		return;
 
 	lpad_touched = b10 & BIT(3);
@@ -1669,7 +1669,7 @@ static void steam_do_deck_sensors_event(struct steam_device *steam,
 	 */
 	steam->sensor_timestamp_us += 4000;
 
-	if (!steam->gamepad_mode)
+	if (!steam->gamepad_mode && lizard_mode)
 		return;
 
 	input_event(sensors, EV_MSC, MSC_TIMESTAMP, steam->sensor_timestamp_us);
Signature · 1 line
2.47.1
maintainer Applied
#1 lore raw
Quoted 13 lines · Vicki Pfau

When lizard mode is disabled, there were two issues:

1. Switching between gamepad mode and desktop mode still functioned, even though desktop mode did not. This lead to the ability to "break" gamepad mode by holding down the Options key even while lizard mode is disabled

2. If you were in desktop mode when lizard mode is disabled, you would immediately enter this faulty mode.

This patch properly disables the ability to switch between gamepad mode and the faulty desktop mode by holding the Options key, as well as effectively removing the faulty mode by bypassing the early returns if lizard mode is disabled.

Quoted 5 lines
---
 drivers/hid/hid-steam.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Applied, thanks.

Signature · 2 lines
Jiri Kosina
SUSE Labs