solaar: defensive measure for partly set up receiver when notifications start

This commit is contained in:
Peter F. Patel-Schneider 2022-05-04 10:49:21 -04:00
parent 97dca3d8f3
commit b5e910916c
1 changed files with 3 additions and 3 deletions

View File

@ -85,10 +85,10 @@ class ReceiverListener(_listener.EventsListener):
def has_started(self): def has_started(self):
if _log.isEnabledFor(_INFO): if _log.isEnabledFor(_INFO):
_log.info('%s: notifications listener has started (%s)', self.receiver, self.receiver.handle) _log.info('%s: notifications listener has started (%s)', self.receiver, self.receiver.handle)
notification_flags = self.receiver.enable_connection_notifications() nfs = self.receiver.enable_connection_notifications()
assert self.receiver.isDevice or (notification_flags & _hidpp10.NOTIFICATION_FLAG.wireless), \ assert self.receiver.isDevice or ((nfs if nfs else 0) & _hidpp10.NOTIFICATION_FLAG.wireless), \
'Receiver on %s does not support connection notifications, GUI will not show it' % self.receiver.path 'Receiver on %s does not support connection notifications, GUI will not show it' % self.receiver.path
self.receiver.status[_status.KEYS.NOTIFICATION_FLAGS] = notification_flags self.receiver.status[_status.KEYS.NOTIFICATION_FLAGS] = nfs
self.receiver.notify_devices() self.receiver.notify_devices()
self._status_changed(self.receiver) # , _status.ALERT.NOTIFICATION) self._status_changed(self.receiver) # , _status.ALERT.NOTIFICATION)