Fix NOTIFICATION_FLAG to NotificationFlag transition leftovers

Fixes "solaar show" for hidpp10 device (or at least for 27MHz FastRF
hidpp10 peripherals).

Fixes: 72c9dfc5 Remove NamedInts: Convert NotificationFlag to flag
This commit is contained in:
Alban Browaeys 2025-04-05 21:52:29 +02:00 committed by Peter F. Patel-Schneider
parent 16bd8126b6
commit ed596666ee
2 changed files with 4 additions and 4 deletions

View File

@ -39,8 +39,8 @@ def run(receivers, args, find_receiver, _ignore):
# check if it's necessary to set the notification flags
old_notification_flags = _hidpp10.get_notification_flags(receiver) or 0
if not (old_notification_flags & hidpp10_constants.NOTIFICATION_FLAG.wireless):
_hidpp10.set_notification_flags(receiver, old_notification_flags | hidpp10_constants.NOTIFICATION_FLAG.wireless)
if not (old_notification_flags & hidpp10_constants.NotificationFlag.WIRELESS):
_hidpp10.set_notification_flags(receiver, old_notification_flags | hidpp10_constants.NotificationFlag.WIRELESS)
# get all current devices
known_devices = [dev.number for dev in receiver]
@ -121,7 +121,7 @@ def run(receivers, args, find_receiver, _ignore):
if n:
receiver.handle.notifications_hook(n)
if not (old_notification_flags & hidpp10_constants.NOTIFICATION_FLAG.wireless):
if not (old_notification_flags & hidpp10_constants.NotificationFlag.WIRELESS):
# only clear the flags if they weren't set before, otherwise a
# concurrently running Solaar app might stop working properly
_hidpp10.set_notification_flags(receiver, old_notification_flags)

View File

@ -131,7 +131,7 @@ def _print_device(dev, num=None):
notification_flags = _hidpp10.get_notification_flags(dev)
if notification_flags is not None:
if notification_flags:
notification_names = hidpp10_constants.NOTIFICATION_FLAG.flag_names(notification_flags)
notification_names = hidpp10_constants.NotificationFlag.flag_names(notification_flags)
print(f" Notifications: {', '.join(notification_names)} (0x{notification_flags:06X}).")
else:
print(" Notifications: (none).")