Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package tio for openSUSE:Factory checked in 
at 2022-12-05 18:00:51
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/tio (Old)
 and      /work/SRC/openSUSE:Factory/.tio.new.1835 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "tio"

Mon Dec  5 18:00:51 2022 rev:11 rq:1040012 version:2.4

Changes:
--------
--- /work/SRC/openSUSE:Factory/tio/tio.changes  2022-11-16 15:43:43.879911784 
+0100
+++ /work/SRC/openSUSE:Factory/.tio.new.1835/tio.changes        2022-12-05 
18:00:54.084483644 +0100
@@ -1,0 +2,8 @@
+Sun Dec  4 14:05:17 UTC 2022 - Dirk Müller <dmuel...@suse.com>
+
+- update to 2.4:
+  * Add threaded input handling
+  * Fix so that is it possible to quit tio in tio etc.
+  * Add key command to toggle log on/off
+
+-------------------------------------------------------------------

Old:
----
  tio-2.3.tar.xz

New:
----
  tio-2.4.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ tio.spec ++++++
--- /var/tmp/diff_new_pack.2RuMQ7/_old  2022-12-05 18:00:54.632486628 +0100
+++ /var/tmp/diff_new_pack.2RuMQ7/_new  2022-12-05 18:00:54.640486672 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           tio
-Version:        2.3
+Version:        2.4
 Release:        0
 Summary:        Simple TTY terminal I/O application
 License:        GPL-2.0-or-later
@@ -25,6 +25,7 @@
 URL:            https://tio.github.io/
 Source:         
https://github.com/tio/tio/releases/download/v%{version}/%{name}-%{version}.tar.xz
 BuildRequires:  meson
+BuildRequires:  pkgconfig
 BuildRequires:  pkgconfig(inih)
 
 %description

++++++ tio-2.3.tar.xz -> tio-2.4.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/tio-2.3/NEWS new/tio-2.4/NEWS
--- old/tio-2.3/NEWS    2022-11-01 10:55:41.000000000 +0100
+++ new/tio-2.4/NEWS    2022-12-02 13:05:00.000000000 +0100
@@ -1,5 +1,32 @@
 
-=== tio v2.3 ===
+=== tio v2.4 ===
+
+
+
+Changes since tio v2.3:
+
+ * Add threaded input handling
+
+   To make tio more responsive to quit and I/O flush key command when main I/O
+   thread is blocked on output.
+
+ * Fix so that is it possible to quit tio in tio etc.
+
+   Fix regression so that it is possible to send the prefix key code to the
+   remote tio session without local tio session reacting to same key code
+   (quitting etc.).
+
+ * Add key command to toggle log on/off
+
+    Add key command 'ctrl-t f' which will toggle log on/off.
+
+    If no log filename has been specified via the 'log-filename' option then
+    tio will automatically generate a new log filename every time the log
+    feature is toggled on. Meaning, when toggled multiple times, multiple
+    log files will be generated.
+
+    However, if a log filename has been specified, tio will only write and
+    append to that same file.
 
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/tio-2.3/README.md new/tio-2.4/README.md
--- old/tio-2.3/README.md       2022-11-01 10:55:41.000000000 +0100
+++ new/tio-2.4/README.md       2022-12-02 13:05:00.000000000 +0100
@@ -178,6 +178,7 @@
 [20:19:12.040]  ctrl-t b       Send break
 [20:19:12.040]  ctrl-t c       Show configuration
 [20:19:12.040]  ctrl-t e       Toggle local echo mode
+[20:19:12.040]  ctrl-t f       Toggle log to file
 [20:19:12.040]  ctrl-t g       Toggle serial port line
 [20:19:12.040]  ctrl-t h       Toggle hexadecimal mode
 [20:19:12.040]  ctrl-t l       Clear screen
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/tio-2.3/man/tio.1.in new/tio-2.4/man/tio.1.in
--- old/tio-2.3/man/tio.1.in    2022-11-01 10:55:41.000000000 +0100
+++ new/tio-2.4/man/tio.1.in    2022-12-02 13:05:00.000000000 +0100
@@ -289,6 +289,10 @@
 Show configuration (baudrate, databits, etc.)
 .IP "\fBctrl-t e"
 Toggle local echo mode
+.IP "\fBctrl-t f"
+Toggle log to file
+.IP "\fBctrl-t F"
+Flush data I/O buffers (discard data written but not transmitted and data 
received but not read)
 .IP "\fBctrl-t g"
 Toggle serial port line
 .IP "\fBctrl-t h"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/tio-2.3/man/tio.1.txt new/tio-2.4/man/tio.1.txt
--- old/tio-2.3/man/tio.1.txt   2022-11-01 10:55:41.000000000 +0100
+++ new/tio-2.4/man/tio.1.txt   2022-12-02 13:05:00.000000000 +0100
@@ -224,6 +224,10 @@
 
        ctrl-t e        Toggle local echo mode
 
+       ctrl-t f        Toggle log to file
+
+       ctrl-t F        Flush data I/O buffers (discard data written but not 
transmitted and data received but not read)
+
        ctrl-t g        Toggle serial port line
 
        ctrl-t h        Toggle hexadecimal mode
@@ -262,7 +266,7 @@
 
        Labels can be used to group settings into named sub-configurations 
which can be activated from the command-line when starting tio.
 
-       tio will try to match the user input to a sub-configuration by name or 
by pattern to get the tty and other options.
+       tio will try to match the user input to a sub-configuration by name or 
by pattern to get the TTY device and other options.
 
        Options without any label change the default options.
 
@@ -272,7 +276,7 @@
 
        pattern                  Pattern matching user input. This pattern can 
be an extended regular expression with a single group.
 
-       tty                      tty device to open. If it contains a "%s" it 
is substituted with the first group match.
+       device                   TTY device to open. If it contains a "%s" it 
is substituted with the first group match.
 
        baudrate                 Set baud rate
 
@@ -338,7 +342,7 @@
        Named sub-configurations can be added via labels:
 
               [rpi3]
-              tty = /dev/serial/by-id/usb-FTDI_TTL232R-3V3_FTGQVXBL-if00-port0
+              device = 
/dev/serial/by-id/usb-FTDI_TTL232R-3V3_FTGQVXBL-if00-port0
               baudrate = 115200
               color = 11
 
@@ -354,7 +358,7 @@
 
               [usb device]
               pattern = usb([0-9]*)
-              tty = /dev/ttyUSB%s
+              device = /dev/ttyUSB%s
               baudrate = 115200
 
        Activate the sub-configuration by pattern match:
@@ -378,7 +382,7 @@
 
               $ tio -b 115200 -d 8 -f none -s 1 -p none /dev/ttyUSB0
 
-       It is recommended to connect serial tty devices by ID:
+       It is recommended to connect serial TTY devices by ID:
 
               $ tio /dev/serial/by-id/usb-FTDI_TTL232R-3V3_FTGQVXBL-if00-port0
 
@@ -407,11 +411,11 @@
               send -i $uart "ls -la\n"
               expect -i $uart "prompt> "
 
-       Redirect device I/O to network file socket for remote tty sharing:
+       Redirect device I/O to network file socket for remote TTY sharing:
 
               $ tio --socket inet:4444 /dev/ttyUSB0
 
-       Then, use netcat to connect to the shared tty session over network 
(assuming tio is hosted on IP 10.0.0.42):
+       Then, use netcat to connect to the shared TTY session over network 
(assuming tio is hosted on IP 10.0.0.42):
 
               $ nc -N 10.0.0.42 4444
 
@@ -439,4 +443,4 @@
 AUTHOR
        Created by Martin Lund <martin.l...@keep-it-simple.com>.
 
-tio 2.2                                                                        
                                                      2022-10-18                
                                                                                
                               tio(1)
+tio 2.4                                                                        
                                                      2022-11-02                
                                                                                
                               tio(1)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/tio-2.3/meson.build new/tio-2.4/meson.build
--- old/tio-2.3/meson.build     2022-11-01 10:55:41.000000000 +0100
+++ new/tio-2.4/meson.build     2022-12-02 13:05:00.000000000 +0100
@@ -1,12 +1,12 @@
 project('tio', 'c',
-    version : '2.3',
+    version : '2.4',
     license : [ 'GPL-2'],
     meson_version : '>= 0.53.2',
     default_options : [ 'warning_level=2', 'buildtype=release', 'c_std=gnu99' ]
 )
 
 # The tag date of the project_version(), update when the version bumps.
-version_date = '2022-10-18'
+version_date = '2022-11-02'
 
 # Test for dynamic baudrate configuration interface
 compiler = meson.get_compiler('c')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/tio-2.3/src/log.c new/tio-2.4/src/log.c
--- old/tio-2.3/src/log.c       2022-11-01 10:55:41.000000000 +0100
+++ new/tio-2.4/src/log.c       2022-12-02 13:05:00.000000000 +0100
@@ -38,9 +38,9 @@
 #define IS_ESC_END_CHAR(c)              ((c >= 0x30) && (c <= 0x7E))
 #define IS_CTRL_CHAR(c)                 ((c >= 0x00) && (c <= 0x1F))
 
-static FILE *fp;
-static bool log_error = false;
+static FILE *fp = NULL;
 static char file_buffer[BUFSIZ];
+static const char *log_filename = NULL;
 
 static char *date_time(void)
 {
@@ -56,7 +56,7 @@
     return date_time_string;
 }
 
-void log_open(const char *filename)
+int log_open(const char *filename)
 {
     static char automatic_filename[400];
 
@@ -65,19 +65,22 @@
         // Generate filename if none provided 
("tio_DEVICE_YYYY-MM-DDTHH:MM:SS.log")
         sprintf(automatic_filename, "tio_%s_%s.log", basename((char 
*)option.tty_device), date_time());
         filename = automatic_filename;
-        option.log_filename = automatic_filename;
     }
 
+    log_filename = filename;
+
     // Open log file in append write mode
     fp = fopen(filename, "a+");
     if (fp == NULL)
     {
-        log_error = true;
-        exit(EXIT_FAILURE);
+        tio_warning_printf("Could not open log file %s (%s)", filename, 
strerror(errno));
+        return -1;
     }
 
     // Enable line buffering
     setvbuf(fp, file_buffer, _IOLBF, BUFSIZ);
+
+    return 0;
 }
 
 bool log_strip(char c)
@@ -141,6 +144,11 @@
 
 void log_printf(const char *format, ...)
 {
+    if (fp == NULL)
+    {
+        return;
+    }
+
     char *line;
 
     va_list(args);
@@ -155,20 +163,22 @@
 
 void log_putc(char c)
 {
-    if (fp != NULL)
+    if (fp == NULL)
     {
-        if (option.log_strip)
-        {
-            if (!log_strip(c))
-            {
-                fputc(c, fp);
-            }
-        }
-        else
+        return;
+    }
+
+    if (option.log_strip)
+    {
+        if (!log_strip(c))
         {
             fputc(c, fp);
         }
     }
+    else
+    {
+        fputc(c, fp);
+    }
 }
 
 void log_close(void)
@@ -176,6 +186,8 @@
     if (fp != NULL)
     {
         fclose(fp);
+        fp = NULL;
+        log_filename = NULL;
     }
 }
 
@@ -183,15 +195,12 @@
 {
     if (option.log)
     {
+        tio_printf("Saved log to file %s", log_filename);
         log_close();
     }
+}
 
-    if (log_error)
-    {
-        tio_error_printf("Could not open log file %s (%s)", 
option.log_filename, strerror(errno));
-    }
-    else if (option.log)
-    {
-        tio_printf("Saved log to file %s", option.log_filename);
-    }
+const char *log_get_filename(void)
+{
+    return log_filename;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/tio-2.3/src/log.h new/tio-2.4/src/log.h
--- old/tio-2.3/src/log.h       2022-11-01 10:55:41.000000000 +0100
+++ new/tio-2.4/src/log.h       2022-12-02 13:05:00.000000000 +0100
@@ -21,8 +21,9 @@
 
 #pragma once
 
-void log_open(const char *filename);
+int log_open(const char *filename);
 void log_printf(const char *format, ...);
 void log_putc(char c);
 void log_close(void);
 void log_exit(void);
+const char * log_get_filename(void);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/tio-2.3/src/main.c new/tio-2.4/src/main.c
--- old/tio-2.3/src/main.c      2022-11-01 10:55:41.000000000 +0100
+++ new/tio-2.4/src/main.c      2022-12-02 13:05:00.000000000 +0100
@@ -120,6 +120,12 @@
         socket_configure();
     }
 
+    /* Spawn input handling into separate thread */
+    tty_input_thread_create();
+
+    /* Wait for input to be ready */
+    tty_input_thread_wait_ready();
+
     /* Connect to tty device */
     if (option.no_autoconnect)
     {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/tio-2.3/src/meson.build new/tio-2.4/src/meson.build
--- old/tio-2.3/src/meson.build 2022-11-01 10:55:41.000000000 +0100
+++ new/tio-2.4/src/meson.build 2022-12-02 13:05:00.000000000 +0100
@@ -20,9 +20,12 @@
   'alert.c'
 ]
 
-tio_dep = dependency('inih', required: true,
+tio_dep = [
+  dependency('threads', required: true),
+  dependency('inih', required: true,
                      fallback : ['libinih', 'inih_dep'],
                      default_options: ['default_library=static', 
'distro_install=false'])
+]
 
 tio_c_args = ['-Wno-unused-result']
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/tio-2.3/src/options.c new/tio-2.4/src/options.c
--- old/tio-2.3/src/options.c   2022-11-01 10:55:41.000000000 +0100
+++ new/tio-2.4/src/options.c   2022-12-02 13:05:00.000000000 +0100
@@ -38,6 +38,7 @@
 #include "rs485.h"
 #include "timestamp.h"
 #include "alert.h"
+#include "log.h"
 
 enum opt_t
 {
@@ -216,7 +217,7 @@
     if (option.map[0] != 0)
         tio_printf(" Map flags: %s", option.map);
     if (option.log)
-        tio_printf(" Log file: %s", option.log_filename);
+        tio_printf(" Log file: %s", log_get_filename());
     if (option.socket)
         tio_printf(" Socket: %s", option.socket);
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/tio-2.3/src/tty.c new/tio-2.4/src/tty.c
--- old/tio-2.3/src/tty.c       2022-11-01 10:55:41.000000000 +0100
+++ new/tio-2.4/src/tty.c       2022-12-02 13:05:00.000000000 +0100
@@ -40,6 +40,7 @@
 #include <errno.h>
 #include <time.h>
 #include <dirent.h>
+#include <pthread.h>
 #include "config.h"
 #include "configfile.h"
 #include "tty.h"
@@ -80,6 +81,8 @@
 #define KEY_B 0x62
 #define KEY_C 0x63
 #define KEY_E 0x65
+#define KEY_F 0x66
+#define KEY_SHIFT_F 0x46
 #define KEY_G 0x67
 #define KEY_H 0x68
 #define KEY_L 0x6C
@@ -133,6 +136,9 @@
 static char tty_buffer[BUFSIZ*2];
 static size_t tty_buffer_count = 0;
 static char *tty_buffer_write_ptr = tty_buffer;
+static pthread_t thread;
+static int pipefd[2];
+static pthread_mutex_t mutex_input_ready = PTHREAD_MUTEX_INITIALIZER;
 
 static void optional_local_echo(char c)
 {
@@ -255,6 +261,99 @@
     return bytes_written;
 }
 
+void *tty_stdin_input_thread(void *arg)
+{
+    UNUSED(arg);
+    char input_buffer[BUFSIZ];
+    ssize_t byte_count;
+    ssize_t bytes_written;
+
+    // Create FIFO pipe
+    if (pipe(pipefd) == -1)
+    {
+        tio_error_printf("Failed to create pipe");
+        exit(EXIT_FAILURE);
+    }
+
+    // Signal that input pipe is ready
+    pthread_mutex_unlock(&mutex_input_ready);
+
+    // Input loop for stdin
+    while (1)
+    {
+        /* Input from stdin ready */
+        byte_count = read(STDIN_FILENO, input_buffer, BUFSIZ);
+        if (byte_count < 0)
+        {
+            tio_warning_printf("Could not read from stdin (%s)", 
strerror(errno));
+        }
+        else if (byte_count == 0)
+        {
+            // Close write end to signal EOF in read end
+            close(pipefd[1]);
+            pthread_exit(0);
+        }
+
+        if (interactive_mode)
+        {
+            static char previous_char = 0;
+            char input_char;
+
+            // Process quit and flush key command
+            for (int i = 0; i<byte_count; i++)
+            {
+                input_char = input_buffer[i];
+
+                if (previous_char == option.prefix_code)
+                {
+                    switch (input_char)
+                    {
+                        case KEY_Q:
+                            exit(EXIT_FAILURE);
+                            break;
+                        case KEY_SHIFT_F:
+                            tio_printf("Flushed data I/O channels")
+                            tcflush(fd, TCIOFLUSH);
+                            break;
+                        default:
+                            break;
+                    }
+                }
+                previous_char = input_char;
+            }
+        }
+
+        // Write all bytes read to pipe
+        while (byte_count)
+        {
+            bytes_written = write(pipefd[1], input_buffer, byte_count);
+            if (bytes_written < 0)
+            {
+                tio_warning_printf("Could not write to pipe (%s)", 
strerror(errno));
+                break;
+            }
+            byte_count -= bytes_written;
+        }
+    }
+
+    pthread_exit(0);
+}
+
+void tty_input_thread_create(void)
+{
+    pthread_mutex_lock(&mutex_input_ready);
+
+    if (pthread_create(&thread, NULL, tty_stdin_input_thread, NULL) != 0) {
+        tio_error_printf("pthread_create() error");
+        exit(1);
+    }
+}
+
+void tty_input_thread_wait_ready(void)
+{
+    pthread_mutex_lock(&mutex_input_ready);
+}
+
 static void output_hex(char c)
 {
     hex_chars[hex_char_index++] = c;
@@ -348,12 +447,13 @@
     }
 }
 
-void handle_command_sequence(char input_char, char previous_char, char 
*output_char, bool *forward)
+void handle_command_sequence(char input_char, char *output_char, bool *forward)
 {
     char unused_char;
     bool unused_bool;
     int state;
     static enum line_mode_t line_mode = LINE_OFF;
+    static char previous_char = 0;
 
     /* Ignore unused arguments */
     if (output_char == NULL)
@@ -406,6 +506,16 @@
         /* Do not forward input char to output by default */
         *forward = false;
 
+        /* Handle special double prefix key input case */
+        if (input_char == option.prefix_code)
+        {
+            /* Forward prefix character to tty */
+            *output_char = option.prefix_code;
+            *forward = true;
+            previous_char = 0;
+            return;
+        }
+
         switch (input_char)
         {
             case KEY_QUESTION:
@@ -414,6 +524,8 @@
                 tio_printf(" ctrl-%c b       Send break", option.prefix_key);
                 tio_printf(" ctrl-%c c       Show configuration", 
option.prefix_key);
                 tio_printf(" ctrl-%c e       Toggle local echo mode", 
option.prefix_key);
+                tio_printf(" ctrl-%c f       Toggle log to file", 
option.prefix_key);
+                tio_printf(" ctrl-%c F       Flush data I/O buffers", 
option.prefix_key);
                 tio_printf(" ctrl-%c g       Toggle serial port line", 
option.prefix_key);
                 tio_printf(" ctrl-%c h       Toggle hexadecimal mode", 
option.prefix_key);
                 tio_printf(" ctrl-%c l       Clear screen", option.prefix_key);
@@ -443,6 +555,25 @@
                 tio_printf(" RI : %s", (state & TIOCM_RI) ? "HIGH" : "LOW");
                 break;
 
+            case KEY_F:
+                if (option.log)
+                {
+                    log_close();
+                    option.log = false;
+                }
+                else
+                {
+                    if (log_open(option.log_filename) == 0)
+                    {
+                        option.log = true;
+                    }
+                }
+                tio_printf("Switched log to file %s", option.log ? "on" : 
"off");
+                break;
+
+            case KEY_SHIFT_F:
+                break;
+
             case KEY_G:
                 tio_printf("Please enter which serial line number to toggle:");
                 tio_printf(" DTR (0)");
@@ -570,27 +701,12 @@
                 break;
 
             default:
-                /* Handle double prefix key input case */
-                if (input_char == option.prefix_code)
-                {
-                    static int count = 0;
-                    if (count++ == 1)
-                    {
-                        // Do not forward prefix characters excessively
-                        count = 0;
-                        break;
-                    }
-
-                    /* Forward prefix character to tty */
-                    *output_char = option.prefix_code;
-                    *forward = true;
-                    break;
-                }
-
                 /* Ignore unknown ctrl-t escaped keys */
                 break;
         }
     }
+
+    previous_char = input_char;
 }
 
 void stdin_restore(void)
@@ -907,7 +1023,7 @@
     int    status;
     int    maxfd;
     struct timeval tv;
-    static char input_char, previous_char = 0;
+    static char input_char;
     static bool first = true;
     static int last_errno = 0;
 
@@ -933,19 +1049,19 @@
             }
 
             FD_ZERO(&rdfs);
-            FD_SET(STDIN_FILENO, &rdfs);
-            maxfd = MAX(STDIN_FILENO, socket_add_fds(&rdfs, false));
+            FD_SET(pipefd[0], &rdfs);
+            maxfd = MAX(pipefd[0], socket_add_fds(&rdfs, false));
 
             /* Block until input becomes available or timeout */
             status = select(maxfd + 1, &rdfs, NULL, NULL, &tv);
             if (status > 0)
             {
-                if (FD_ISSET(STDIN_FILENO, &rdfs))
+                if (FD_ISSET(pipefd[0], &rdfs))
                 {
                     /* Input from stdin ready */
 
                     /* Read one character */
-                    status = read(STDIN_FILENO, &input_char, 1);
+                    status = read(pipefd[0], &input_char, 1);
                     if (status <= 0)
                     {
                         tio_error_printf("Could not read from stdin");
@@ -953,9 +1069,7 @@
                     }
 
                     /* Handle commands */
-                    handle_command_sequence(input_char, previous_char, NULL, 
NULL);
-
-                    previous_char = input_char;
+                    handle_command_sequence(input_char, NULL, NULL);
                 }
                 socket_handle_input(&rdfs, NULL);
             }
@@ -1077,7 +1191,6 @@
     int    maxfd;          /* Maximum file descriptor used */
     char   input_char, output_char;
     char   input_buffer[BUFSIZ];
-    static char previous_char = 0;
     static bool first = true;
     int    status;
     bool   next_timestamp = false;
@@ -1189,9 +1302,9 @@
         FD_SET(fd, &rdfs);
         if (!ignore_stdin)
         {
-            FD_SET(STDIN_FILENO, &rdfs);
+            FD_SET(pipefd[0], &rdfs);
         }
-        maxfd = MAX(fd, STDIN_FILENO);
+        maxfd = MAX(fd, pipefd[0]);
         maxfd = MAX(maxfd, socket_add_fds(&rdfs, true));
 
         /* Manage timeout */
@@ -1298,10 +1411,10 @@
                     }
                 }
             }
-            else if (FD_ISSET(STDIN_FILENO, &rdfs))
+            else if (FD_ISSET(pipefd[0], &rdfs))
             {
                 /* Input from stdin ready */
-                ssize_t bytes_read = read(STDIN_FILENO, input_buffer, BUFSIZ);
+                ssize_t bytes_read = read(pipefd[0], input_buffer, BUFSIZ);
                 if (bytes_read < 0)
                 {
                     tio_error_printf_silent("Could not read from stdin (%s)", 
strerror(errno));
@@ -1345,10 +1458,7 @@
                         }
 
                         /* Handle commands */
-                        handle_command_sequence(input_char, previous_char, 
&output_char, &forward);
-
-                        /* Save previous key */
-                        previous_char = input_char;
+                        handle_command_sequence(input_char, &output_char, 
&forward);
 
                         if ((option.hex_mode) && (forward))
                         {
@@ -1370,6 +1480,7 @@
             }
             else
             {
+                /* Input from socket ready */
                 forward = socket_handle_input(&rdfs, &output_char);
 
                 if (forward)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/tio-2.3/src/tty.h new/tio-2.4/src/tty.h
--- old/tio-2.3/src/tty.h       2022-11-01 10:55:41.000000000 +0100
+++ new/tio-2.4/src/tty.h       2022-12-02 13:05:00.000000000 +0100
@@ -31,3 +31,5 @@
 int tty_connect(void);
 void tty_wait_for_device(void);
 void list_serial_devices(void);
+void tty_input_thread_create(void);
+void tty_input_thread_wait_ready(void);

Reply via email to