Commit Graph

55 Commits

Author SHA1 Message Date
Kim Woelders 50a6b600bf ttynvt version 0.15 v0.15 2022-08-10 07:25:52 +02:00
Kim Woelders 465f31ba87 Avoid some cast-qual warnings 2022-01-16 20:10:48 +01:00
Frank Rolsted Jensen 90c5387613 Clear pollin flag when input buffer is flushed
The pollin flag must be cleared when the input buffer (pty slave) is
flushed. This ensures that the POLLIN event is not signaled to the application,
when there is not data to read.
2022-01-16 19:43:37 +01:00
Frank Rolsted Jensen 6bf10a6901 Support for software flow control 2021-10-29 17:57:34 +02:00
Kim Woelders f759c0e3cc Correct termios2 baud rate calculation
Based on suggestion by joluxer <linuxer@quantentunnel.de>.
2021-06-18 17:10:22 +02:00
Kim Woelders 0606891b78 Add indent profile + formatting tweak 2021-06-18 16:17:13 +02:00
joluxer 899596fd5b Use all baudrate for traditional termios known to linux kernel 5.10. 2021-06-18 16:17:13 +02:00
joluxer a21ba0cb9c Make some variable storage bit width agnostic for transport. 2021-06-18 16:17:13 +02:00
Kim Woelders 8f03384964 print_help(): Add missing options to run in foreground
Suggested by joluxer <linuxer@quantentunnel.de>.
2021-06-18 16:17:13 +02:00
Kim Woelders b314659125 Fix potentially incorrect speed check
We don't know if tio is termios or termios2.
2021-06-18 07:21:53 +02:00
Kim Woelders 42a4e2e062 ttynvt_ioctl(): Cleanups around TCSET.. handling
Avoid nested switches and unnecessary block level.
2021-06-18 07:21:53 +02:00
Kim Woelders 0b402cdb6b Remove pointless CFLAGS_OPT
It would normally be overridden by the default automake CFLAGS="-g -O2".
2021-06-14 18:35:10 +02:00
Kim Woelders 302ed6d796 Include asm/ioctls.h for TCSETSF2 and friends
Some targets appear to need that.
2021-01-20 18:34:53 +01:00
Kim Woelders bf11b1dd15 Add support for termios2 ioctls
Based on patch by Thomas Shaddack <shaddack@shaddack.mauriceward.com>
https://www.improwis.com/projects/sw_SerialOverIP_RFC2217/
2021-01-14 07:41:43 +01:00
Kim Woelders 33de2e875c Add a couple of debug logs
From patch by Thomas Shaddack <shaddack@shaddack.mauriceward.com>
https://www.improwis.com/projects/sw_SerialOverIP_RFC2217/
2021-01-14 07:40:40 +01:00
Kim Woelders eccd32fdfb telnet_param.h: Show hex codes too
Inspired by Thomas Shaddack <shaddack@shaddack.mauriceward.com>
https://www.improwis.com/projects/sw_SerialOverIP_RFC2217/
2021-01-14 07:19:05 +01:00
Kim Woelders 089b733f27 Indent 2021-01-14 07:18:48 +01:00
Kim Woelders 41802ce7e9 Include poll.h, not sys/poll.h
... the posixly correct location.
2020-10-08 17:36:55 +02:00
Kim Woelders e51a98e4b2 Handle CRTSCTS properly 2019-09-10 06:52:00 +02:00
Kim Woelders 9db6c5d83c Move logging functions to separate file 2019-09-05 11:36:49 +02:00
Kim Woelders e3675b9e89 Move ttynvt source to src/ 2019-09-05 11:36:49 +02:00
Kim Woelders cf6b334bcc ttynvt version 0.14 v0.14 2019-03-21 08:52:05 +01:00
Kim Woelders 09e96e72f7 Add some more debug 2019-03-21 08:46:08 +01:00
Kim Woelders 688fc53caf Proper flow-control handling
Patch by FRJ.
2019-03-21 08:45:36 +01:00
Kim Woelders 4d1d6978e4 Don't clear readable flag on poll
When the slave becomes readable we set the pollin flag, and cleared it
in ttynvt_poll().
So if ttynvt_poll() is called twice, the readable flag was lost.

Now we clear it in ttynvt_read() if there actually are no more data to
be read.
2019-01-16 11:17:18 +01:00
Kim Woelders 8f03aabe30 Add timestamp when logging to stdout 2018-10-31 12:09:37 +01:00
Kim Woelders 3cad2c060d ttynvt version 0.13 v0.13 2018-10-25 11:24:45 +02:00
Kim Woelders 89f8ec8018 Reorder MCR debug printouts
More logical, IMO...
2018-10-25 11:19:46 +02:00
Kim Woelders de0845a9ce Consistently use DCD, not CD 2018-10-25 11:18:45 +02:00
Kim Woelders 732eb8da25 Refactor termios parsing for rfc2217 and debug
And show the termios on TCGETS too.
2018-10-25 11:18:45 +02:00
Kim Woelders 0f95e0779e Avoid close error on FD_MASTER after DCD drop 2018-10-25 11:18:45 +02:00
Kim Woelders 0cc9b58a65 Close master pty on DCD drop if not CLOCAL 2018-10-25 11:18:24 +02:00
Kim Woelders 314e4b1b99 Flushing ioctl fixups
- Propagate TCFLSH to slave.
- Actually send flush requests to server.
- TCIFLUSH, TCOFLUSH, and TCIOFLUSH are not ioctls but TCFLSH arguments.
- Re-enable read polls if input is flushed.
2018-10-25 07:27:21 +02:00
Kim Woelders effca015a8 Fix running on big endian
RFC2217 options with one byte values were always sent with value = 0.
2018-10-25 07:27:21 +02:00
Kim Woelders 85394b243e ttynvt version 0.12 v0.12 2018-10-17 14:53:59 +02:00
Kim Woelders 673ddd9739 Fix RFC2217 server death
We now properly kick the connected clients hanging in reads (cu) instead
of locking up.
2018-10-17 13:51:55 +02:00
Kim Woelders 1e05632ec0 Eliminate ttynvt_t::tmp_buf
ttynvt_read() and _read_net() both used this buffer which could cause
things to mess up entirely.
2018-10-17 11:15:00 +02:00
Kim Woelders 86aebe372e Add TIOCSCTTY/TIOCNOTTY name decoding 2018-10-17 08:11:46 +02:00
Kim Woelders 71de4b1ab4 Set RTS if CRTSCTS is set 2018-10-17 08:11:46 +02:00
Kim Woelders a05b17f142 Properly exit on SIGTERM
Previously we could get hung when killed, e.g. when using cu.
When using minicom or screen this problem did not seem to occur.
2018-10-17 08:11:46 +02:00
Kim Woelders ef3d01556e Properly initialize termios struct before use in ttynvt_open() 2018-10-17 08:11:46 +02:00
Kim Woelders 2fe0428d92 Use struct termios in ttynvt_t and drop static one.
Also set termios on pty slave on init.
2018-10-17 08:11:03 +02:00
Kim Woelders af3c3d4162 Always set POLLOUT on slave poll 2018-10-17 08:11:03 +02:00
Kim Woelders 540ddd5659 Fix polling of pty slave 2018-10-17 08:11:03 +02:00
Kim Woelders 6dc40e44e2 Enable debug logging data too 2018-10-17 08:11:03 +02:00
Kim Woelders 08e7fb1d7e More debug 2018-10-17 08:11:03 +02:00
Kim Woelders d85251400f Optionally print debug to stdout 2018-10-17 08:11:03 +02:00
Kim Woelders e8913f62af Logging cleanups
- Consistently use %m instead of strerror(errno)
- Add some missing \n's
2018-10-17 08:11:03 +02:00
Kim Woelders 44ddf67386 Avoid (s)size_t for portability 2018-10-17 08:11:03 +02:00
Kim Woelders 2d993212c5 Cosmetics 2018-10-17 08:11:03 +02:00