cli: Fix crash when showing notification flags. (#3070)
This commit is contained in:
parent
a87ae59a93
commit
1dd1ace327
|
|
@ -189,7 +189,9 @@ class Hidpp10:
|
||||||
write_register(device, Registers.THREE_LEDS, v1, v2)
|
write_register(device, Registers.THREE_LEDS, v1, v2)
|
||||||
|
|
||||||
def get_notification_flags(self, device: Device):
|
def get_notification_flags(self, device: Device):
|
||||||
return NotificationFlag(self._get_register(device, Registers.NOTIFICATIONS))
|
flags = self._get_register(device, Registers.NOTIFICATIONS)
|
||||||
|
if flags is not None:
|
||||||
|
return NotificationFlag(flags)
|
||||||
|
|
||||||
def set_notification_flags(self, device: Device, *flag_bits: NotificationFlag):
|
def set_notification_flags(self, device: Device, *flag_bits: NotificationFlag):
|
||||||
assert device is not None
|
assert device is not None
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ def _print_receiver(receiver):
|
||||||
if notification_flags is not None:
|
if notification_flags is not None:
|
||||||
if notification_flags:
|
if notification_flags:
|
||||||
notification_names = hidpp10_constants.NotificationFlag.flag_names(notification_flags)
|
notification_names = hidpp10_constants.NotificationFlag.flag_names(notification_flags)
|
||||||
print(f" Notifications: {', '.join(notification_names)} (0x{notification_flags:06X})")
|
print(f" Notifications: {', '.join(notification_names)} (0x{notification_flags.value:06X})")
|
||||||
else:
|
else:
|
||||||
print(" Notifications: (none)")
|
print(" Notifications: (none)")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue