X-Git-Url: https://apps.delaporte.us/gitweb/dotfiles.git/blobdiff_plain/766480c4f71882cbb7ca156d1efa402d9f74390c..09daf7343b6b5f929000c4001ff946e19de8914e:/invoke/esptool/tasks.py diff --git a/invoke/esptool/tasks.py b/invoke/esptool/tasks.py index 590d700..54793ee 100644 --- a/invoke/esptool/tasks.py +++ b/invoke/esptool/tasks.py @@ -6,9 +6,16 @@ import os HOME = os.path.expanduser('~') TODAY = dt.now().strftime('%Y.%m.%d') +# Examples for CardputerAdv +DEVICE = 'Espressif' +PORT='/dev/ttyACM0' # Linux +# PORT='COM0' # Windows + @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 +23,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...') @@ -32,14 +49,29 @@ def usbdiff(c): # Maybe https://thelastoutpostworkshop.github.io/ESPConnect/ in Chromium? -DEV='/dev/ttyACM0' + +@task +def check_conn(c): + result = c.run(f'lsusb | grep {DEVICE}') + assert DEVICE in result.stdout + print('[ok]') @task def listusb(c): - c.run('ls /dev/ttyACM*') + # result = c.run('ls /dev/ttyACM*') + result = c.run(f'ls {PORT}') + assert result.ok + print('[ok]') # c.run('ls /dev/ttyUSB*') -@task() +@task def chip_id(c): - c.run(f'esptool --port {DEV} chip-id') + c.run(f'esptool --port {PORT} chip-id') + print('[ok]') + +@task +def check_all(c): + listusb(c) + check_conn(c) + chip_id(c)