]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/tondaj-sl-814/protocol.c
usb: Skip add/remove of FD on destroyed source
[libsigrok.git] / src / hardware / tondaj-sl-814 / protocol.c
index 97ab844ec3287f39bbcc20b8eddc2ea5783ec88f..44d12ec4f40866f61e477493d6c8974cac93ea26 100644 (file)
@@ -18,6 +18,7 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
+#include <config.h>
 #include <string.h>
 #include <glib.h>
 #include <libsigrok/libsigrok.h>
@@ -133,7 +134,8 @@ SR_PRIV int tondaj_sl_814_receive_data(int fd, int revents, void *cb_data)
                buf[2] = 0x0d;
                sr_spew("Sending init command: %02x %02x %02x.",
                        buf[0], buf[1], buf[2]);
-               if ((ret = serial_write_blocking(serial, buf, 3, 0)) < 0) {
+               if ((ret = serial_write_blocking(serial, buf, 3,
+                               serial_timeout(serial, 3))) < 0) {
                        sr_err("Error sending init command: %d.", ret);
                        return FALSE;
                }
@@ -159,7 +161,8 @@ SR_PRIV int tondaj_sl_814_receive_data(int fd, int revents, void *cb_data)
                buf[2] = 0x0d;
                sr_spew("Sending data request command: %02x %02x %02x.",
                        buf[0], buf[1], buf[2]);
-               if ((ret = serial_write_blocking(serial, buf, 3, 0)) < 0) {
+               if ((ret = serial_write_blocking(serial, buf, 3,
+                               serial_timeout(serial, 3))) < 0) {
                        sr_err("Error sending request command: %d.", ret);
                        return FALSE;
                }