From 49460cf0fa01c3928e9837bdeba80d7b9fed9621 Mon Sep 17 00:00:00 2001 From: Edward Delaporte Date: Mon, 8 Jun 2026 23:02:01 -0500 Subject: [PATCH] Add check for device connected --- invoke/esptool/tasks.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/invoke/esptool/tasks.py b/invoke/esptool/tasks.py index 2a80767..43df54e 100644 --- a/invoke/esptool/tasks.py +++ b/invoke/esptool/tasks.py @@ -9,6 +9,8 @@ TODAY = dt.now().strftime('%Y.%m.%d') @task def help(c): ''' + On using this tasks file + - Set the Cardputer Adv power to 'off' state - Plugging in to USB will cause it to boot - Hold 'Go' while booting @@ -24,12 +26,14 @@ def help(c): @task def groups(c): + '''Check that the current user is a member of dialout''' result = c.run(f'groups {os.getlogin()}') assert 'dialout' in result.stdout print('ok') @task def usbdiff(c): + '''Use lsusb to try to find the new device.''' input('Un-plug in the device...') c.run('lsusb > /tmp/before.txt') input('Plug in the device...') @@ -42,6 +46,13 @@ def usbdiff(c): DEV='/dev/ttyACM0' +@task +def check_connected(c): + dev = 'Espressif' + result = c.run(f'lsusb | grep {dev}') + assert dev in result.stdout + print('[ok]') + @task def listusb(c): c.run('ls /dev/ttyACM*') -- 2.47.3