From 1d9a3bf23a782f52bae375f74442eeb8f4bd4a68 Mon Sep 17 00:00:00 2001 From: Daniel Pavel Date: Thu, 20 Jun 2013 17:21:23 +0200 Subject: [PATCH] fixed checking for features of offline 2.0 devices --- lib/logitech/unifying_receiver/descriptors.py | 2 +- lib/logitech/unifying_receiver/hidpp20.py | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/logitech/unifying_receiver/descriptors.py b/lib/logitech/unifying_receiver/descriptors.py index 8b797566..84c012d7 100644 --- a/lib/logitech/unifying_receiver/descriptors.py +++ b/lib/logitech/unifying_receiver/descriptors.py @@ -47,7 +47,7 @@ def _feature_fn_swap(): def check_features(device, already_known): - if device.protocol < 2.0: + if device.protocol is not None and device.protocol < 2.0: return if not any(s.name == _FN_SWAP[0] for s in already_known) and _hidpp20.FEATURE.FN_INVERSION in device.features: already_known.append(_feature_fn_swap()) diff --git a/lib/logitech/unifying_receiver/hidpp20.py b/lib/logitech/unifying_receiver/hidpp20.py index 70c37cf2..b7b428ef 100644 --- a/lib/logitech/unifying_receiver/hidpp20.py +++ b/lib/logitech/unifying_receiver/hidpp20.py @@ -141,19 +141,18 @@ class FeaturesArray(object): self.supported = False def _check(self): - # print (self.device, "check") + # print (self.device, "check", self.supported, self.features, self.device.protocol) if self.supported: assert self.device if self.features is not None: return True - protocol = self.device.protocol - if protocol == 0: + if hasattr(self.device, 'status') and not bool(self.device.status): # device is not connected right now, will have to try later return False # I _think_ this is universally true - if protocol < 2.0: + if self.device.protocol < 2.0: self.supported = False # self.device.features = None self.device = None