X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fagilent-dmm%2Fsched.c;h=da15e4d9a3a3dd4519a73eefaf19372938c65e38;hb=cea26f6e9f1a58f28a4b790756a2f95dcf0eaa9d;hp=339dbac6aaf11e6a995c276c663d15fafc018cba;hpb=109a3ba4137874373b249fee90055373e13a2a1a;p=libsigrok.git diff --git a/hardware/agilent-dmm/sched.c b/hardware/agilent-dmm/sched.c index 339dbac6..da15e4d9 100644 --- a/hardware/agilent-dmm/sched.c +++ b/hardware/agilent-dmm/sched.c @@ -1,5 +1,5 @@ /* - * This file is part of the sigrok project. + * This file is part of the libsigrok project. * * Copyright (C) 2012 Bert Vermeulen * @@ -91,6 +91,7 @@ SR_PRIV int agdmm_receive_data(int fd, int revents, void *cb_data) { struct sr_dev_inst *sdi; struct dev_context *devc; + struct sr_serial_dev_inst *serial; int len; (void)fd; @@ -101,10 +102,11 @@ SR_PRIV int agdmm_receive_data(int fd, int revents, void *cb_data) if (!(devc = sdi->priv)) return TRUE; + serial = sdi->conn; if (revents == G_IO_IN) { /* Serial data arrived. */ while(AGDMM_BUFSIZE - devc->buflen - 1 > 0) { - len = serial_read(devc->serial, devc->buf + devc->buflen, 1); + len = serial_read(serial, devc->buf + devc->buflen, 1); if (len < 1) break; devc->buflen += len; @@ -119,7 +121,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; @@ -127,17 +129,18 @@ SR_PRIV int agdmm_receive_data(int fd, int revents, void *cb_data) static int agdmm_send(const struct sr_dev_inst *sdi, const char *cmd) { - struct dev_context *devc; + struct sr_serial_dev_inst *serial; char buf[32]; - devc = sdi->priv; + serial = sdi->conn; + sr_spew("Sending '%s'.", cmd); strncpy(buf, cmd, 28); if (!strncmp(buf, "*IDN?", 5)) strncat(buf, "\r\n", 32); else strncat(buf, "\n\r\n", 32); - if (serial_write(devc->serial, buf, strlen(buf)) == -1) { + if (serial_write(serial, buf, strlen(buf)) == -1) { sr_err("Failed to send: %s.", strerror(errno)); return SR_ERR; } @@ -263,6 +266,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;