]> git.sur5r.net Git - tio/commitdiff
New upstream version 1.29 upstream/1.29
authorJakob Haufe <sur5r@sur5r.net>
Fri, 2 Feb 2018 21:55:20 +0000 (21:55 +0000)
committerJakob Haufe <sur5r@sur5r.net>
Fri, 2 Feb 2018 21:55:20 +0000 (21:55 +0000)
12 files changed:
AUTHORS
ChangeLog
README
configure
configure.ac
man/tio.1
src/Makefile.am
src/Makefile.in
src/include/config.h.in
src/options.c
src/setspeed2.c [new file with mode: 0644]
src/tty.c

diff --git a/AUTHORS b/AUTHORS
index 68f60bbdb35554e1793ef6fb2242942f1468916a..5d60aa9fac0274f608f0cca6ce3370b6a05c4365 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -11,5 +11,7 @@ Nick Østergaard <oe.nick@gmail.com>
 Adam Borowski <kilobyte@angband.pl>
 Robert Scheck <robert@fedoraproject.org>
 Dmitri Goutnik <dg@syrec.org>
+Daniel Engberg <daniel.engberg.lists@pyret.net>
+Petr Vaněk <pv@excello.cz>
 
 Thanks to everyone who has contributed to this project.
index bd42d2d160e371f5a5615d6d0465ee9710dd5999..bff2d3c57c7e4f6969056f77752e6bc8f03debda 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,62 @@
 
-=== tio v1.26 ===
+=== tio v1.29 ===
+
+
+
+Changes since tio v1.28:
+
+ * Add mapping flags INLCRNL and ODELBS
+
+   The following new mapping flags are added:
+
+   INLCRNL: Map NL to CR-NL on input.
+   ODELBS: Map DEL to BS on output.
+
+   Flags requested and tested by Jan Ciger (janoc).
+
+
+
+Changes since tio v1.27:
+
+ * Update README
+
+ * Update AUTHORS
+
+ * Add snap status to README.md
+
+ * Add README.md to prettify GitHub page
+
+ * Add missing header
+
+Petr Vaněk:
+
+ * Add missing header file under musl-libc
+
+   Musl's inclusion tree slightly differs from glibc, therefore TCGETS2 is
+   not reachable through sys/ioctl.h, so asm/ioctls.h needs to be included
+   too.
+
+Jakub Wilk:
+
+ * Fix grammar and typos
+
+
+
+Changes since tio v1.26:
+
+ * Update man page
+
+ * Add support for setting non-standard baudrates
+
+   Support for non-standard baudrate settings will be automatically enabled
+   if the termios2 interface is detected available. However, to play it
+   safe, the old and widely supported termios interface will still be used
+   when setting standard baudrates.
+
+ * Cleanup
+
+ * Update AUTHORS
+
 
 
 Changes since tio v1.25:
@@ -11,8 +68,8 @@ Changes since tio v1.25:
 
  * Add special character map feature
 
-   Add a --map option which allows to map special characters, in particular CR and
-   NL characters which are used in various combinations on varios platforms.
+   Add a --map option which allows mapping special characters, in particular CR and
+   NL characters which are used in various combinations on various platforms.
 
  * Cleanup
 
@@ -35,7 +92,7 @@ Changes since tio v1.24:
    "Error: Could not apply new stdout settings (Invalid argument)"
 
    In case of Fedora, it turns out that the new stdout settings used are a
-   bit too agressive because an empty termios structure is used. To remedy
+   bit too aggressive because an empty termios structure is used. To remedy
    this we reuse the existing stdout settings and only reconfigure the
    specific options we need to make a "raw" stdout configuration.
 
@@ -77,6 +134,7 @@ Jakub Wilk:
  * Fix typos
 
 
+
 Changes since tio v1.21:
 
  * Update man page date
@@ -514,3 +572,4 @@ Jakub Wilk:
  * Fixed silly "tio or tio" in man page
 
  * Fixed typo
+
diff --git a/README b/README
index 0491598c9e26e1deffd85e18e6b8e1f5b9078dbc..c3b2e244179997f0705dfd482260c43060fe93f7 100644 (file)
--- a/README
+++ b/README
@@ -1,16 +1,14 @@
-################################################################################
-################# tio - a simple TTY terminal I/O application ##################
-################################################################################
+=== tio - a simple TTY terminal I/O application ===
 
 
 1. Introduction
 
-    "tio" is a simple TTY terminal application which features a straightforward
+    tio is a simple TTY terminal application which features a straightforward
     commandline interface to easily connect to TTY devices for basic
     input/output.
 
-    It was created because the author needed a simple no-nonsense TTY
-    terminal application to easily connect to various terminal TTY devices.
+    It was created because the author needed a simple no-nonsense TTY terminal
+    application to easily connect to various terminal TTY devices.
 
 
 2. Usage
 
     By default tio automatically connects to the provided device if present.
     If the device is not present, it will wait for it to appear and then
-    connect. If the connection is lost (eg. device disconnects), it will wait
-    for the device to reappear and then reconnect.
-
-    However, if the --no-autoconnect option is provided, tio will exit if the
-    device is not present or an established connection is lost.
+    connect. If the connection is lost (eg. device is unplugged), it will wait
+    for the device to reappear and then reconnect. However, if the
+    --no-autoconnect option is provided, tio will exit if the device is not
+    present or an established connection is lost.
 
     Tio features full bash autocompletion support.
 
     See the tio man page for more details.
 
 
-3. Download
-
-    The latest release tarball is available at https://tio.github.io
+3. Installation
 
+    The latest release version is available at https://tio.github.io
 
-4. Installation
+3.1 Installation using release tarball
 
-4.1 Installation from source:
+    Install steps:
 
-    $ ./configure
-    $ make
-    $ make install
+     $ ./configure
+     $ make
+     $ make install
 
     See INSTALL file for more installation details.
 
-
-4.2 Installation using package:
+3.2 Installation using package
 
     Tio comes prepackaged for various GNU/Linux distributions. Visit
     https://tio.github.io for package installation details.
 
 
-5. Contributing
+4. Contributing
 
-    Tio is open source. Any contributions (bug fixes, doc, ideas, etc.) are
+    Tio is open source. All contributions (bug fixes, doc, ideas, etc.) are
     welcome. Visit the tio GitHub page to access latest source code, create
     pull requests, add issues etc..
 
     GitHub: https://github.com/tio/tio
 
+    Also, if you find this free open source software useful please consider
+    making a donation: https://www.paypal.me/lundmar
+
 
-6. Support
+5. Support
 
     Submit bug reports via GitHub: https://github.com/tio/tio/issues
 
 
-7. Website
+6. Website
 
     Visit https://tio.github.io
 
 
-8. License
+7. License
 
     Tio is GPLv2+. See COPYING file for license details.
 
 
-9. Authors
+8. Authors
 
     Created by Martin Lund <martin.lund@keep-it-simple.com>
 
index e682972a156b7a140b56a3edd6423fe93d553048..93d59dbd3efb430063f6600a142d9438f73b9032 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for tio 1.26.
+# Generated by GNU Autoconf 2.69 for tio 1.29.
 #
 #
 # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -576,8 +576,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='tio'
 PACKAGE_TARNAME='tio'
-PACKAGE_VERSION='1.26'
-PACKAGE_STRING='tio 1.26'
+PACKAGE_VERSION='1.29'
+PACKAGE_STRING='tio 1.29'
 PACKAGE_BUGREPORT=''
 PACKAGE_URL='https://tio.github.io'
 
@@ -585,6 +585,8 @@ ac_subst_vars='am__EXEEXT_FALSE
 am__EXEEXT_TRUE
 LTLIBOBJS
 LIBOBJS
+ADD_SETSPEED2_FALSE
+ADD_SETSPEED2_TRUE
 BAUDRATE_CASES
 BAUDRATES
 ENABLE_BASH_COMPLETION_FALSE
@@ -1239,7 +1241,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures tio 1.26 to adapt to many kinds of systems.
+\`configure' configures tio 1.29 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1306,7 +1308,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of tio 1.26:";;
+     short | recursive ) echo "Configuration of tio 1.29:";;
    esac
   cat <<\_ACEOF
 
@@ -1405,7 +1407,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-tio configure 1.26
+tio configure 1.29
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1506,7 +1508,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by tio $as_me 1.26, which was
+It was created by tio $as_me 1.29, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2371,7 +2373,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='tio'
- VERSION='1.26'
+ VERSION='1.29'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -4424,6 +4426,24 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
+# Check for interface for setting arbitrary I/O speeds
+ac_fn_c_check_decl "$LINENO" "TCGETS2" "ac_cv_have_decl_TCGETS2" "#include <asm/termios.h>
+"
+if test "x$ac_cv_have_decl_TCGETS2" = xyes; then :
+
+$as_echo "#define HAVE_TERMIOS2 1" >>confdefs.h
+ have_termios2=yes
+fi
+
+ if test "x$have_termios2" == "xyes"; then
+  ADD_SETSPEED2_TRUE=
+  ADD_SETSPEED2_FALSE='#'
+else
+  ADD_SETSPEED2_TRUE='#'
+  ADD_SETSPEED2_FALSE=
+fi
+
+
 ac_config_files="$ac_config_files Makefile"
 
 ac_config_files="$ac_config_files src/Makefile"
@@ -4569,6 +4589,10 @@ if test -z "${ENABLE_BASH_COMPLETION_TRUE}" && test -z "${ENABLE_BASH_COMPLETION
   as_fn_error $? "conditional \"ENABLE_BASH_COMPLETION\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${ADD_SETSPEED2_TRUE}" && test -z "${ADD_SETSPEED2_FALSE}"; then
+  as_fn_error $? "conditional \"ADD_SETSPEED2\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 
 : "${CONFIG_STATUS=./config.status}"
 ac_write_fail=0
@@ -4966,7 +4990,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by tio $as_me 1.26, which was
+This file was extended by tio $as_me 1.29, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -5033,7 +5057,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-tio config.status 1.26
+tio config.status 1.29
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
index c030d4fc8ffb94bde2d218fc412a226cce20ab9e..78a3dae4f45d77866a572d851cccecd146c5b5e5 100644 (file)
@@ -1,5 +1,5 @@
 AC_PREREQ([2.68])
-AC_INIT([tio], [1.26], [], [tio], [https://tio.github.io])
+AC_INIT([tio], [1.29], [], [tio], [https://tio.github.io])
 AC_CONFIG_HEADERS([src/include/config.h])
 AM_INIT_AUTOMAKE([1.11 foreign dist-xz no-dist-gzip -Wall -Werror])
 AM_SILENT_RULES([yes])
@@ -84,6 +84,10 @@ TIO_CHECK_BAUDRATES(
 
 AC_DEFINE_UNQUOTED([AUTOCONF_BAUDRATE_CASES],[$BAUDRATE_CASES],[Switch cases for detected baud rates])
 
+# Check for interface for setting arbitrary I/O speeds
+AC_CHECK_DECL([TCGETS2], [AC_DEFINE([HAVE_TERMIOS2],[1],[Define if termios2 exists.]) have_termios2=yes], , [[#include <asm/termios.h>]])
+AM_CONDITIONAL([ADD_SETSPEED2],[test "x$have_termios2" == "xyes"])
+
 AC_CONFIG_FILES([Makefile])
 AC_CONFIG_FILES([src/Makefile])
 AC_CONFIG_FILES([src/bash-completion/tio])
index 4e122b96f0d4b939923c95d20acccb57b65b809d..f666ad969d0b12bd0476d2a40524c551f085da88 100644 (file)
--- a/man/tio.1
+++ b/man/tio.1
@@ -1,4 +1,4 @@
-.TH "tio" "1" "October 2017"
+.TH "tio" "1" "November 2017"
 
 .SH "NAME"
 tio \- a simple TTY terminal I/O application
@@ -39,7 +39,7 @@ Set parity (default: none).
 .TP
 .BR \-o ", " "\-\-output\-delay " \fI<ms>
 
-Set output delay [ms] inserted between each transmitted character (default: 0).
+Set output delay [ms] inserted between each sent character (default: 0).
 .TP
 .BR \-n ", " \-\-no\-autoconnect
 
@@ -62,17 +62,21 @@ Log to file.
 Map (replace, translate) special characters on input or output. The following mapping flags are supported:
 
 .RS
-.TP 8n
+.TP 12n
 .IP "\fBINLCR"
-Translate NL to CR on input.
+Map NL to CR on input.
+.IP "\fBINLCRNL"
+Map NL to CR-NL on input.
 .IP "\fBIGNCR"
-Ignore carriage return on input.
+Ignore CR on input.
 .IP "\fBICRNL"
-Translate carriage return to newline on input (unless IGNCR is set).
-.IP "\fBONLCR"
+Map CR to NL on input (unless IGNCR is set).
+.IP "\fBONLCRNL"
 Map NL to CR-NL on output.
 .IP "\fBOCRNL"
 Map CR to NL on output.
+.IP "\fBODELBS"
+Map DEL to BS on output.
 .P
 If defining more than one flag, the flags must be comma separated.
 .RE
@@ -103,7 +107,7 @@ Clear screen
 .IP "\fBctrl-t q"
 Quit
 .IP "\fBctrl-t s"
-Show statistics (total number of bytes transmitted/received)
+Show TX/RX statistics
 .IP "\fBctrl-t t"
 Send ctrl-t key code
 
@@ -117,11 +121,11 @@ Which corresponds to the commonly used options:
 
 tio \-b 115200 \-d 8 \-f none \-s 1 \-p none /dev/ttyUSB0
 .TP
-It is recommended to connect serial tty devices by id. For example:
+It is recommended to connect serial tty devices by ID. For example:
 
 tio /dev/serial/by\-id/usb\-FTDI_TTL232R-3V3_FTGQVXBL\-if00\-port0
 .PP
-Using serial devices by id ensures that tio automatically reconnects to the
+Using serial devices by ID ensures that tio automatically reconnects to the
 correct serial device if the device is disconnected and then reconnected.
 
 .SH "WEBSITE"
index b06b6d1a9c57e0c7709d0b1549ee32f1f48bbc7a..483998f9b7199544e1c686bdb74ea3b26d8babaf 100644 (file)
@@ -13,6 +13,10 @@ tio_SOURCES = tty.c \
               include/tio/log.h \
               include/tio/error.h
 
+if ADD_SETSPEED2
+tio_SOURCES += setspeed2.c
+endif
+
 if ENABLE_BASH_COMPLETION
 bashcompletiondir=@BASH_COMPLETION_DIR@
 bashcompletion_DATA=bash-completion/tio
index c688b6090b9d97837d2673b2f13d831d66f1c897..231214b2572e9d4d92d2a890c7559007c34eaa31 100644 (file)
@@ -88,6 +88,7 @@ NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
 bin_PROGRAMS = tio$(EXEEXT)
+@ADD_SETSPEED2_TRUE@am__append_1 = setspeed2.c
 subdir = src
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/configure.ac
@@ -101,8 +102,13 @@ CONFIG_CLEAN_VPATH_FILES =
 am__installdirs = "$(DESTDIR)$(bindir)" \
        "$(DESTDIR)$(bashcompletiondir)"
 PROGRAMS = $(bin_PROGRAMS)
+am__tio_SOURCES_DIST = tty.c options.c time.c main.c log.c error.c \
+       include/tio/tty.h include/tio/options.h include/tio/time.h \
+       include/tio/print.h include/tio/log.h include/tio/error.h \
+       setspeed2.c
+@ADD_SETSPEED2_TRUE@am__objects_1 = setspeed2.$(OBJEXT)
 am_tio_OBJECTS = tty.$(OBJEXT) options.$(OBJEXT) time.$(OBJEXT) \
-       main.$(OBJEXT) log.$(OBJEXT) error.$(OBJEXT)
+       main.$(OBJEXT) log.$(OBJEXT) error.$(OBJEXT) $(am__objects_1)
 tio_OBJECTS = $(am_tio_OBJECTS)
 tio_LDADD = $(LDADD)
 AM_V_P = $(am__v_P_@AM_V@)
@@ -134,7 +140,7 @@ am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
 am__v_CCLD_0 = @echo "  CCLD    " $@;
 am__v_CCLD_1 = 
 SOURCES = $(tio_SOURCES)
-DIST_SOURCES = $(tio_SOURCES)
+DIST_SOURCES = $(am__tio_SOURCES_DIST)
 am__can_run_installinfo = \
   case $$AM_UPDATE_INFO_DIR in \
     n|no|NO) false;; \
@@ -278,19 +284,10 @@ top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 AM_CFLAGS = -Wall
-tio_SOURCES = tty.c \
-              options.c \
-              time.c \
-              main.c \
-              log.c \
-              error.c \
-              include/tio/tty.h \
-              include/tio/options.h \
-              include/tio/time.h \
-              include/tio/print.h \
-              include/tio/log.h \
-              include/tio/error.h
-
+tio_SOURCES = tty.c options.c time.c main.c log.c error.c \
+       include/tio/tty.h include/tio/options.h include/tio/time.h \
+       include/tio/print.h include/tio/log.h include/tio/error.h \
+       $(am__append_1)
 @ENABLE_BASH_COMPLETION_TRUE@bashcompletiondir = @BASH_COMPLETION_DIR@
 @ENABLE_BASH_COMPLETION_TRUE@bashcompletion_DATA = bash-completion/tio
 all: all-am
@@ -383,6 +380,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/options.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setspeed2.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/time.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tty.Po@am__quote@
 
index 5e682280dfea982413635da0833ae16d45740f52..54c3fde47547bd81f98da49f644ba421a53bf106 100644 (file)
@@ -3,6 +3,9 @@
 /* Switch cases for detected baud rates */
 #undef AUTOCONF_BAUDRATE_CASES
 
+/* Define if termios2 exists. */
+#undef HAVE_TERMIOS2
+
 /* Name of package */
 #undef PACKAGE
 
index fa47f6032a585a1d11de2b5bbc87de03d9d63756..3edf05ca44a9084dd8f550b68efa30ff21549c5b 100644 (file)
@@ -51,7 +51,7 @@ struct option_t option =
 
 void print_help(char *argv[])
 {
-    printf("Usage: %s [<options>] <tty device>\n", argv[0]);
+    printf("Usage: %s [<options>] <tty-device>\n", argv[0]);
     printf("\n");
     printf("Options:\n");
     printf("  -b, --baudrate <bps>        Baud rate (default: 115200)\n");
@@ -66,6 +66,8 @@ void print_help(char *argv[])
     printf("  -v, --version               Display version\n");
     printf("  -h, --help                  Display help\n");
     printf("\n");
+    printf("See the man page for list of supported mapping flags.\n");
+    printf("\n");
     printf("In session, press ctrl-t q to quit.\n");
     printf("\n");
 }
diff --git a/src/setspeed2.c b/src/setspeed2.c
new file mode 100644 (file)
index 0000000..0adf695
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * tio - a simple TTY terminal I/O application
+ *
+ * Copyright (c) 2017  Martin Lund
+ *
+ * This program 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.
+ *
+ * This program 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.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#include <sys/ioctl.h>
+#include <asm/ioctls.h>
+#include <asm/termbits.h>
+
+int setspeed2(int fd, int baudrate)
+{
+    struct termios2 tio;
+    int status;
+
+    status = ioctl(fd, TCGETS2, &tio);
+
+    // Set baudrate speed using termios2 interface
+    tio.c_cflag &= ~CBAUD;
+    tio.c_cflag |= BOTHER;
+    tio.c_ispeed = baudrate;
+    tio.c_ospeed = baudrate;
+
+    status = ioctl(fd, TCSETS2, &tio);
+
+    return status;
+}
index 60d6c15ad117b145b65d5354030c2bf8ed01cd25..9ad4980b31026e1395af262f2d4ccb01f0827272 100644 (file)
--- a/src/tty.c
+++ b/src/tty.c
 #include "tio/log.h"
 #include "tio/error.h"
 
+#ifdef HAVE_TERMIOS2
+extern int setspeed2(int fd, int baudrate);
+#endif
+
 static struct termios tio, tio_old, stdout_new, stdout_old, stdin_new, stdin_old;
 static unsigned long rx_total = 0, tx_total = 0;
 static bool connected = false;
 static bool tainted = false;
-static int fd;
 static bool print_mode = NORMAL;
+static bool standard_baudrate = true;
 static void (*print)(char c);
+static int fd;
+static bool map_inlcrnl = false;
+static bool map_odelbs = false;
 
 #define tio_printf(format, args...) \
 { \
@@ -276,24 +283,32 @@ void tty_configure(void)
         AUTOCONF_BAUDRATE_CASES
 
         default:
+#ifdef HAVE_TERMIOS2
+            standard_baudrate = false;
+            break;
+#else
             error_printf("Invalid baud rate");
             exit(EXIT_FAILURE);
+#endif
     }
 
-    // Set input speed
-    status = cfsetispeed(&tio, baudrate);
-    if (status == -1)
+    if (standard_baudrate)
     {
-        error_printf("Could not configure input speed (%s)", strerror(errno));
-        exit(EXIT_FAILURE);
-    }
+        // Set input speed
+        status = cfsetispeed(&tio, baudrate);
+        if (status == -1)
+        {
+            error_printf("Could not configure input speed (%s)", strerror(errno));
+            exit(EXIT_FAILURE);
+        }
 
-    // Set output speed
-    cfsetospeed(&tio, baudrate);
-    if (status == -1)
-    {
-        error_printf("Could not configure output speed (%s)", strerror(errno));
-        exit(EXIT_FAILURE);
+        // Set output speed
+        cfsetospeed(&tio, baudrate);
+        if (status == -1)
+        {
+            error_printf("Could not configure output speed (%s)", strerror(errno));
+            exit(EXIT_FAILURE);
+        }
     }
 
     /* Set databits */
@@ -382,7 +397,6 @@ void tty_configure(void)
     tio.c_cc[VMIN]  = 1; // Blocking read until 1 character received
 
     /* Configure any specified input or output mappings */
-
     buffer = strdup(option.map);
     while (token_found == true)
     {
@@ -399,10 +413,14 @@ void tty_configure(void)
                 tio.c_iflag |= IGNCR;
             else if (strcmp(token,"ICRNL") == 0)
                 tio.c_iflag |= ICRNL;
-            else if (strcmp(token,"ONLCR") == 0)
+            else if (strcmp(token,"ONLCRNL") == 0)
                 tio.c_oflag |= ONLCR;
             else if (strcmp(token,"OCRNL") == 0)
                 tio.c_oflag |= OCRNL;
+            else if (strcmp(token,"ODELBS") == 0)
+                map_odelbs = true;
+            else if (strcmp(token,"INLCRNL") == 0)
+                map_inlcrnl = true;
             else
             {
                 printf("Error: Unknown mapping flag %s\n", token);
@@ -551,6 +569,17 @@ int tty_connect(void)
         goto error_tcsetattr;
     }
 
+#ifdef HAVE_TERMIOS2
+    if (!standard_baudrate)
+    {
+        if (setspeed2(fd, option.baudrate) != 0)
+        {
+            error_printf_silent("Could not set baudrate speed (%s)", strerror(errno));
+            goto error_setspeed2;
+        }
+    }
+#endif
+
     maxfd = MAX(fd, STDIN_FILENO) + 1;  /* Maximum bit entry (fd) to test */
 
     /* Input loop */
@@ -572,8 +601,16 @@ int tty_connect(void)
                     /* Update receive statistics */
                     rx_total++;
 
-                    /* Print received tty character to stdout */
-                    print(input_char);
+                    /* Map input character */
+                    if ((input_char == '\n') && (map_inlcrnl))
+                    {
+                        print('\r');
+                        print('\n');
+                    } else
+                    {
+                        /* Print received tty character to stdout */
+                        print(input_char);
+                    }
                     fflush(stdout);
 
                     /* Write to log */
@@ -611,6 +648,10 @@ int tty_connect(void)
 
                 if (forward)
                 {
+                    /* Map output character */
+                    if ((output_char == 127) && (map_odelbs))
+                        output_char = '\b';
+
                     /* Send output to tty device */
                     status = write(fd, &output_char, 1);
                     if (status < 0)
@@ -636,6 +677,9 @@ int tty_connect(void)
 
     return TIO_SUCCESS;
 
+#ifdef HAVE_TERMIOS2
+error_setspeed2:
+#endif
 error_tcsetattr:
 error_tcgetattr:
 error_read: