From f12d03e32d581f9575dbddbf3f29976d0918b882 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Wed, 7 Aug 2013 22:32:41 +0200 Subject: hidpp: assume HID++ 1.0 for unreachable devices 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 --- 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 78216ca..8e7e692 100644 --- a/src/linux/hidpp-device.c +++ b/src/linux/hidpp-device.c @@ -603,7 +603,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); -- cgit v1.2.1