diff options
author | Lars Kellogg-Stedman <lars@oddbit.com> | 2020-03-25 13:23:01 -0400 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2020-03-30 11:37:32 +1100 |
commit | 1cf994c48b912254802f48e31eaf95e49ac55a82 (patch) | |
tree | 4d4ce820ef1ac6463bc9e446bb47578a0cce2deb /tools/pyboard.py | |
parent | 688323307a0cb77067a097ffb30077694b0d55d0 (diff) |
tools/pyboard.py: Support setting device/baudrate from shell env vars.
Allow defaults for --device and --baudrate to be set in the environment
using PYBOARD_DEVICE and PYBOARD_BAUDRATE.
Diffstat (limited to 'tools/pyboard.py')
-rwxr-xr-x | tools/pyboard.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tools/pyboard.py b/tools/pyboard.py index de8b48836..218436242 100755 --- a/tools/pyboard.py +++ b/tools/pyboard.py @@ -558,11 +558,14 @@ def main(): cmd_parser = argparse.ArgumentParser(description="Run scripts on the pyboard.") cmd_parser.add_argument( "--device", - default="/dev/ttyACM0", + default=os.environ.get("PYBOARD_DEVICE", "/dev/ttyACM0"), help="the serial device or the IP address of the pyboard", ) cmd_parser.add_argument( - "-b", "--baudrate", default=115200, help="the baud rate of the serial device" + "-b", + "--baudrate", + default=os.environ.get("PYBOARD_BAUDRATE", "115200"), + help="the baud rate of the serial device", ) cmd_parser.add_argument("-u", "--user", default="micro", help="the telnet login username") cmd_parser.add_argument("-p", "--password", default="python", help="the telnet login password") |