加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
picocom.1 17.79 KB
一键复制 编辑 原始数据 按行查看 历史
Joe Merten 提交于 2016-12-16 10:29 . stripped trailing whitespace
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561
.\" Automatically generated by Pandoc 1.16.0.2
.\"
.TH "PICOCOM" "1" "2016-12-08" "Picocom 2.3a" "User Commands"
.hy
.SH NAME
.PP
picocom \- minimal dumb\-terminal emulation program
.SH SYNOPSIS
.PP
\f[B]picocom\f[] [ \f[I]options\f[] ] \f[I]device\f[]
.SH DESCRIPTION
.PP
As its name suggests, \f[B]picocom(1)\f[] is a minimal dumb\-terminal
emulation program.
It is, in principle, very much like \f[B]minicom(1)\f[], only it\[aq]s
"pico" instead of "mini"! It was designed to serve as a simple, manual,
modem configuration, testing, and debugging tool.
It has also served (quite well) as a low\-tech serial communications
program to allow access to all types of devices that provide serial
consoles.
It could also prove useful in many other similar tasks.
.PP
When picocom starts it opens the terminal (serial device) given as its
non\-option argument.
Unless the \f[B]\-\-noinit\f[] option is given, it configures the device
to the settings specified by the option\-arguments (or to some default
settings), and sets it to "raw" mode.
If \f[B]\-\-noinit\f[] is given, the initialization and configuration is
skipped; the device is just opened.
Following this, picocom sets the standard\-input and standard\-output to
raw mode.
Having done so, it goes in a loop where it listens for input from stdin,
or from the serial port.
Input from the serial port is copied to the standard output while input
from the standard input is copied to the serial port.
Picocom also scans its input stream for a user\-specified control
character, called the \f[I]escape character\f[] (being by default
\f[B]C\-a\f[]).
If the escape character is seen, then instead of sending it to the
serial\-device, the program enters "command mode" and waits for the next
character (which is called the "function character").
Depending on the value of the function character, picocom performs one
of the operations described in the \f[B]COMMANDS\f[] section below.
.SH COMMANDS
.PP
Commands are given to picocom by first keying the \f[I]espace
character\f[] which by default is \f[B]C\-a\f[] (see \f[B]OPTIONS\f[]
below for how to change it), and then keying one of the function
(command) characters shown here.
.TP
.B \f[I]escape character\f[]
Send the escape character to the serial port and return to "transparent"
mode.
This means that if the escape character (\f[B]C\-a\f[], by default) is
typed twice, the program sends the escape character to the serial port,
and remains in transparent mode.
.RS
.RE
.TP
.B \f[B]C\-x\f[]
Exit the program: if the \f[B]\-\-noreset\f[] option was not given then
the serial port is reset to its original settings before exiting; if it
was given the serial port is not reset.
.RS
.RE
.TP
.B \f[B]C\-q\f[]
Quit the program \f[I]without\f[] resetting the serial port, regardless
of the \f[B]\-\-noreset\f[] option.
.RS
.RE
.TP
.B \f[B]C\-p\f[]
Pulse the DTR line.
Lower it for 1 sec, and then raise it again.
.RS
.RE
.TP
.B \f[B]C\-t\f[]
Toggle the DTR line.
If DTR is up, then lower it.
If it is down, then raise it.
.RS
.RE
.TP
.B \f[B]C\-g\f[]
Toggle the RTS line.
If RTS is up, then lower it.
If it is down, then raise it.
Not supported if the flow control mode is RTS/CTS.
Only supported in Linux and OSX.
.RS
.RE
.TP
.B \f[B]C\-backslash\f[]
Generate a break sequence on the serial line.
A break sequence is usually generated by marking (driving to logical
one) the serial Tx line for an amount of time coresponding to several
character durations.
.RS
.RE
.TP
.B \f[B]C\-b\f[]
Set baudrate.
Prompts you to enter a baudrate numerically (in bps) and configures the
serial port accordingly.
.RS
.RE
.TP
.B \f[B]C\-u\f[]
Baud up.
Increase the baud\-rate.
The list of baud\-rates stepped\-through by this command is: 50, 75,
110, 134, 150, 200, 300, 600, 1200, 2400, 4800, 9600, 19200, 38400,
57600, 115200.
If \f[C]HIGH_BAUD\f[] support is compiled\-in, then the following
baud\-rates are also added to the list: 230400, 460800, 500000, 576000,
921600, 1000000, 1152000, 1500000, 2000000, 2500000, 3000000, 3500000,
4000000.
Depending on you system, any of the higher baud rates may be missing.
.RS
.RE
.TP
.B \f[B]C\-d\f[]
Baud down.
Decrease the baud\-rate.
The list of baud\-rates stepped\-through by this command is the same as
for the "baud\-up" command.
.RS
.RE
.TP
.B \f[B]C\-f\f[]
Cycle through flow\-control settings (RTS/CTS, XON/XOFF, none).
.RS
.RE
.TP
.B \f[B]C\-y\f[]
Cycle through parity settings (even, odd, none).
.RS
.RE
.TP
.B \f[B]C\-i\f[]
Cycle through databits\-number settings (5, 6, 7, 8).
.RS
.RE
.TP
.B \f[B]C\-j\f[]
Cycle through stopbits\-number settings (1, 2).
.RS
.RE
.TP
.B \f[B]C\-c\f[]
Toggle local\-echo mode.
.RS
.RE
.TP
.B \f[B]C\-v\f[]
Show program options (like baud rate, data bits, etc) as well as the
actual serial port settings.
Only the options and port settings that can be modified online (through
commands) are shown, not those that can only be set at the
command\-line.
See \f[B]DISPLAY OF OPTIONS AND PORT SETTINGS\f[] for details.
.RS
.RE
.TP
.B \f[B]C\-h\f[] or \f[B]C\-k\f[]
Show help or show keys.
Prints a short description of all available function (command) keys.
.RS
.RE
.TP
.B \f[B]C\-s\f[]
Send (upload) a file.
See \f[B]SENDING AND RECEIVING FILES\f[] below.
.RS
.RE
.TP
.B \f[B]C\-r\f[]
Receive (download) a file.
See \f[B]SENDING AND RECEIVING FILES\f[] below.
.RS
.RE
.PP
After performing one of the above operations, the program leaves the
command mode and enters transparent mode.
Example: To increase the baud\-rate by two steps, you have to type:
.RS
.PP
\f[B]C\-a\f[], \f[B]C\-u\f[], \f[B]C\-a\f[], \f[B]C\-u\f[]
.RE
.PP
assuming of\-course that \f[B]C\-a\f[] is the escape character.
.SH OPTIONS
.PP
Picocom accepts the following command\-line options.
.TP
.B \f[B]\-\-baud\f[] | \f[B]\-b\f[]
Defines the baud\-rate to set the serial\-port (terminal) to.
.RS
.RE
.TP
.B \f[B]\-\-flow\f[] | \f[B]\-f\f[]
Defines the flow\-control mode to set the serial\-port to.
Must be one of: \f[B]x\f[] for xon/xoff (software) mode, \f[B]h\f[] for
hardware flow control (RTS/CTS), \f[B]n\f[] for no flow control.
(Default: \f[B]n\f[])
.RS
.RE
.TP
.B \f[B]\-\-parity\f[] | \f[B]\-y\f[]
Defines the parity mode to set the serial\-port to.
Must be one of: \f[B]o\f[] for odd parity mode, \f[B]e\f[] for even
parity mode, \f[B]n\f[] for no parity mode.
(Default: \f[B]n\f[])
.RS
.RE
.TP
.B \f[B]\-\-databits\f[] | \f[B]\-d\f[]
Defines the number of data bits in every character.
Must be one of: \f[B]5\f[], \f[B]6\f[], \f[B]7\f[], \f[B]8\f[].
(Default: \f[B]8\f[])
.RS
.RE
.TP
.B \f[B]\-\-stopbits\f[] | \f[B]\-p\f[]
Defines the number of stop bits in every character.
Must be one of: \f[B]1\f[], or \f[B]2\f[].
(Default: \f[B]1\f[])
.RS
.RE
.TP
.B \f[B]\-\-escape\f[] | \f[B]\-e\f[]
Defines the character that will make picocom enter command\-mode (see
description above).
If \f[B]x\f[] is given, then \f[B]C\-x\f[] will make picocom enter
command mode.
(Default: \f[B]a\f[])
.RS
.RE
.TP
.B \f[B]\-\-echo\f[] | \f[B]\-c\f[]
Enable local echo.
Every character being read from the terminal (standard input) is echoed
to the terminal (standard output) subject to the echo\-mapping
configuration (see \f[B]\-\-emap\f[] option).
(Default: Disabled)
.RS
.RE
.TP
.B \f[B]\-\-noinit\f[] | \f[B]\-i\f[]
If given, picocom will not initialize, reset, or otherwise meddle with
the serial port at start\-up.
It will just open it.
This is useful, for example, for connecting picocom to
already\-connected modems, or already configured ports without
terminating the connection, or altering the settings.
If required, serial port parameters can then be adjusted at run\-time by
commands.
(Default: Disabled)
.RS
.RE
.TP
.B \f[B]\-\-noreset\f[] | \f[B]\-r\f[]
If given, picocom will not reset the serial port when exiting.
It will just close the filedes and do nothing more.
This is useful, for example, for leaving modems connected when exiting
picocom.
Regardless whether the \f[B]\-\-noreset\f[] option is given, the user
can exit picocom using the "Quit" command (instead of "Exit"), which
never resets the serial port.
If \f[B]\-\-noreset\f[] is given then "Quit" and "Exit" behave
essentially the same.
(Default: Disabled)
.RS
.RE
.TP
.B \f[B]\-\-nolock\f[] | \f[B]\-l\f[]
If given, picocom will \f[I]not\f[] attempt to lock the serial port
before opening it.
Normally, depending on how it\[aq]s compiled, picocom attempts to get a
UUCP\-style lock\-file (e.g.
\[aq]/var/lock/LCK..ttyS0\[aq]) before opening the port, or attempts to
lock the port device\-node using \f[B]flock(2)\f[].
Failing to do so, results in the program exiting after emitting an
error\-message.
It is possible that your picocom binary is compiled without support for
locking.
In this case the \f[B]\-\-nolock\f[] option is accepted, but has no
effect.
(Default: Disabled)
.RS
.RE
.TP
.B \f[B]\-\-send\-cmd\f[] | \f[B]\-s\f[]
Specifies the external program (and any arguments to it) that will be
used for transmitting files.
If the argument to \f[B]\-\-send\-cmd\f[] is the empty string
(\[aq]\[aq]), the send\-file command is disabled.
See \f[B]SENDING AND RECEIVING FILES\f[].
(Default: \f[B]sz \-vv\f[])
.RS
.RE
.TP
.B \f[B]\-\-receive\-cmd\f[] | \f[B]\-v\f[]
Specifies the external program (and any arguments to it) that will be
used for receiving files.
If the argument to \f[B]\-\-receive\-cmd\f[] is the empty string
(\[aq]\[aq]), the receive\-file command is disabled.
See \f[B]SENDING AND RECEIVING FILES\f[].
(Default: \f[B]rz \-vv\f[])
.RS
.RE
.TP
.B \f[B]\-\-imap\f[]
Specifies the input character map (i.e.
special characters to be replaced when read from the serial port).
See \f[B]INPUT, OUTPUT, AND ECHO MAPPING\f[].
(Defaul: Empty)
.RS
.RE
.TP
.B \f[B]\-\-omap\f[]
Specifies the output character map (i.e.
special characters to be replaced before being written to serial port).
See \f[B]INPUT, OUTPUT, AND ECHO MAPPING\f[].
(Defaul: Empty)
.RS
.RE
.TP
.B \f[B]\-\-emap\f[]
Specifies the local\-echo character map (i.e.
special characters to be replaced before being echoed\-back to the
terminal, if local\-echo is enabled).
See \f[B]INPUT, OUTPUT, AND ECHO MAPPING\f[].
(Defaul: \f[B]delbs,crcrlf\f[])
.RS
.RE
.TP
.B \f[B]\-\-logfile\f[] | \f[B]\-g\f[]
Use specified file for logging (recording) serial input, and possibly
serial output.
If the file exists, it is appended to.
Every character read from the serial port is written to the specified
file (before input mapping is performed).
If local\-echo mode is is enabled (see \f[B]\-\-echo\f[] option and
\f[B]C\-c\f[] command), then every character written to the serial port
(after output mapping is performed) is also logged to the same file.
(Default: no logging)
.RS
.RE
.TP
.B \f[B]\-\-lower\-rts\f[]
Lower the RTS control signal after opening the serial port (by default
RTS is raised after open).
Only supported when flow\-control mode is not set to RTS/CTS, ignored
otherwise.
Only supported in Linux and OSX.
.RS
.RE
.TP
.B \f[B]\-\-lower\-dtr\f[]
Lower the DTR control signal after opening the serial port (by default
DTR is raised after open).
Only supported in Linux and OSX.
.RS
.RE
.TP
.B \f[B]\-\-help\f[] | \f[B]\-h\f[]
Print a short help message describing the command\-line options.
Picocom\[aq]s version, ompile\-time options, and enabled features are
also shown.
.RS
.RE
.SH DISPLAY OF OPTIONS AND PORT SETTINGS
.PP
The "show program options" command (\f[B]C\-v\f[]), as well as the
commands that change program options (\f[B]C\-b\f[], \f[B]C\-u\f[],
\f[B]C\-d\f[], \f[B]C\-f\f[], etc) print messages showing the current
values (or the new values, if they were changed) for the respective
options.
If picocom determines that an actual serial\-port setting differs from
the current value of the respective option (for whatever reason), then
the value of the option is shown followed by the value of the actual
serial\-port setting in parenthesis.
Example:
.IP
.nf
\f[C]
***\ baud:\ 115200\ (9600)\
\f[]
.fi
.PP
This means that a baud rate of 115200bps has been selected (from the
command line, or using commands that change the baudrate) but the
serial\-port is actually operating at 9600bps (the driver may not
support the higher setting, and has silently replaced it with a safe
default, or the setting may have been changed from outside picocom).
If the option and the corresponding serial\-port setting are the same,
only a single value is shown.
Example:
.IP
.nf
\f[C]
***\ baud:\ 9600
\f[]
.fi
.PP
This behavior was introduced in picocom 2.0.
Older releases displayed only the option values, not the actual
serial\-port settings corresponding to them.
.SH SENDING AND RECEIVING FILES
.PP
Picocom can send and receive files over the serial port using external
programs that implement the respective protocols.
In Linux typical programs for this purpose are:
.IP \[bu] 2
\f[B]rx(1)\f[] \- receive using the X\-MODEM protocol
.IP \[bu] 2
\f[B]rb(1)\f[] \- receive using the Y\-MODEM protocol
.IP \[bu] 2
\f[B]rz(1)\f[] \- receive using the Z\-MODEM protocol
.IP \[bu] 2
\f[B]sx(1)\f[] \- send using the X\-MODEM protocol
.IP \[bu] 2
\f[B]sb(1)\f[] \- send using the Y\-MODEM protocol
.IP \[bu] 2
\f[B]sz(1)\f[] \- send using the Z\-MODEM protocol
.IP \[bu] 2
\f[B]ascii\-xfr(1)\f[] \- receive or transmit ASCII files
.PP
The name of, and the command\-line options to, the program to be used
for transmitting files are given by the \f[B]\-\-send\-cmd\f[] option.
Similarly the program to receive files, and its arguments, are given by
the \f[B]\-\-receive\-cmd\f[] option.
For example, in order to start a picocom session that uses
\f[B]sz(1)\f[] to transmit files, and \f[B]rz(1)\f[] to receive files,
you have to say something like this:
.IP
.nf
\f[C]
picocom\ \-\-send\-cmd\ "sz\ \-vv"\ \-\-receive\-cmd\ "rz\ \-vv"\ ...
\f[]
.fi
.PP
If the argument to the \f[B]\-send\-cmd\f[] option, or the argument to
the \f[B]\-\-receive\-cmd\f[] option is the empty string, then the
respective command is disabled.
For example, in order to disable both the "send" and the "receive"
commands you can invoke picocom like this:
.IP
.nf
\f[C]
picocom\ \-\-send\-cmd\ \[aq]\[aq]\ \-\-receive\-cmd\ \[aq]\[aq]\ ...
\f[]
.fi
.PP
A picocom session with both, the send\- and the receive\-file commands
disabled does not \f[B]fork(2)\f[] and does not run any external
programs.
.PP
During the picocom session, if you key the "send" or "receive" commands
(e.g.
by pressing \f[B]C\-a\f[], \f[B]C\-s\f[], or \f[B]C\-a\f[],
\f[B]C\-r\f[]) you will be prompted for a filename.
At this prompt you can enter one or more file\-names, and any additional
arguments to the transmission or reception program.
Command\-line editing and rudimentary pathname completion are available
at this prompt, if you have compiled picocom with support for the
linenoise library.
Pressing \f[B]C\-c\f[] at this prompt will cancel the file transfer
command and return to normal picocom operation.
After entering a filename (and / or additional transmission or reception
program arguments) and assuming you have not canceled the operation by
pressing \f[B]C\-c\f[], picocom will start the external program as
specified by the \f[B]\-\-send\-cmd\f[], or \f[B]\-\-receive\-cmd\f[]
option, and with any filenames and additional arguments you may have
supplied.
The standard input and output of the external program will be connected
to the serial port.
The standard error of the external program will be connected to the
terminal which\-\-\-while the program is running\-\-\-will revert to
canonical mode.
Pressing \f[B]C\-c\f[] while the external program is running will
prematurely terminate it (assuming that the program itself does not
ignore SIGINT), and return control to picocom.
Pressing \f[B]C\-c\f[] at any other time, has no special effect; the
character is normally passed to the serial port.
.SH INPUT, OUTPUT, AND ECHO MAPPING
.PP
Using the \f[B]\-\-imap\f[], \f[B]\-\-omap\f[], and \f[B]\-\-emap\f[]
options you can make picocom map (translate, replace) certain special
characters after being read from the serial port (with
\f[B]\-\-imap\f[]), before being written to the serial port (with
\f[B]\-\-omap\f[]), and before being locally echoed to the terminal
(standard output) if local echo is enabled (with \f[B]\-\-emap\f[]).
These mapping options take, each, a single argument which is a
comma\-separated list of one or more of the following identifiers:
.IP \[bu] 2
\f[B]crlf\f[] (map CR to LF),
.IP \[bu] 2
\f[B]crcrlf\f[] (map CR to CR + LF),
.IP \[bu] 2
\f[B]igncr\f[] (ignore CR),
.IP \[bu] 2
\f[B]lfcr\f[] (map LF to CR),
.IP \[bu] 2
\f[B]lfcrlf\f[] (map LF to CR + LF),
.IP \[bu] 2
\f[B]ignlf\f[] (ignore LF),
.IP \[bu] 2
\f[B]bsdel\f[] (map BS to DEL),
.IP \[bu] 2
\f[B]delbs\f[] (map DEL to BS)
.PP
For example the command:
.IP
.nf
\f[C]
picocom\ \-\-omap\ crlf,delbs\ \-\-imap\ ignlf,bsdel\ \-\-emap\ crcrlf\ ...
\f[]
.fi
.PP
will:
.IP \[bu] 2
Replace every CR (carriage return, 0x0d) character with LF (line feed,
0x0a) and every DEL (delete, 0x7f) character with BS (backspace, 0x08)
before writing it to the serial port.
.IP \[bu] 2
Ignore (not write to the terminal) every LF character read from the
serial port, and replace every BS character read from the serial port
with DEL.
.IP \[bu] 2
Replace every CR character with CR and LF when echoing to the terminal
(if local\-echo is enabled).
.SH AUTHOR
.PP
Written by Nick Patavalis <npat@efault.net>
.SH AVAILABILITY
.PP
Download the latest release from:
<https://github.com/npat-efault/picocom/releases>
.SH COPYRIGHT
.PP
Copyright (c) 2004\-2016 Nick Patavalis
.PP
This file is part of Picocom.
.PP
Picocom is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
.PP
Picocom is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
.PP
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111\-1307 USA
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化