diff --git a/lib/logitech/unifying_receiver/hidpp10.py b/lib/logitech/unifying_receiver/hidpp10.py index 5dc99c62..1dfcf82a 100644 --- a/lib/logitech/unifying_receiver/hidpp10.py +++ b/lib/logitech/unifying_receiver/hidpp10.py @@ -177,6 +177,11 @@ def get_firmware(device): def get_notification_flags(device): + if device.kind: + p = device.protocol + if p is None or p >= 2.0: + return + flags = device.request(0x8100) if flags is not None: assert len(flags) == 3 @@ -184,6 +189,11 @@ def get_notification_flags(device): def set_notification_flags(device, *flag_bits): + if device.kind: + p = device.protocol + if p is None or p >= 2.0: + return + flag_bits = sum(int(b) for b in flag_bits) result = device.request(0x8000, 0xFF & (flag_bits >> 16), 0xFF & (flag_bits >> 8), 0xFF & flag_bits) return result is not None diff --git a/lib/logitech/unifying_receiver/hidpp20.py b/lib/logitech/unifying_receiver/hidpp20.py index fa487dc4..c4c03392 100644 --- a/lib/logitech/unifying_receiver/hidpp20.py +++ b/lib/logitech/unifying_receiver/hidpp20.py @@ -40,7 +40,7 @@ FEATURE = _NamedInts( ROOT=0x0000, FEATURE_SET=0x0001, FEATURE_INFO=0x0002, - DEVICE_FW_VERSION=0x0003, + DEVICE_FW_VERSION=0x0003, DEVICE_NAME=0x0005, DEVICE_GROUPS=0x0006, DFUCONTROL=0x00C0, @@ -129,7 +129,7 @@ class FeatureCallError(_KwException): class FeaturesArray(object): """A sequence of features supported by a HID++ 2.0 device.""" __slots__ = ('supported', 'device', 'features') - assert int(FEATURE.ROOT) == 0x0000 + assert FEATURE.ROOT == 0x0000 def __init__(self, device): assert device is not None diff --git a/lib/logitech/unifying_receiver/receiver.py b/lib/logitech/unifying_receiver/receiver.py index f2fbb23c..444fc157 100644 --- a/lib/logitech/unifying_receiver/receiver.py +++ b/lib/logitech/unifying_receiver/receiver.py @@ -167,7 +167,7 @@ class PairedDevice(object): def enable_notifications(self, enable=True): """Enable or disable device (dis)connection notifications on this receiver.""" - if not self.receiver or not self.receiver.handle: + if not self.receiver or not self.receiver.handle or self.protocol >= 2.0: return False if enable: