summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Wu <lekensteyn@gmail.com>2013-08-07 22:32:41 +0200
committerPeter Wu <lekensteyn@gmail.com>2013-08-22 22:59:27 +0200
commitf12d03e32d581f9575dbddbf3f29976d0918b882 (patch)
tree0a0ada77d00fd9575170484a2708729c72401afa
parentc3b9d0121dbd9030533382bdb914434d7bb28c16 (diff)
downloadupower-f12d03e32d581f9575dbddbf3f29976d0918b882.tar.gz
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 <lekensteyn@gmail.com>
-rw-r--r--src/linux/hidpp-device.c6
1 files changed, 5 insertions, 1 deletions
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);