This is a console application that provides a small terminal application. Miniterm itself does not implement any terminal features such as VT102 compatibility. However it inherits these features from the terminal it is run. For example on GNU/Linux running from an xterm it will support the escape sequences of the xterm. On Windows the typical console window is dumb and does not support any escapes. When ANSI.sys is loaded it supports some escapes.
--- Miniterm on /dev/ttyS0: 9600,8,N,1 --- --- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
Command line options can be given so that binary data including escapes for terminals are escaped or output as hex.
Command line options python -m serial.tools.miniterm -h:
Usage: miniterm.py [options] [port [baudrate]] Miniterm - A simple terminal program for the serial port. Options: -h, --help show this help message and exit Port settings: -p PORT, --port=PORT port, a number or a device name. (deprecated option, use parameter instead) -b BAUDRATE, --baud=BAUDRATE set baud rate, default 9600 --parity=PARITY set parity, one of [N, E, O, S, M], default=N --rtscts enable RTS/CTS flow control (default off) --xonxoff enable software flow control (default off) --rts=RTS_STATE set initial RTS line state (possible values: 0, 1) --dtr=DTR_STATE set initial DTR line state (possible values: 0, 1) Data handling: -e, --echo enable local echo (default off) --cr do not send CR+LF, send CR only --lf do not send CR+LF, send LF only -D, --debug debug received data (escape non-printable chars) --debug can be given multiple times: 0: just print what is received 1: escape non-printable characters, do newlines as unusual 2: escape non-printable characters, newlines too 3: hex dump everything Hotkeys: --exit-char=EXIT_CHAR ASCII code of special character that is used to exit the application --menu-char=MENU_CHAR ASCII code of special character that is used to control miniterm (menu) Diagnostics: -q, --quiet suppress non-error messages
Miniterm supports some control functions. Typing Ctrl+T Ctrl+H when it is running shows the help text:
--- pySerial - miniterm - help --- --- Ctrl+] Exit program --- Ctrl+T Menu escape key, followed by: --- Menu keys: --- Ctrl+T Send the menu character itself to remote --- Ctrl+] Send the exit character to remote --- Ctrl+I Show info --- Ctrl+U Upload file (prompt will be shown) --- Toggles: --- Ctrl+R RTS Ctrl+E local echo --- Ctrl+D DTR Ctrl+B BREAK --- Ctrl+L line feed Ctrl+A Cycle repr mode --- --- Port settings (Ctrl+T followed by the following): --- p change port --- 7 8 set data bits --- n e o s m change parity (None, Even, Odd, Space, Mark) --- 1 2 3 set stop bits (1, 2, 1.5) --- b change baud rate --- x X disable/enable software flow control --- r R disable/enable hardware flow control
Changed in version 2.5: Added Ctrl+T menu and added support for opening URLs.
Changed in version 2.6: File moved from the examples to serial.tools.miniterm.
This program opens a TCP/IP port. When a connection is made to that port (e.g. with telnet) it forwards all data to the serial port and vice versa.
This example only exports a raw socket connection. The next example below gives the client much more control over the remote serial port.
Usage: tcp_serial_redirect.py [options] [port [baudrate]] Simple Serial to Network (TCP/IP) redirector. Options: -h, --help show this help message and exit -q, --quiet suppress non error messages --spy peek at the communication and print all data to the console Serial Port: Serial port settings -p PORT, --port=PORT port, a number (default 0) or a device name -b BAUDRATE, --baud=BAUDRATE set baud rate, default: 9600 --parity=PARITY set parity, one of [N, E, O], default=N --rtscts enable RTS/CTS flow control (default off) --xonxoff enable software flow control (default off) --rts=RTS_STATE set initial RTS line state (possible values: 0, 1) --dtr=DTR_STATE set initial DTR line state (possible values: 0, 1) Network settings: Network configuration. -P LOCAL_PORT, --localport=LOCAL_PORT local TCP port --rfc2217 allow control commands with Telnet extension RFC-2217 Newline Settings: Convert newlines between network and serial port. Conversion is normally disabled and can be enabled by --convert. -c, --convert enable newline conversion (default off) --net-nl=NET_NEWLINE type of newlines that are expected on the network (default: LF) --ser-nl=SER_NEWLINE type of newlines that are expected on the serial port (default: CR+LF) NOTE: no security measures are implemented. Anyone can remotely connect to this service over the network. Only one connection at once is supported. When the connection is terminated it waits for the next connect.
Simple cross platform RFC 2217 serial port server. It uses threads and is portable (runs on POSIX, Windows, etc).
Usage: rfc2217_server.py [options] port RFC 2217 Serial to Network (TCP/IP) redirector. Options: -h, --help show this help message and exit -p LOCAL_PORT, --localport=LOCAL_PORT local TCP port NOTE: no security measures are implemented. Anyone can remotely connect to this service over the network. Only one connection at once is supported. When the connection is terminated it waits for the next connect.
New in version 2.5.
This example implements a TCP/IP to serial port service that works with multiple ports at once. It uses select, no threads, for the serial ports and the network sockets and therefore runs on POSIX systems only.
Installation as daemon:
New in version 2.5: new example
A simple terminal application for wxPython and a flexible serial port configuration dialog are shown here.
This example provides a subclass based on Serial that has an alternative implementation of readline()
The project uses a number of unit test to verify the functionality. They all need a loop back connector. The scripts itself contain more information. All test scripts are contained in the directory test.
The unit tests are performed on port 0 unless a different device name or rfc2217:// URL is given on the command line (argv).