X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fagilent-dmm%2Fsched.c;h=d7d720d3227af38c87efc2ffb9eaf46cb4a5350d;hb=949b3dc0916eed68ba6f3878300feb61ad858014;hp=5ae73aca1824796871cd92999bf15b530113fc9d;hpb=642e9d623cebda60d53d13cf637c42eab8df3c73;p=libsigrok.git diff --git a/hardware/agilent-dmm/sched.c b/hardware/agilent-dmm/sched.c index 5ae73aca..d7d720d3 100644 --- a/hardware/agilent-dmm/sched.c +++ b/hardware/agilent-dmm/sched.c @@ -93,6 +93,8 @@ SR_PRIV int agdmm_receive_data(int fd, int revents, void *cb_data) struct dev_context *devc; int len; + (void)fd; + if (!(sdi = cb_data)) return TRUE; @@ -102,7 +104,7 @@ SR_PRIV int agdmm_receive_data(int fd, int revents, void *cb_data) if (revents == G_IO_IN) { /* Serial data arrived. */ while(AGDMM_BUFSIZE - devc->buflen - 1 > 0) { - len = serial_read(fd, devc->buf + devc->buflen, 1); + len = serial_read(devc->serial, devc->buf + devc->buflen, 1); if (len < 1) break; devc->buflen += len; @@ -117,7 +119,7 @@ SR_PRIV int agdmm_receive_data(int fd, int revents, void *cb_data) dispatch(sdi); - if (devc->num_samples >= devc->limit_samples) + if (devc->limit_samples && devc->num_samples >= devc->limit_samples) sdi->driver->dev_acquisition_stop(sdi, cb_data); return TRUE; @@ -135,7 +137,7 @@ static int agdmm_send(const struct sr_dev_inst *sdi, const char *cmd) strncat(buf, "\r\n", 32); else strncat(buf, "\n\r\n", 32); - if (serial_write(devc->serial->fd, buf, strlen(buf)) == -1) { + if (serial_write(devc->serial, buf, strlen(buf)) == -1) { sr_err("Failed to send: %s.", strerror(errno)); return SR_ERR; } @@ -241,7 +243,7 @@ static int recv_fetc(const struct sr_dev_inst *sdi, GMatchInfo *match) return SR_OK; if (!strcmp(g_match_info_get_string(match), "+9.90000000E+37")) { - /* An invalid measurement shows up on the display as "O.L, but + /* An invalid measurement shows up on the display as "O.L", but * comes through like this. Since comparing 38-digit floats * is rather problematic, we'll cut through this here. */ fvalue = NAN; @@ -261,6 +263,7 @@ static int recv_fetc(const struct sr_dev_inst *sdi, GMatchInfo *match) analog.mq = devc->cur_mq; analog.unit = devc->cur_unit; analog.mqflags = devc->cur_mqflags; + analog.probes = sdi->probes; analog.num_samples = 1; analog.data = &fvalue; packet.type = SR_DF_ANALOG;