Loading upper_tester/modem.py +8 −1 Changes for upper_tester/modem.py: 8 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -103,9 +103,16 @@ class AtModem: attrs = termios.tcgetattr(self._fd) speed = getattr(termios, f"B{self.baud}") attrs[4] = attrs[5] = speed # Clear HUPCL (hang up on close) and set CLOCAL (ignore modem status lines): without # this, closing our fd -- e.g. on Ctrl-C, or just process exit -- drops DTR, which on # some USB cellular modules the firmware treats as "host went away" and responds to by # detaching/re-enumerating that USB function, i.e. /dev/ttyUSBx disappears even though # we never asked for a module reset. attrs[2] &= ~termios.HUPCL attrs[2] |= termios.CLOCAL termios.tcsetattr(self._fd, termios.TCSANOW, attrs) except (termios.error, AttributeError) as e: # e.g. pty log.debug("baud rate not set: %s", e) log.debug("baud rate/HUPCL/CLOCAL not set: %s", e) self._stop_r, self._stop_w = os.pipe() self._thread = threading.Thread(target=self._reader, name="modem-reader", daemon=True) self._thread.start() Loading Loading
upper_tester/modem.py +8 −1 Changes for upper_tester/modem.py: 8 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -103,9 +103,16 @@ class AtModem: attrs = termios.tcgetattr(self._fd) speed = getattr(termios, f"B{self.baud}") attrs[4] = attrs[5] = speed # Clear HUPCL (hang up on close) and set CLOCAL (ignore modem status lines): without # this, closing our fd -- e.g. on Ctrl-C, or just process exit -- drops DTR, which on # some USB cellular modules the firmware treats as "host went away" and responds to by # detaching/re-enumerating that USB function, i.e. /dev/ttyUSBx disappears even though # we never asked for a module reset. attrs[2] &= ~termios.HUPCL attrs[2] |= termios.CLOCAL termios.tcsetattr(self._fd, termios.TCSANOW, attrs) except (termios.error, AttributeError) as e: # e.g. pty log.debug("baud rate not set: %s", e) log.debug("baud rate/HUPCL/CLOCAL not set: %s", e) self._stop_r, self._stop_w = os.pipe() self._thread = threading.Thread(target=self._reader, name="modem-reader", daemon=True) self._thread.start() Loading