From cd437c380951df4375a0a303236e79cfca640b5f Mon Sep 17 00:00:00 2001 From: Daniel Pavel Date: Thu, 4 Jul 2013 13:22:35 +0200 Subject: [PATCH] only set NOTIFICATION_FLAGS for 1.0 devices --- lib/logitech/unifying_receiver/status.py | 3 ++- lib/solaar/cli.py | 4 +++- lib/solaar/ui/window.py | 4 +++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/logitech/unifying_receiver/status.py b/lib/logitech/unifying_receiver/status.py index 9f1ab3ee..cee0ace3 100644 --- a/lib/logitech/unifying_receiver/status.py +++ b/lib/logitech/unifying_receiver/status.py @@ -229,7 +229,8 @@ class DeviceStatus(dict): # Make sure to set notification flags on the device, they # get cleared when the device is turned off (but not when the device # goes idle, and we can't tell the difference right now). - self[KEYS.NOTIFICATION_FLAGS] = d.enable_notifications() + if d.protocol < 2.0: + self[KEYS.NOTIFICATION_FLAGS] = d.enable_notifications() # Devices lose configuration when they are turned off, # make sure they're up-to-date. diff --git a/lib/solaar/cli.py b/lib/solaar/cli.py index a3177695..77c9f5b2 100644 --- a/lib/solaar/cli.py +++ b/lib/solaar/cli.py @@ -136,7 +136,9 @@ def _print_device(dev, verbose=False): if dev.online: notification_flags = hidpp10.get_notification_flags(dev) - if notification_flags is not None: + if notification_flags is None: + print (" Notifications: N/A.") + else: if notification_flags: notification_names = hidpp10.NOTIFICATION_FLAG.flag_names(notification_flags) print (" Notifications: 0x%06X = %s." % (notification_flags, ', '.join(notification_names))) diff --git a/lib/solaar/ui/window.py b/lib/solaar/ui/window.py index 02edee23..0563b2aa 100644 --- a/lib/solaar/ui/window.py +++ b/lib/solaar/ui/window.py @@ -500,7 +500,9 @@ def _update_details(button): yield (fw.kind, (fw.name + ' ' + fw.version).strip()) flag_bits = device.status.get(_K.NOTIFICATION_FLAGS) - if flag_bits is not None: + if flag_bits is None and device.kind is not None: + yield ('Notifications', ('N/A',)) + else: flag_names = ('(none)',) if flag_bits == 0 else _hidpp10.NOTIFICATION_FLAG.flag_names(flag_bits) yield ('Notifications', ('\n%15s' % ' ').join(flag_names))