]> sigrok.org Git - libsigrok.git/commitdiff
serial_stream_detect: Make read nonblocking.
authorMartin Ling <redacted>
Sun, 21 Sep 2014 20:26:36 +0000 (21:26 +0100)
committerUwe Hermann <redacted>
Wed, 24 Sep 2014 21:18:20 +0000 (23:18 +0200)
This code implements its own waiting based on baudrate, so the read itself
should be nonblocking. In general it will have been already, since drivers
almost universally use the SERIAL_NONBLOCK flag.

src/serial.c

index 705c52df08b504ddc1cc0651bf8cf9b56d6ef02d..4943bb106e54b1f3d87e432ecd6f48549fbc3025 100644 (file)
@@ -618,7 +618,7 @@ SR_PRIV int serial_stream_detect(struct sr_serial_dev_inst *serial,
 
        i = ibuf = len = 0;
        while (ibuf < maxlen) {
-               len = serial_read(serial, &buf[ibuf], 1);
+               len = serial_read_nonblocking(serial, &buf[ibuf], 1);
                if (len > 0) {
                        ibuf += len;
                } else if (len == 0) {