]> sigrok.org Git - libsigrok.git/commitdiff
scpi_serial: Mark read/write calls nonblocking, remove SERIAL_NONBLOCK.
authorMartin Ling <redacted>
Sun, 21 Sep 2014 18:29:13 +0000 (19:29 +0100)
committerUwe Hermann <redacted>
Wed, 24 Sep 2014 21:30:32 +0000 (23:30 +0200)
These calls were already nonblocking. Having marked them as such, the flag can
be removed.

src/scpi/scpi_serial.c

index feb3317651eb18f2d858b576bd242e4556c1e1d0..4f6e067887c9135298b6512837cdf9f4abb33d09 100644 (file)
@@ -90,7 +90,7 @@ static int scpi_serial_open(void *priv)
        struct scpi_serial *sscpi = priv;
        struct sr_serial_dev_inst *serial = sscpi->serial;
 
-       if (serial_open(serial, SERIAL_RDWR | SERIAL_NONBLOCK) != SR_OK)
+       if (serial_open(serial, SERIAL_RDWR) != SR_OK)
                return SR_ERR;
 
        if (serial_flush(serial) != SR_OK)
@@ -130,7 +130,8 @@ static int scpi_serial_send(void *priv, const char *command)
        len = strlen(terminated_command);
        written = 0;
        while (written < len) {
-               result = serial_write(serial, terminated_command + written, len - written);
+               result = serial_write_nonblocking(serial,
+                               terminated_command + written, len - written);
                if (result < 0) {
                        sr_err("Error while sending SCPI command: '%s'.", command);
                        g_free(terminated_command);
@@ -162,7 +163,7 @@ static int scpi_serial_read_data(void *priv, char *buf, int maxlen)
 
        /* Try to read new data into the buffer if there is space. */
        if (len > 0) {
-               ret = serial_read(sscpi->serial, sscpi->buffer + sscpi->read,
+               ret = serial_read_nonblocking(sscpi->serial, sscpi->buffer + sscpi->read,
                                BUFFER_SIZE - sscpi->count);
 
                if (ret < 0)