]>
apps.delaporte.us Git - dotfiles.git/blob - invoke/esptool/tasks.py
1 from invoke
import task
3 from datetime
import datetime
as dt
6 HOME
= os
.path
.expanduser('~')
7 TODAY
= dt
.now().strftime('%Y.%m.%d')
9 # Examples for CardputerAdv
11 PORT
='/dev/ttyACM0' # Linux
12 # PORT='COM0' # Windows
17 On using this tasks file
19 - Set the Cardputer Adv power to 'off' state
20 - Plugging in to USB will cause it to boot
21 - Hold 'Go' while booting
22 - Hold 'Go' and press 'Reset' to try again.
23 - On success, the usual screen content still shows up
24 > Tip: Be sure to use a cable that can carry data, not just power.
27 https://github.com/echo-lalia/MicroHydra
34 '''Check that the current user is a member of dialout'''
35 result
= c
.run(f
'groups {os.getlogin()}')
36 assert 'dialout' in result
.stdout
41 '''Use lsusb to try to find the new device.'''
42 input('Un-plug in the device...')
43 c
.run('lsusb > /tmp/before.txt')
44 input('Plug in the device...')
45 c
.run('lsusb > /tmp/after.txt')
46 result
= c
.run('diff /tmp/before.txt /tmp/after.txt')
50 # Maybe https://thelastoutpostworkshop.github.io/ESPConnect/ in Chromium?
55 result
= c
.run(f
'lsusb | grep {DEVICE}')
56 assert DEVICE
in result
.stdout
61 # result = c.run('ls /dev/ttyACM*')
62 result
= c
.run(f
'ls {PORT}')
65 # c.run('ls /dev/ttyUSB*')
69 c
.run(f
'esptool --port {PORT} chip-id')