cli: Fix crash when showing notification flags. (#3070)

This commit is contained in:
Gabriel Ebner
2025-12-12 01:54:10 -08:00
committed by GitHub
parent a87ae59a93
commit 1dd1ace327
2 changed files with 4 additions and 2 deletions

View File

@@ -189,7 +189,9 @@ class Hidpp10:
write_register(device, Registers.THREE_LEDS, v1, v2)
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):
assert device is not None

View File

@@ -56,7 +56,7 @@ def _print_receiver(receiver):
if notification_flags is not None:
if 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:
print(" Notifications: (none)")