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:
|
if args.restart_on_wake_up:
|
||||||
_upower.watch(listener.start_all, listener.stop_all)
|
_upower.watch(listener.start_all, listener.stop_all)
|
||||||
else:
|
else:
|
||||||
_upower.watch(listener.ping_all)
|
_upower.watch(lambda: listener.ping_all(True))
|
||||||
|
|
||||||
# main UI event loop
|
# main UI event loop
|
||||||
ui.run_loop(listener.start_all, listener.stop_all, args.window!='only', args.window!='hide')
|
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:
|
for l in listeners:
|
||||||
l.join()
|
l.join()
|
||||||
|
|
||||||
|
# ping all devices to find out whether they are connected
|
||||||
def ping_all():
|
# 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():
|
for l in _all_listeners.values():
|
||||||
count = l.receiver.count()
|
count = l.receiver.count()
|
||||||
if count:
|
if count:
|
||||||
for dev in l.receiver:
|
for dev in l.receiver:
|
||||||
|
if resuming:
|
||||||
|
dev.status._active = False
|
||||||
dev.ping()
|
dev.ping()
|
||||||
l._status_changed(dev)
|
l._status_changed(dev)
|
||||||
count -= 1
|
count -= 1
|
||||||
|
|
Loading…
Reference in New Issue