only set NOTIFICATION_FLAGS for 1.0 devices

This commit is contained in:
Daniel Pavel 2013-07-04 13:22:35 +02:00
parent 007cbef086
commit cd437c3809
3 changed files with 8 additions and 3 deletions

View File

@ -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.

View File

@ -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)))

View File

@ -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))