From: Jean-François Nguyen Date: Mon, 28 Jun 2021 14:27:39 +0000 (+0200) Subject: tools.flterm: warn and continue after failed TIOCMBIC ioctl. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4519308b9f45a94f54b304071b7bc6d74f0c145d;p=lambdasoc.git tools.flterm: warn and continue after failed TIOCMBIC ioctl. --- diff --git a/lambdasoc/tools/flterm.py b/lambdasoc/tools/flterm.py index 0cdec2a..2348c1f 100755 --- a/lambdasoc/tools/flterm.py +++ b/lambdasoc/tools/flterm.py @@ -10,6 +10,7 @@ import asyncio import asyncserial import serial import argparse +import traceback if sys.platform == "win32": @@ -134,10 +135,15 @@ class Flterm: self.output_only = output_only self.port = asyncserial.AsyncSerial(port, baudrate=speed) - if serial.__version__[0] == "2": - self.port.ser.setRTS(False) - else: - self.port.ser.rts = False + try: + if serial.__version__[0] == "2": + self.port.ser.setRTS(False) + else: + self.port.ser.rts = False + except OSError: + # FIXME: The TIOCMBIC ioctl failed. This port is probably a pseudo TTY. + traceback.print_exc() + print("[FLTERM] Failed to clear RTS bit. Continuing anyway...") def init(self): if not (self.upload_only or self.output_only):