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

57 Commits

Author SHA1 Message Date
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
e904429c1b Removed hard-coded function (command) key values from help strings.
Now function-key values are taken automatically from the respective
constants.
2015-08-18 22:52:28 +03:00
7d7edf657f Moved "generic" fd I/O functions from picocom.c to fdio.[ch] 2015-08-18 22:07:56 +03:00
0a49ae9aac Added commands [C-h] and [C-k] (show help and show keys).
Both commands do the same thing at the moment. They print a short
description of all available command keys.
2015-08-18 21:18:37 +03:00
62213f8e06 Added NO_HELP compile-time option
Enabling NO_HELP removes help-strings from picocom. This makes picocom
harder to use, and saves approximatelly 4-5Kb.
2015-08-18 20:58:37 +03:00
856a1c690d fd_readline(): Better handling of non-printable characters.
Function fd_readline() now displays non-printable and non-ascii
characters as hex codes (e.g \x12). These characters can be deleted
correctly using the [Backspace] or [DEL] key. This is applicable only
when picocom is compiled without linenoise support.
2015-08-18 20:47:30 +03:00
1ebc60b20f Do not use "/bin/sh" to run external commands.
Picocom no longer uses /bin/sh to run external commands for
file-transfer operations. Parsing the command line and spliting it into
arguments is now performed internally by picocom, using quoting rules
very similar to those of the Unix shell. Hopefully, this makes it
impossible to inject shell-commands when supplying filenames or
extra arguments to the send- and receive-file commands.
2015-08-18 14:40:48 +03:00
c04bad690e Exit if an invalid option value or an unrecognized option is given.
Previously, unlike an unrecognized option, the invalid option value was
ignored.
2015-08-18 13:25:23 +03:00
23b3b0be07 Replaced cput() macro with function to silence compiler warnings.
Recent GCC / GLIBC combinations warn you when you call write(2) without
checking its return value. Casting the function to void, doesn't help
either. See: warn_unused_result.
2015-08-18 05:21:00 +03:00
23a4288df7 Don't write(2) large chunks to the serial port.
If you define a large TTY_Q_SZ (which is quite useful for reliable
copy/paste) then write(2) would send large chucks to the tty in a single
gulp. On slow (very slow) baud rates this would make the tty fd buffers
take forever to drain on exit or when tcsetattrs() is
called. Unfortunatelly calling tcflush() doesn't really help (not on
linux, not with my serial driver).

So we limit the amount of data write(2) can send to the tty on a single
call, based on the port's baud rate (current setting baud-rate / 10
bytes, i.e. approx. one second worth of data). On my system (Linux) this
seems to be adequate: the fd does not become write-ready until most of
the data are sent through, so no huge buffers (with respect to the
baud-rate) are not accumulated and they don't take forever to drain.
2015-08-16 14:56:33 +03:00
622adaf3cf Better signal and child-process handling.
- Don't call exit(3) from signal handler. Set a flag and let loop()
  check it.

- Don't use system(3). Still uses /bin/sh to run the external
  command. This should be fixed.

- Better signal disposition preparation for child process.
2015-08-16 14:17:56 +03:00
5af6cabde6 Use memmove(3) not memcpy(3) to shift output buffer.
Sinece memcpy does *not* work correctly with overlapping moves, it
caused a bug (missing, garbled data).
2015-08-16 04:45:43 +03:00
08994c37dd Refactored and simplified send-/receive-file code. 2015-08-15 18:22:08 +03:00
96ca9260cd Minor refactor. Remove command processing code from loop() 2015-08-15 16:14:33 +03:00
94e7381fd0 Parenthesis around argument in macro cput (used in fd_readline)
Not strictly necessary, but cleaner / safer this way.
2015-08-15 14:32:53 +03:00
e2043a72ab Fixed potential bug in cput() macro (used in fd_readline)
Use of "&int" instead of "&char" as the second argument of write(2). The
bug would likely manifest on big-endian systems.
2015-08-15 14:22:21 +03:00
c239419c5f Better serial-port settings handling and reporting
- Whenever a port setting is changed (baud-rate, parity, flow-control,
  etc) by a command, the serial port attributes are re-read, and if
  different from the requested value, both values are displayed (first
  the requested, then the actual in parenthesis).

- The show-status command ([C-v]) also re-reads the actual terminal
  attributes and displays both: the requested values and the actual
  terminal settings (if they differ). This way [C-v] is able to "see"
  changes made to the port outside of picocom (or changes made from
  within picocom but silently ignored by the serial port driver---which
  happens).
2015-08-14 22:12:39 +03:00
2bd93196d3 Made DEL behave like backspace when entering filenames
DEL key now behaves like backspace when entering filenames for "send"
and "receive" commands. Applicable only if picocom is compiled without
linenoise support.
2015-08-12 01:44:24 +03:00
7144ebecc9 Allow disable of send and receive commands.
The send and receive commands can be disabled by supplying an empty
string ('') as the respective command-line option value.
2015-08-11 18:27:22 +03:00
fb98f2a99d Show compiled-in options together with usage. 2015-08-08 16:49:16 +03:00
110c15ea3c Added support for locking using flock(2) (now default)
Fixes #26
Old-style UUCP-lockdir code is maintained.
Preferred locking style is selected via the Makefile
2015-08-07 08:21:09 +03:00
208bb118e6 Input-buffer size (TTY_Q_SZ) now defined in Makefile
Fixes #20
2015-08-07 04:52:46 +03:00
aa0bccf948 Added support for more high baud rates. See issue:
http://code.google.com/p/picocom/issues/detail?id=25

This should also fix issue:
  http://code.google.com/p/picocom/issues/detail?id=17

The following baud-rates are now supported:

Standard:

  0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600,
  19200, 38400, 57600, 115200,

HIGH_BAUD:

  230400, 460800, 500000, 576000, 921600, 1000000, 1152000, 1500000,
  2000000, 2500000, 3000000, 3500000, 4000000,

Now every baudrate above 115200 is compiled-in only if the respective
macros are defined in the system header files. This should allow
picocom with HIGH_BAUD support to compile cleanly for more systems.
2015-08-06 23:42:49 +00:00
6b824ee71a - Added support for the linenoise library, which allows line-editing
and path completion when entering filenames for receive- and send-
  file operations. Support can be compiled-out if you wish. See Makefile.

- When entering a filename for receive- or send- file operations, 
  pressing C-c cancels the operation. 
  This works regardless of whether linenoise support (see above) has
  been compiled in or not

- Use debian's xmltoman to convert manual page form xml to man.
2015-08-06 20:07:40 +00:00
afcfc6829b Added O_NOCTTY when opening serial port 2012-02-21 06:40:56 +00:00
b63e54f201 Instead of select(FD_SETSIZE...) do select(tty_fd + 1...).
We know that tty_fd is the numerically largest filedes.
2012-02-21 06:30:08 +00:00
5e6893d851 Handle the case when read(tty_fd) or read(STI) fails
with EAGAIN or EWOULDBLOCK
2012-02-21 06:24:49 +00:00
fcecde9d1a Add conditionals to allow compile with UUCP_LOCK_DIR undefined 2012-02-21 05:13:24 +00:00
8f171bb8b6 Corrected typo tha caused the send command to be run instead
of the receive command when a filename was given.

(fixes issue 5)
2010-06-24 19:54:23 +00:00
0c37a3e089 Reverted changes to picocom.c applied, by mistake, in r16 2010-06-12 21:10:22 +00:00