X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Ftondaj-sl-814%2Fprotocol.c;h=2830905c73968b3840c32a6b0aecfa15ce0f021e;hb=39e5d79826cd2c1991007faf1a6cde05af995aa9;hp=c164289c47cd481efb31a7a16093100e19b86043;hpb=c073af80f89d8bce8675068d084c96e0cf37bb4f;p=libsigrok.git diff --git a/hardware/tondaj-sl-814/protocol.c b/hardware/tondaj-sl-814/protocol.c index c164289c..2830905c 100644 --- a/hardware/tondaj-sl-814/protocol.c +++ b/hardware/tondaj-sl-814/protocol.c @@ -127,14 +127,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(fd, buf, 3)) < 0) { + if ((ret = serial_write(devc->serial, buf, 3)) < 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(fd, buf, 2)) < 0) { + if ((ret = serial_read(devc->serial, buf, 2)) < 0) { sr_err("Error reading init reply: %d.", ret); return FALSE; } @@ -153,7 +153,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(fd, buf, 3)) < 0) { + if ((ret = serial_write(devc->serial, buf, 3)) < 0) { sr_err("Error sending request command: %d.", ret); return FALSE; } @@ -161,7 +161,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(fd, devc->buf + devc->buflen, + ret = serial_read(devc->serial, devc->buf + devc->buflen, 4 - devc->buflen); if (ret < 0) { sr_err("Error reading packet: %d.", ret);