miniterm: add suspend function (quickly close/reopen ports)
diff --git a/serial/tools/miniterm.py b/serial/tools/miniterm.py
index 14182f0..f1e9bed 100644
--- a/serial/tools/miniterm.py
+++ b/serial/tools/miniterm.py
@@ -606,6 +606,17 @@
sys.stderr.write('--- Port changed to: {} ---\n'.format(self.serial.port))
# and restart the reader thread
self._start_reader()
+ elif c in 'sS': # S -> suspend / open port temporarily
+ # reader thread needs to be shut down
+ self._stop_reader()
+ self.serial.close()
+ sys.stderr.write('--- Port closed: {} ---\n'.format(self.serial.port))
+ sys.stderr.write('--- press any key to reconnect ---\n')
+ self.console.getkey()
+ self.serial.open()
+ # and restart the reader thread
+ self._start_reader()
+ sys.stderr.write('--- Port opened: {} ---\n'.format(self.serial.port))
elif c in 'bB': # B -> change baudrate
sys.stderr.write('\n--- Baudrate: ')
sys.stderr.flush()