11
This is a console application that provides a small terminal application.
12
miniterm itself does not implement any terminal features such as VT102
13
compatibility. However it inherits these features from the terminal it is run.
14
For example on GNU/Linux running from an xterm it will support the escape
15
sequences of the xterm. On Windows the typical console window is dumb and does
16
not support any escapes. When ANSI.sys is loaded it supports some escapes.
20
--- Miniterm on /dev/ttyS0: 9600,8,N,1 ---
21
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
23
Command line options can be given so that binary data including escapes for
24
terminals are escaped or output as hex.
26
miniterm supports :rfc:`2217` remote serial ports and raw sockets using URLs
27
such as ``rfc2217:://<host>:<port>`` respectively ``socket://<host>:<port>`` as
28
*port* argument when invoking.
30
Command line options ``miniterm.py -h``::
32
Usage: miniterm.py [options] [port [baudrate]]
34
Miniterm - A simple terminal program for the serial port.
37
-h, --help show this help message and exit
38
-p PORT, --port=PORT port, a number (default 0) or a device name
40
-b BAUDRATE, --baud=BAUDRATE
41
set baud rate, default 9600
42
--parity=PARITY set parity, one of [N, E, O, S, M], default=N
43
-e, --echo enable local echo (default off)
44
--rtscts enable RTS/CTS flow control (default off)
45
--xonxoff enable software flow control (default off)
46
--cr do not send CR+LF, send CR only
47
--lf do not send CR+LF, send LF only
48
-D, --debug debug received data (escape non-printable chars)
49
--debug can be given multiple times: 0: just print
50
what is received 1: escape non-printable characters,
51
do newlines as unusual 2: escape non-printable
52
characters, newlines too 3: hex dump everything
53
--rts=RTS_STATE set initial RTS line state (possible values: 0, 1)
54
--dtr=DTR_STATE set initial DTR line state (possible values: 0, 1)
55
-q, --quiet suppress non error messages
57
ASCII code of special character that is used to exit
60
ASCII code of special character that is used to
61
control miniterm (menu)
64
miniterm supports some control functions. Typing :kbd:`Control+t Control+h` when it is
65
running shows the help text::
67
--- pySerial - miniterm - help
69
--- Ctrl+] Exit program
70
--- Ctrl+T Menu escape key, followed by:
72
--- Ctrl+T Send the menu character itself to remote
73
--- Ctrl+] Send the exit character to remote
75
--- Ctrl+U Upload file (prompt will be shown)
77
--- Ctrl+R RTS Ctrl+E local echo
78
--- Ctrl+D DTR Ctrl+B BREAK
79
--- Ctrl+L line feed Ctrl+A Cycle repr mode
81
--- Port settings (Ctrl+T followed by the following):
83
--- n e o s m change parity (None, Even, Odd, Space, Mark)
84
--- 1 2 3 set stop bits (1, 2, 1.5)
85
--- b change baud rate
86
--- x X disable/enable software flow control
87
--- r R disable/enable hardware flow control
89
.. versionchanged:: 2.5
90
Added :kbd:`Control+t` menu and added support for opening URLs.
95
setup-miniterm-py2exe.py_
96
This is a py2exe setup script for Windows. It can be used to create a
97
standalone ``miniterm.exe``.
99
.. _miniterm.py: http://pyserial.svn.sourceforge.net/viewvc/*checkout*/pyserial/trunk/pyserial/examples/miniterm.py
100
.. _setup-miniterm-py2exe.py: http://pyserial.svn.sourceforge.net/viewvc/*checkout*/pyserial/trunk/pyserial/examples/setup-miniterm-py2exe.py
103
TCP/IP - serial bridge
104
======================
105
This program opens a TCP/IP port. When a connection is made to that port (e.g.
106
with telnet) it forwards all data to the serial port and vice versa.
108
This example only exports a raw socket connection. The next example
109
below gives the client much more control over the remote serial port.
111
- The serial port settings are set on the command line when starting the
113
- There is no possibility to change settings from remote.
114
- All data is passed through as-is.
118
Usage: tcp_serial_redirect.py [options] [port [baudrate]]
120
Simple Serial to Network (TCP/IP) redirector.
123
-h, --help show this help message and exit
124
-q, --quiet suppress non error messages
125
--spy peek at the communication and print all data to the
132
port, a number (default 0) or a device name
133
-b BAUDRATE, --baud=BAUDRATE
134
set baud rate, default: 9600
135
--parity=PARITY set parity, one of [N, E, O], default=N
136
--rtscts enable RTS/CTS flow control (default off)
137
--xonxoff enable software flow control (default off)
138
--rts=RTS_STATE set initial RTS line state (possible values: 0, 1)
139
--dtr=DTR_STATE set initial DTR line state (possible values: 0, 1)
142
Network configuration.
144
-P LOCAL_PORT, --localport=LOCAL_PORT
146
--rfc2217 allow control commands with Telnet extension RFC-2217
149
Convert newlines between network and serial port. Conversion is
150
normally disabled and can be enabled by --convert.
152
-c, --convert enable newline conversion (default off)
154
type of newlines that are expected on the network
157
type of newlines that are expected on the serial port
160
NOTE: no security measures are implemented. Anyone can remotely connect to
161
this service over the network. Only one connection at once is supported. When
162
the connection is terminated it waits for the next connect.
165
tcp_serial_redirect.py_
168
.. _tcp_serial_redirect.py: http://pyserial.svn.sourceforge.net/viewvc/*checkout*/pyserial/trunk/pyserial/examples/tcp_serial_redirect.py
170
Single-port TCP/IP - serial bridge (RFC 2217)
171
=============================================
172
Simple cross platform :rfc:`2217` serial port server. It uses threads and is
173
portable (runs on POSIX, Windows, etc).
175
- The port settings and control lines (RTS/DTR) can be changed at any time
176
using :rfc:`2217` requests. The status lines (DSR/CTS/RI/CD) are polled every
177
second and notifications are sent to the client.
178
- Telnet character IAC (0xff) needs to be doubled in data stream. IAC followed
179
by an other value is interpreted as Telnet command sequence.
180
- Telnet negotiation commands are sent when connecting to the server.
181
- RTS/DTR are activated on client connect and deactivated on disconnect.
182
- Default port settings are set again when client disconnects.
186
Usage: rfc2217_server.py [options] port
188
RFC 2217 Serial to Network (TCP/IP) redirector.
191
-h, --help show this help message and exit
192
-p LOCAL_PORT, --localport=LOCAL_PORT
195
NOTE: no security measures are implemented. Anyone can remotely connect to
196
this service over the network. Only one connection at once is supported. When
197
the connection is terminated it waits for the next connect.
199
.. versionadded:: 2.5
204
setup-rfc2217_server-py2exe.py_
205
This is a py2exe setup script for Windows. It can be used to create a
206
standalone ``rfc2217_server.exe``.
208
.. _rfc2217_server.py: http://pyserial.svn.sourceforge.net/viewvc/*checkout*/pyserial/trunk/pyserial/examples/rfc2217_server.py
209
.. _setup-rfc2217_server-py2exe.py: http://pyserial.svn.sourceforge.net/viewvc/*checkout*/pyserial/trunk/pyserial/examples/setup-rfc2217_server-py2exe.py
212
Multi-port TCP/IP - serial bridge (RFC 2217)
213
============================================
214
This example implements a TCP/IP to serial port service that works with
215
multiple ports at once. It uses select, no threads, for the serial ports and
216
the network sockets and therefore runs on POSIX systems only.
218
- Full control over the serial port with :rfc:`2217`.
219
- Check existence of ``/tty/USB0...8``. This is done every 5 seconds using
221
- Send zeroconf announcements when port appears or disappears (uses
222
python-avahi and dbus). Service name: ``_serial_port._tcp``.
223
- Each serial port becomes available as one TCP/IP server. e.g.
224
``/dev/ttyUSB0`` is reachable at ``<host>:7000``.
225
- Single process for all ports and sockets (not per port).
226
- The script can be started as daemon.
227
- Logging to stdout or when run as daemon to syslog.
228
- Default port settings are set again when client disconnects.
229
- modem status lines (CTS/DSR/RI/CD) are not polled periodically and the server
230
therefore does not send NOTIFY_MODEMSTATE on its own. However it responds to
231
request from the client (i.e. use the ``poll_modem`` option in the URL when
232
using a pySerial client.)
239
- python-serial (>= 2.5)
241
Installation as daemon:
243
- Copy the script ``port_publisher.py`` to ``/usr/local/bin``.
244
- Copy the script ``port_publisher.sh`` to ``/etc/init.d``.
245
- Add links to the runlevels using ``update-rc.d port_publisher.sh defaults 99``
246
- Thats it :-) the service will be started on next reboot. Alternatively run
247
``invoke-rc.d port_publisher.sh start`` as root.
249
.. versionadded:: 2.5 new example
252
Multi-port TCP/IP-serial converter (RFC 2217) for POSIX environments.
255
Example init.d script.
257
.. _port_publisher.py: http://pyserial.svn.sourceforge.net/viewvc/*checkout*/pyserial/trunk/pyserial/examples/port_publisher.py
258
.. _port_publisher.sh: http://pyserial.svn.sourceforge.net/viewvc/*checkout*/pyserial/trunk/pyserial/examples/port_publisher.sh
263
A simple terminal application for wxPython and a flexible serial port
264
configuration dialog are shown here.
267
A simple terminal application. Note that the length of the buffer is
268
limited by wx and it may suddenly stop displaying new input.
271
A wxGlade design file for the terminal application.
273
wxSerialConfigDialog.py_
274
A flexible serial port configuration dialog.
276
wxSerialConfigDialog.wxg_
277
The wxGlade design file for the configuration dialog.
279
setup-wxTerminal-py2exe.py_
280
A py2exe setup script to package the terminal application.
282
.. _wxTerminal.py: http://pyserial.svn.sourceforge.net/viewvc/*checkout*/pyserial/trunk/pyserial/examples/wxTerminal.py
283
.. _wxTerminal.wxg: http://pyserial.svn.sourceforge.net/viewvc/*checkout*/pyserial/trunk/pyserial/examples/wxTerminal.wxg
284
.. _wxSerialConfigDialog.py: http://pyserial.svn.sourceforge.net/viewvc/*checkout*/pyserial/trunk/pyserial/examples/wxSerialConfigDialog.py
285
.. _wxSerialConfigDialog.wxg: http://pyserial.svn.sourceforge.net/viewvc/*checkout*/pyserial/trunk/pyserial/examples/wxSerialConfigDialog.wxg
286
.. _setup-wxTerminal-py2exe.py: http://pyserial.svn.sourceforge.net/viewvc/*checkout*/pyserial/trunk/pyserial/examples/setup-wxTerminal-py2exe.py
291
This example provides a subclass based on ``Serial`` that has an alternative
292
implementation of ``readline()``
295
A class with alternative ``readline()`` implementation.
297
.. _enhancedserial.py: http://pyserial.svn.sourceforge.net/viewvc/*checkout*/pyserial/trunk/pyserial/examples/enhancedserial.py
303
A simple loop that probes serial ports by number.
306
A Linux only version looking at the entries in ``/dev``. It works best with
307
on systems with devfs or udev that only create those entries that represent
308
devices. On older installations a lot of pre-created device files are found
309
and an additional open check should be added to ensure that the device is
313
A Windows only version that returns a list of serial ports with information
316
.. _scan.py: http://pyserial.svn.sourceforge.net/viewvc/*checkout*/pyserial/trunk/pyserial/examples/scan.py
317
.. _scanlinux.py: http://pyserial.svn.sourceforge.net/viewvc/*checkout*/pyserial/trunk/pyserial/examples/scanlinux.py
318
.. _scanwin32.py: http://pyserial.svn.sourceforge.net/viewvc/*checkout*/pyserial/trunk/pyserial/examples/scanwin32.py
323
The project uses a number of unit test to verify the functionality. They all
324
need a loop back connector. The scripts itself contain more information. All
325
test scripts are contained in the directory ``test``.
327
The unit tests are performed on port ``0`` unless a different device name or
328
``rfc2217://`` URL is given on the command line (argv[1]).
331
Collect all tests from all ``test*`` files and run them. By default, the
332
``loop://`` device is used.
335
Basic tests (binary capabilities, timeout, control lines).
338
Test more advanced features (properties).
341
Tests involving sending a lot of data.
344
Tests involving readline.
347
Tests involving the :mod:`io` library. Only available for Python 2.6 and
350
.. _run_all_tests.py: http://pyserial.svn.sourceforge.net/viewvc/*checkout*/pyserial/trunk/pyserial/test/run_all_tests.py
351
.. _test.py: http://pyserial.svn.sourceforge.net/viewvc/*checkout*/pyserial/trunk/pyserial/test/test.py
352
.. _test_advanced.py: http://pyserial.svn.sourceforge.net/viewvc/*checkout*/pyserial/trunk/pyserial/test/test_advanced.py
353
.. _test_high_load.py: http://pyserial.svn.sourceforge.net/viewvc/*checkout*/pyserial/trunk/pyserial/test/test_high_load.py
354
.. _test_readline.py: http://pyserial.svn.sourceforge.net/viewvc/*checkout*/pyserial/trunk/pyserial/test/test_readline.py
355
.. _test_iolib.py: http://pyserial.svn.sourceforge.net/viewvc/*checkout*/pyserial/trunk/pyserial/test/test_iolib.py