1
0
mirror of https://github.com/UzixLS/picocom.git synced 2025-07-19 07:21:18 +03:00
Commit Graph

86 Commits

Author SHA1 Message Date
1b8a19f10e Cleanup error and info messages
Also moved fd_pinfof to picocom.c and renamed it to pinfo
2017-12-21 15:58:47 +02:00
26522309a3 Added the --hangup command-line option
If given together with **--noreset**, picocom will not reset the serial
port to it's original settings on exit, but it *will* clear the modem
control lines (typically DTR and RTS) to signal a modem hangup. Without
the **--noreset** option (explicitly given, or implied by extiting with
the "Quit" command) **--hangup** has no effect (without **--noreset**
picocom always clears the modem control lines on exit, anyway).
2017-12-21 15:21:08 +02:00
637f7b375e Cleanup / refactor fd_printf and similar functions 2017-12-21 12:56:26 +02:00
89be292023 Workaround for drivers with broken flush
term_flush() does not work with some drivers. If we try to drain or even
close the port while there are still data in it's output buffers *and*
flow-control is enabled, we may block forever. So we "fake" a flush, by
temporarily setting f/c to none, waiting for any data in the output
buffer to drain, and then reseting f/c to it's original setting.
2017-12-20 09:48:00 +02:00
e6653b45b5 Do not drain the port when exiting by command
If picocom exits due to an "Exit" or "Quit" command, the contents of the
output queue (data read from the terminal but not written to the port)
are, anyway, discarded. Because of this, there is no reason to wait for
the O/S output buffer (data already written to the port but not
transmitted) to drain before exiting. The output port (output buffer) is
instead flushed (data discarded) before exiting due to a command.
2017-12-20 06:42:14 +02:00
82d69071c3 Fix HUPCL handling
Picocom will always set the HUPCL control bit of the serial port,
according to the --noreset option. If --noreset is given, then
HUPCL for the port is cleared, and will remain so after exiting
picocom. If --noreset is *not* given, then HUPCL is set for the
port, and will remain so after exiting picocom. This is true, regardless
of the way picocom terminates (command, read zero-bytes from standard
input, killed by signal, etc), and regardless of the --noinit
option. If picocom exits with the "Quit" command, then --noreset is
assumed given. Almost always this is the most DWIM behavior.

Fixes #72
2017-12-20 05:59:55 +02:00
69e16a3a70 Factor-out cleanup code from fatal() and main() 2017-12-19 22:05:42 +02:00
cb4e363fe1 Show message "Ignoring init-string..." 2017-12-19 17:30:30 +02:00
977cc7e084 Minor refactoring of KEY_QUIT handling
Now more similar with KEY_EXIT handling
2017-12-19 14:24:53 +02:00
c48f6aa78e Suppress help message if escape char is disabled 2017-12-17 22:43:54 +02:00
d1f439b38d Moved drain delay into term.c 2017-12-17 22:14:08 +02:00
2503f0ecfa Clean up error, signal, and exit handling
- Exit with failure if killed by signal
- Write fatal error messages to standard error
- Minor fixes on signal handling for children processes
2017-12-17 22:12:32 +02:00
9fbf4d1c11 Show initstring length 2017-12-16 22:29:56 +02:00
49041a2ef6 Added the --no-escape command-line option
Disables the escape character so that picocom can never enter command
mode.
2017-12-16 18:11:33 +02:00
12d46e056c Made tty output queue dynamically growable.
Closes #33
2017-12-16 17:36:43 +02:00
2ff1431827 Improved termination handling
Drain tty output buffer before exiting.
Exit whith the INT signal.
2017-12-16 14:49:46 +02:00
e9385b0ece Added the --exit command-line option
Exit picocom immediatelly after opening and configuring the serial
port. Do *not* read *anything* from the standard input or from the
serial port. If an init string is also given, picocom exits imediatelly
after sending (writing) the init string to the serial port. Again,
nothing is read from the standard input, or from the serial port. The
ouput map, the local echo option, and the local-echo map are observed
when sending the init string. The **--exit** option, overrides
the **--exit-after** option.
2017-12-16 10:51:34 +02:00
5ccc25ad94 Standard input handling
- Allow stdin to be a non-tty (print a warning, though). Some things may
  not work as expected in this case, but most will, and it's useful in
  several occasions.

- If picocom reads zero bytes from stdin, then:

  - If --exit-after is set, then keep operating (without reading from
    stdin) until the idle timeout expires, or we are killed by a signal

  - Otherwise, exit picocm, but only after transmitting the contens of
    the output queue.
2017-12-15 00:13:40 +02:00
6fdd2a3084 Added commandline option --quiet
Suppress picocom from printing initial greetings banners and other
messages not explicitly requested by the user. Command responses and
errors or warnings are still printed.
2017-12-14 18:44:44 +02:00
b744b93264 Improvements for exit-after and initstring
Treat initstring as if entered manually at the terminal.
Do not set select(1) timeout if exit-after is negative.
2017-12-14 13:59:07 +02:00
6d3066eeb8 Free initstring before exiting (being pendantic) 2017-12-14 11:43:28 +02:00
c6c753e31a Added --exit-after command-line option
Exit picocom after remaining idle for a specified time. Picocom is
considered idle if: Nothing is read (received) from the serial port,
there is nothing to write (send) to the serial port, and nothing is read
from the terminal.
2017-12-14 11:36:01 +02:00
417effcd6b Formatting 2017-12-14 10:24:00 +02:00
14c671873e Typo 2017-12-12 23:47:15 +02:00
bf9c2a49b5 Comments 2017-12-12 23:36:43 +02:00
1c06d12908 Merge pull request #65 from mgrela/master
Add option to send an initstring before dropping to the main loop
2017-12-12 21:04:18 +02:00
e0e051fd8d Whitespace 2017-12-12 20:44:20 +02:00
d8433da4b0 Add compatibility with 1.x
This allows 2.x to use the same switches as 1.x thus allowing for it to be a drop-in replacement.

This is especially useful where picocom is used from a proprietary binary.
2017-07-04 18:28:54 +10:00
a1cc4f9128 Add option to send an initstring before dropping to the main loop 2017-03-20 22:47:46 +01:00
13fd331d41 detabbing (by tab with 4) 2016-12-16 10:41:23 +01:00
b601136f56 stripped trailing whitespace 2016-12-16 10:29:20 +01:00
1f223d9863 fixed #54 "port name is limited to 127 chars" 2016-12-08 15:39:40 +01:00
7fe5400848 fixed logging of local echo 2016-12-08 15:25:36 +01:00
eca0a54492 logfile: just changed malloc() against strdup() 2016-12-08 11:16:16 +01:00
f92e8e303e added --logfile option
as discussed in https://github.com/npat-efault/picocom/issues/24
2016-12-08 10:44:07 +01:00
18468a15a8 Barf if superfluous non-opt arguments are present
Fixes issue #52
2016-12-07 00:37:04 +02:00
226913f48b added --lower-rts and --lower-dtr command line options
see also https://github.com/npat-efault/picocom/pull/47
2016-12-03 18:14:48 +01:00
5a7fab1207 Fix include for compile options display. 2016-11-14 11:13:53 -08:00
a30867c366 Add command to toggle RTS 2016-10-14 19:06:26 -06:00
98707cc8bb Amend wrong flow control usage 2016-06-12 15:42:41 -07:00
764b86ca31 Read multiple bytes from serial port
Don't read a single byte at a time from the serial port. Read
multiple (up to TTY_RD_SZ = 128) bytes with a single read(2) call. Also
write multiple bytes to the terminal (STO) with a single write(2) call.
2015-10-23 11:36:04 +03:00
c560a119e9 Command view-status (C-v) also displays modem-control-lines status. 2015-08-25 16:20:22 +03:00
d21c94eb75 Changed TCSAFLUSH to TCSANOW
In all cases the pattern was tcflush(fd, TCIOFLUSH) followed by
tcsetattr(fd, TCSAFLUSH, ...). The problem was that, for some drivers,
tcflush() was apparently doing nothing, so tcsetattr() might hang
forever waiting for the output buffers to drain (possible if flow
control is enabled). Replaced tcflush(fd, TCSAFLUSH), with tcsetattr(fd,
TCSANOW) which, after a tcflush() should anyway be equivalent.
2015-08-25 15:00:18 +03:00
679f89b498 Added command "set baudrate" (**C-b**).
Set baudrate numerically.

Also reassigned the key for the "change databits" command from **C-b**
to **C-i**.
2015-08-23 15:51:48 +03:00
8f41c3440e Changed default receive-cmd to "rz -vv -E" 2015-08-23 15:50:29 +03:00
78d6c18bcc Check if baudrate is valid, when parsing command-line arguments.
Before, every baudrate was initially accepted, and term_set() failed
when it attempted to set the baudrate.
2015-08-23 14:30:24 +03:00
fd306077d6 Added support for setting custom baud rates.
If the requested baudrate is not a custom one (i.e. does not match one
of the Bxxx macros), then the cfsetospeed_custom() and
cfsetispeed_custom() are called to configure the "nexttermios" structure
with the requested non-standard baudrate. Same thing for reading the
baudrate: If cfgetospeed() and / or cfgetispeed() return a value that is
not among the Bxxx macros, cfgetospeed_custom() and cfgetispeed_custom()
are called, to read (and decode) the non-standard baudrate from the
"nexttermios" structure.

Currently the cf[set|get][i|o]speed_custom functions are only
implemented for Linux, and work only with non-ancient kernels (>2.6). So
in effect, custom baud-rate support is currently only supported for
Linux.
2015-08-20 12:40:28 +03:00
b6208b561b Renamed "send_receive_history" stuff to just "history"
By default the history file is now named ".picocom_history".
2015-08-19 01:11:16 +03:00
c24a3bcf41 Added support for setting and changing stopbits. 2015-08-19 00:15:19 +03:00
fcc0c6eafc Use CKEY() macro to specify command-key mappings. 2015-08-18 23:18:40 +03:00