device: fix typing issue with notification flags

This commit is contained in:
Peter F. Patel-Schneider
2025-12-09 15:30:39 -05:00
parent 4d2a42d541
commit 2e549371ef
3 changed files with 3 additions and 3 deletions

View File

@@ -189,7 +189,7 @@ class Hidpp10:
write_register(device, Registers.THREE_LEDS, v1, v2)
def get_notification_flags(self, device: Device):
return self._get_register(device, Registers.NOTIFICATIONS)
return NotificationFlag(self._get_register(device, Registers.NOTIFICATIONS))
def set_notification_flags(self, device: Device, *flag_bits: NotificationFlag):
assert device is not None

View File

@@ -38,7 +38,7 @@ def run(receivers, args, find_receiver, _ignore):
assert receiver
# check if it's necessary to set the notification flags
old_notification_flags = _hidpp10.get_notification_flags(receiver) or 0
old_notification_flags = _hidpp10.get_notification_flags(receiver)
if not (old_notification_flags & hidpp10_constants.NotificationFlag.WIRELESS):
_hidpp10.set_notification_flags(receiver, old_notification_flags | hidpp10_constants.NotificationFlag.WIRELESS)

View File

@@ -247,7 +247,7 @@ def test_set_3leds_missing(device, mocker):
def test_get_notification_flags(device):
result = _hidpp10.get_notification_flags(device)
assert result == int("000900", 16)
assert result == hidpp10_constants.NotificationFlag(int("000900", 16))
def test_set_notification_flags(mocker):