Skip to contentSkip to conversation

HID: rmi: print an error if F11 is not found instead of stopping the device

PATCH Applied Andrew Duggan 2 participants 2 messages Aug 6, 2014 – Aug 14, 2014 HID

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 HID: rmi: print an error if F11 is not found instead of stopping the device

Currently rmi_probe will return -EIO if the device doesn't report that it has F11. This would indicate that something happened and the device is in the bootloader. We can recover the device using a userspace firmware update tool, but it needs access to the device through the hidraw device file. If the probe returns -EIO the hidraw device won't be created. So instead of failing the probe, just print an error message, but leave the device accessible from userspace.

---
 drivers/hid/hid-rmi.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/hid/hid-rmi.c +9 -4
index 0dc2514..8389e81 100644
@@ -909,10 +909,15 @@ static int rmi_probe(struct hid_device *hdev, const struct hid_device_id *id)
 		return ret;
 	}
 
-	if (!test_bit(RMI_STARTED, &data->flags)) {
-		hid_hw_stop(hdev);
-		return -EIO;
-	}
+	if (!test_bit(RMI_STARTED, &data->flags))
+		/*
+		 * The device maybe in the bootloader if rmi_input_configured
+		 * failed to find F11 in the PDT. Print an error, but don't
+		 * return an error from rmi_probe so that hidraw will be
+		 * accessible from userspace. That way a userspace tool
+		 * can be used to reload working firmware on the touchpad.
+		 */
+		hid_err(hdev, "Device failed to be properly configured\n");
 
 	return 0;
 }
Signature · 1 line
1.9.1
Applied
#1 lore raw
Quoted 23 lines · Andrew Duggan

Currently rmi_probe will return -EIO if the device doesn't report that it has F11. This would indicate that something happened and the device is in the bootloader. We can recover the device using a userspace firmware update tool, but it needs access to the device through the hidraw device file. If the probe returns -EIO the hidraw device won't be created. So instead of failing the probe, just print an error message, but leave the device accessible from userspace.

---
 drivers/hid/hid-rmi.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/hid/hid-rmi.c +0 -3
index 0dc2514..8389e81 100644
@@ -909,10 +909,15 @@ static int rmi_probe(struct hid_device *hdev, const struct hid_device_id *id)
 		return ret;
 	}
 
-	if (!test_bit(RMI_STARTED, &data->flags)) {
-		hid_hw_stop(hdev);
-		return -EIO;

drivers/hid/hid-rmi.c static int rmi_probe(struct hid_device *hdev, const struct hid_device_id *id) · line 920

Quoted 10 lines
drivers/hid/hid-rmi.c +9 -1
-	}
+	if (!test_bit(RMI_STARTED, &data->flags))
+		/*
+		 * The device maybe in the bootloader if rmi_input_configured
+		 * failed to find F11 in the PDT. Print an error, but don't
+		 * return an error from rmi_probe so that hidraw will be
+		 * accessible from userspace. That way a userspace tool
+		 * can be used to reload working firmware on the touchpad.
+		 */
+		hid_err(hdev, "Device failed to be properly configured\n");

Queued for 3.17 still. Thanks,

Signature · 2 lines
Jiri Kosina
SUSE Labs