X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Ffluke-dmm%2Ffluke.c;h=848e03e545309d848a0b54094e5730201d8c8af7;hb=fdf4a1f5a0a04046ec014786b4a8fce125e1163c;hp=5b5a1151c20773f032e4b0dd1b20213bf5a31e80;hpb=69e19dd7691f86ac001469d1b319e1358e0d9778;p=libsigrok.git diff --git a/hardware/fluke-dmm/fluke.c b/hardware/fluke-dmm/fluke.c index 5b5a1151..848e03e5 100644 --- a/hardware/fluke-dmm/fluke.c +++ b/hardware/fluke-dmm/fluke.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 * @@ -35,8 +35,6 @@ static struct sr_datafeed_analog *handle_qm_18x(const struct sr_dev_inst *sdi, char *e, *u; gboolean is_oor; - (void)sdi; - if (strcmp(tokens[0], "QM") || !tokens[1]) return NULL; @@ -159,8 +157,6 @@ static struct sr_datafeed_analog *handle_qm_28x(const struct sr_dev_inst *sdi, float fvalue; char *eptr; - (void)sdi; - if (!tokens[1]) return NULL; @@ -414,12 +410,14 @@ static void handle_qm_19x_data(const struct sr_dev_inst *sdi, char **tokens) static void handle_line(const struct sr_dev_inst *sdi) { struct dev_context *devc; + struct sr_serial_dev_inst *serial; struct sr_datafeed_packet packet; struct sr_datafeed_analog *analog; int num_tokens, n, i; char cmd[16], **tokens; devc = sdi->priv; + serial = sdi->conn; sr_spew("Received line '%s' (%d).", devc->buf, devc->buflen); if (devc->buflen == 1) { @@ -456,7 +454,7 @@ static void handle_line(const struct sr_dev_inst *sdi) /* Slip the request in now, before the main * timer loop asks for metadata again. */ n = sprintf(cmd, "QM %d\r", devc->meas_type); - if (serial_write(devc->serial, cmd, n) == -1) + if (serial_write(serial, cmd, n) == -1) sr_err("Unable to send QM (measurement): %s.", strerror(errno)); } @@ -485,6 +483,7 @@ SR_PRIV int fluke_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; int64_t now, elapsed; @@ -496,10 +495,11 @@ SR_PRIV int fluke_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(FLUKEDMM_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++; @@ -524,7 +524,7 @@ SR_PRIV int fluke_receive_data(int fd, int revents, void *cb_data) * out-of-sync or temporary disconnect issues. */ if ((devc->expect_response == FALSE && elapsed > devc->profile->poll_period) || elapsed > devc->profile->timeout) { - if (serial_write(devc->serial, "QM\r", 3) == -1) + if (serial_write(serial, "QM\r", 3) == -1) sr_err("Unable to send QM: %s.", strerror(errno)); devc->cmd_sent_at = now; devc->expect_response = TRUE;