ui: better handling of missing devices
This commit is contained in:
parent
940aae1be1
commit
51532252df
|
|
@ -314,10 +314,13 @@ def ping_all(resuming=False):
|
||||||
for dev in listener_thread.receiver:
|
for dev in listener_thread.receiver:
|
||||||
if resuming:
|
if resuming:
|
||||||
dev._active = None # ensure that settings are pushed
|
dev._active = None # ensure that settings are pushed
|
||||||
if dev.ping():
|
|
||||||
dev.changed(active=True, push=True)
|
|
||||||
listener_thread._status_changed(dev)
|
|
||||||
count -= 1
|
count -= 1
|
||||||
|
try: # sometimes the device is not set up already, it should come back later
|
||||||
|
if dev.ping():
|
||||||
|
dev.changed(active=True, push=True)
|
||||||
|
listener_thread._status_changed(dev)
|
||||||
|
except exceptions.NoSuchDevice:
|
||||||
|
logger.debug("can't ping device on resume: %s", dev)
|
||||||
if not count:
|
if not count:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,9 @@ def run_loop(
|
||||||
|
|
||||||
|
|
||||||
def _status_changed(device, alert, reason, refresh=False):
|
def _status_changed(device, alert, reason, refresh=False):
|
||||||
assert device is not None
|
if device is None:
|
||||||
|
logger.debug("status changed on nil device: %s (%s) %s", device, alert, reason)
|
||||||
|
return
|
||||||
logger.debug("status changed: %s (%s) %s", device, alert, reason)
|
logger.debug("status changed: %s (%s) %s", device, alert, reason)
|
||||||
if alert is None:
|
if alert is None:
|
||||||
alert = Alert.NONE
|
alert = Alert.NONE
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue