]> us-delaporte.pagekite.me Git - dotfiles.git/blobdiff - invoke/esptool/tasks.py
Add check for device connected
[dotfiles.git] / invoke / esptool / tasks.py
index 590d70028d53952191d592322a94c8f74df5da3e..43df54eaa318ba40446290c601001449da905d0f 100644 (file)
@@ -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
@@ -16,12 +18,22 @@ def help(c):
     - On success, the usual screen content still shows up
     > Tip: Be sure to use a cable that can carry data, not just power.
 
+    Consider burnin
+    https://github.com/echo-lalia/MicroHydra
+
     '''
     print(help.__doc__)
 
+@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...')
@@ -34,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*')