X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Ftondaj-sl-814%2Fprotocol.c;h=b27388d1839801fdd1303ec333635e121813ddeb;hb=145d794facd93b182e6c85d7613ce2e6d9a66d48;hp=feeec69aa559c7f947eacc111952aa991cc9aa2e;hpb=155b680da482cea2381becb73c51cfb838bff31e;p=libsigrok.git diff --git a/src/hardware/tondaj-sl-814/protocol.c b/src/hardware/tondaj-sl-814/protocol.c index feeec69a..b27388d1 100644 --- a/src/hardware/tondaj-sl-814/protocol.c +++ b/src/hardware/tondaj-sl-814/protocol.c @@ -133,14 +133,14 @@ 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(serial, buf, 3)) < 0) { + if ((ret = serial_write_blocking(serial, buf, 3, 0)) < 0) { sr_err("Error sending init command: %d.", ret); return FALSE; } devc->state = GET_INIT_REPLY; } else if (devc->state == GET_INIT_REPLY) { /* If we just sent the "init" command, get its reply. */ - if ((ret = serial_read(serial, buf, 2)) < 0) { + if ((ret = serial_read_blocking(serial, buf, 2, 0)) < 0) { sr_err("Error reading init reply: %d.", ret); return FALSE; } @@ -159,7 +159,7 @@ 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(serial, buf, 3)) < 0) { + if ((ret = serial_write_blocking(serial, buf, 3, 0)) < 0) { sr_err("Error sending request command: %d.", ret); return FALSE; } @@ -167,7 +167,7 @@ int tondaj_sl_814_receive_data(int fd, int revents, void *cb_data) devc->state = GET_PACKET; } else if (devc->state == GET_PACKET) { /* Read a packet from the device. */ - ret = serial_read(serial, devc->buf + devc->buflen, + ret = serial_read_nonblocking(serial, devc->buf + devc->buflen, 4 - devc->buflen); if (ret < 0) { sr_err("Error reading packet: %d.", ret);