HID: steam: Fix input device disappearing
diff mbox series

Message ID 20200107194813.162038-1-rodrigorivascosta@gmail.com
State Mainlined
Commit 20eee6e5af35d9586774e80b6e0b1850e7cc9899
Delegated to: Jiri Kosina
Headers show
Series
  • HID: steam: Fix input device disappearing
Related show

Commit Message

Rodrigo Rivas Costa Jan. 7, 2020, 7:48 p.m. UTC
The `connected` value for wired devices was not properly initialized,
it must be set to `true` upon creation, because wired devices do not
generate connection events.

When a raw client (the Steam Client) uses the device, the input device
is destroyed. Then, when the raw client finishes, it must be recreated.
But since the `connected` variable was false this never happended.

Signed-off-by: Rodrigo Rivas Costa <rodrigorivascosta@gmail.com>
---
 drivers/hid/hid-steam.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Jiri Kosina Jan. 9, 2020, 9:58 a.m. UTC | #1
On Tue, 7 Jan 2020, Rodrigo Rivas Costa wrote:

> The `connected` value for wired devices was not properly initialized,
> it must be set to `true` upon creation, because wired devices do not
> generate connection events.
> 
> When a raw client (the Steam Client) uses the device, the input device
> is destroyed. Then, when the raw client finishes, it must be recreated.
> But since the `connected` variable was false this never happended.
> 
> Signed-off-by: Rodrigo Rivas Costa <rodrigorivascosta@gmail.com>

Applied, thanks.

Patch
diff mbox series

diff --git a/drivers/hid/hid-steam.c b/drivers/hid/hid-steam.c
index 8dae0f9b819e..6286204d4c56 100644
--- a/drivers/hid/hid-steam.c
+++ b/drivers/hid/hid-steam.c
@@ -768,8 +768,12 @@  static int steam_probe(struct hid_device *hdev,
 
 	if (steam->quirks & STEAM_QUIRK_WIRELESS) {
 		hid_info(hdev, "Steam wireless receiver connected");
+		/* If using a wireless adaptor ask for connection status */
+		steam->connected = false;
 		steam_request_conn_status(steam);
 	} else {
+		/* A wired connection is always present */
+		steam->connected = true;
 		ret = steam_register(steam);
 		if (ret) {
 			hid_err(hdev,