device: fix typing issue with notification flags
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user