listener: mark device as inactive after resume so that settings are correctly pushed
This commit is contained in:
parent
789f5f05c3
commit
23c0397764
|
@ -106,7 +106,7 @@ def main():
|
|||
if args.restart_on_wake_up:
|
||||
_upower.watch(listener.start_all, listener.stop_all)
|
||||
else:
|
||||
_upower.watch(listener.ping_all)
|
||||
_upower.watch(lambda: listener.ping_all(True))
|
||||
|
||||
# main UI event loop
|
||||
ui.run_loop(listener.start_all, listener.stop_all, args.window!='only', args.window!='hide')
|
||||
|
|
|
@ -291,12 +291,16 @@ def stop_all():
|
|||
for l in listeners:
|
||||
l.join()
|
||||
|
||||
|
||||
def ping_all():
|
||||
# ping all devices to find out whether they are connected
|
||||
# after a resume, the device may have been off
|
||||
# so mark its saved status to ensure that the status is pushed to the device when it comes back
|
||||
def ping_all(resuming = False):
|
||||
for l in _all_listeners.values():
|
||||
count = l.receiver.count()
|
||||
if count:
|
||||
for dev in l.receiver:
|
||||
if resuming:
|
||||
dev.status._active = False
|
||||
dev.ping()
|
||||
l._status_changed(dev)
|
||||
count -= 1
|
||||
|
|
Loading…
Reference in New Issue