[PATCH 8/9] hidpp: assume HID++ 1.0 for unreachable devices
Peter Wu
lekensteyn at gmail.com
Wed Aug 7 15:13:43 PDT 2013
When the USB receiver is just plugged in, devices may not be active
("unreachable") and therefore return RESOURCE_ERROR on requests. This
causes upower to fail on picking up new devices. As a workaround, assume
that all discovered devices will eventually become reachable (even if
they don't, for example if the device was paired to another computer
while the computer carrying the receiver was powered off).
Actual removal of unpaired devices is done by the Logitech HID driver,
that should remove sysfs entries which can be detected by upower.
Signed-off-by: Peter Wu <lekensteyn at gmail.com>
---
src/linux/hidpp-device.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/linux/hidpp-device.c b/src/linux/hidpp-device.c
index 1eff154..796e995 100644
--- a/src/linux/hidpp-device.c
+++ b/src/linux/hidpp-device.c
@@ -599,7 +599,11 @@ hidpp_device_refresh (HidppDevice *device,
error);
if (!ret) {
if (hidpp_is_error(&msg, &error_code) &&
- (error_code == HIDPP10_ERROR_CODE_INVALID_SUBID)) {
+ (error_code == HIDPP10_ERROR_CODE_INVALID_SUBID ||
+ /* if a device is unreachable, assume HID++ 1.0.
+ * Otherwise, the device won't show up at
+ * enumeration time. */
+ error_code == HIDPP10_ERROR_CODE_RESOURCE_ERROR)) {
/* assume HID++ 1.0 ping response */
priv->version = 1;
g_error_free(*error);
--
1.8.3.4
More information about the devkit-devel
mailing list