mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Revert "Added support for non-standard baud rates"
This reverts commit deec83a4ee.
Reverting because supporting non-standard or arbitrary baud rates is
troublesome because the c library provides no means of doing so and even
if bare metal linux kernel interface is used it will not work on all
Linux kernels version.
This commit is contained in:
parent
28faf082fd
commit
61655faaa8
2 changed files with 3 additions and 28 deletions
|
|
@ -87,9 +87,6 @@ TIO_CHECK_BAUDRATES(
|
|||
|
||||
AC_DEFINE_UNQUOTED([AUTOCONF_BAUDRATE_CASES],[$BAUDRATE_CASES],[Switch cases for detected baud rates])
|
||||
|
||||
# Check that it is possible to set arbitrary baud rates using BOTHER
|
||||
AC_CHECK_DECLS([BOTHER], [], [], [[#include <asm/termios.h>]])
|
||||
|
||||
AC_CONFIG_FILES([Makefile])
|
||||
AC_CONFIG_FILES([src/Makefile])
|
||||
AC_CONFIG_FILES([src/bash-completion/tio])
|
||||
|
|
|
|||
28
src/tty.c
28
src/tty.c
|
|
@ -46,13 +46,8 @@ static struct termios tio, new_stdout, old_stdout, old_tio;
|
|||
static unsigned long rx_total = 0, tx_total = 0;
|
||||
static bool connected = false;
|
||||
static bool tainted = false;
|
||||
static bool standard_baudrate = true;
|
||||
static int fd;
|
||||
|
||||
#ifndef BOTHER
|
||||
#define BOTHER 0010000
|
||||
#endif
|
||||
|
||||
#define tio_printf(format, args...) \
|
||||
{ \
|
||||
if (tainted) putchar('\n'); \
|
||||
|
|
@ -168,7 +163,7 @@ void stdout_restore(void)
|
|||
|
||||
void tty_configure(void)
|
||||
{
|
||||
speed_t baudrate = 0;
|
||||
speed_t baudrate;
|
||||
|
||||
memset(&tio, 0, sizeof(tio));
|
||||
|
||||
|
|
@ -189,25 +184,12 @@ void tty_configure(void)
|
|||
AUTOCONF_BAUDRATE_CASES
|
||||
|
||||
default:
|
||||
#if !HAVE_DECL_BOTHER
|
||||
error_printf("Invalid baud rate");
|
||||
exit(EXIT_FAILURE);
|
||||
#else
|
||||
standard_baudrate = false;
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (standard_baudrate)
|
||||
{
|
||||
cfsetispeed(&tio, baudrate);
|
||||
cfsetospeed(&tio, baudrate);
|
||||
} else
|
||||
{
|
||||
tio.c_ispeed = tio.c_ospeed = baudrate;
|
||||
tio.c_cflag &= ~CBAUD;
|
||||
tio.c_cflag |= BOTHER;
|
||||
}
|
||||
cfsetispeed(&tio, baudrate);
|
||||
cfsetospeed(&tio, baudrate);
|
||||
|
||||
/* Set databits */
|
||||
tio.c_cflag &= ~CSIZE;
|
||||
|
|
@ -399,10 +381,6 @@ int tty_connect(void)
|
|||
/* Flush stale I/O data (if any) */
|
||||
tcflush(fd, TCIOFLUSH);
|
||||
|
||||
/* Warn if non standard baud rate is used */
|
||||
if (!standard_baudrate)
|
||||
tio_printf("Warning: Using a non standard baud rate");
|
||||
|
||||
/* Print connect status */
|
||||
tio_printf("Connected");
|
||||
connected = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue