diff --git a/terminal.py b/terminal.py index 5462c83..602a291 100755 --- a/terminal.py +++ b/terminal.py @@ -362,6 +362,9 @@ if __name__ == "__main__": help="Don't use colors in output") parser.add_argument("--flow", "-f", action="store_true", help="Enable RTS/CTS flow control") + parser.add_argument("--esp", "-e", action="store_true", + help="Force RTS and DTR high, for ESP boards. Note that" + " the lines may still glitch low at startup.") parser.add_argument("--bufsize", "-z", metavar="SIZE", type=int, help="Buffer size for reads and writes", default=65536) @@ -395,7 +398,13 @@ if __name__ == "__main__": sys.stderr.write("error: %s specified more than once\n" % node) raise SystemExit(1) try: - dev = MySerial(node, baud, rtscts = args.flow) + dev = MySerial(None, baud, rtscts = args.flow) + dev.port = node + if args.esp: + # Force DTR and RTS high by setting to false + dev.dtr = False + dev.rts = False + dev.open() except serial.serialutil.SerialException: sys.stderr.write("error opening %s\n" % node) raise SystemExit(1)