tools: stop live before starting it

If for some reason the device is still in live mode from an earlier
invocation, stop live mode first before we attempt to start a new one.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2019-08-29 11:29:56 +10:00
parent 43c844ea1e
commit b40dee5900
1 changed files with 3 additions and 0 deletions

View File

@ -126,6 +126,9 @@ def run_live(request_fd_queue, conn_fd):
manager = tuhi.dbusclient.TuhiDBusClientManager()
for device in manager.devices:
if device.live:
logger.info(f'{device} is already live, stopping first')
device.stop_live()
logger.info(f'starting live on {device}, please press button on the device')
request_fd_queue.put(os.getpid())
fd = reduction.recv_handle(conn_fd)