]> sigrok.org Git - libserialport.git/commitdiff
Retrieve XON/XOFF setting on Unix.
authorMartin Ling <redacted>
Tue, 19 Nov 2013 20:46:52 +0000 (20:46 +0000)
committerMartin Ling <redacted>
Tue, 19 Nov 2013 20:46:52 +0000 (20:46 +0000)
serialport.c

index 9ef3cd3bd3eb8c9f701fccfda8f77c40fb8e840d..89a6e2fa92890aece4f8f9f1cbfd9512ce38e4ce 100644 (file)
@@ -704,8 +704,17 @@ static enum sp_return get_config(struct sp_port *port, struct port_data *data,
        config->dtr = (data->controlbits & TIOCM_DTR) ? SP_DTR_ON : SP_DTR_OFF;
        config->dsr = SP_DSR_IGNORE;
 
-       /* FIXME: Set config->xon_xoff properly, depending on data->term. */
-       config->xon_xoff = SP_XONXOFF_DISABLED;
+       if (data->term.c_iflag & IXOFF) {
+               if (data->term.c_iflag & IXON)
+                       config->xon_xoff = SP_XONXOFF_INOUT;
+               else
+                       config->xon_xoff = SP_XONXOFF_IN;
+       } else {
+               if (data->term.c_iflag & IXON)
+                       config->xon_xoff = SP_XONXOFF_OUT;
+               else
+                       config->xon_xoff = SP_XONXOFF_DISABLED;
+       }
 #endif
 
        return SP_OK;