]> sigrok.org Git - libsigrok.git/blobdiff - hardware/serial-dmm/protocol.c
GPL headers: Use correct project name.
[libsigrok.git] / hardware / serial-dmm / protocol.c
index cbbdcdcae75b8e2ab4b0a3baf861f06fcafaf632..52efecb3526ad566cf2046016657f50138cdddcd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * This file is part of the sigrok project.
+ * This file is part of the libsigrok project.
  *
  * Copyright (C) 2012 Alexandru Gagniuc <mr.nuke.me@gmail.com>
  * Copyright (C) 2012 Uwe Hermann <uwe@hermann-uwe.de>
@@ -122,12 +122,14 @@ static void handle_new_data(struct sr_dev_inst *sdi, int dmm, void *info)
 {
        struct dev_context *devc;
        int len, i, offset = 0;
+       struct sr_serial_dev_inst *serial;
 
        devc = sdi->priv;
+       serial = sdi->conn;
 
        /* Try to get as much data as the buffer can hold. */
        len = DMM_BUFSIZE - devc->buflen;
-       len = serial_read(devc->serial, devc->buf + devc->buflen, len);
+       len = serial_read(serial, devc->buf + devc->buflen, len);
        if (len < 1) {
                sr_err("Serial port read error: %d.", len);
                return;
@@ -154,6 +156,7 @@ static int receive_data(int fd, int revents, int dmm, void *info, void *cb_data)
 {
        struct sr_dev_inst *sdi;
        struct dev_context *devc;
+       struct sr_serial_dev_inst *serial;
        int64_t time;
        int ret;
 
@@ -165,13 +168,15 @@ static int receive_data(int fd, int revents, int dmm, void *info, void *cb_data)
        if (!(devc = sdi->priv))
                return TRUE;
 
+       serial = sdi->conn;
+
        if (revents == G_IO_IN) {
                /* Serial data arrived. */
                handle_new_data(sdi, dmm, info);
        } else {
                /* Timeout, send another packet request (if DMM needs it). */
                if (dmms[dmm].packet_request) {
-                       ret = dmms[dmm].packet_request(devc->serial);
+                       ret = dmms[dmm].packet_request(serial);
                        if (ret < 0) {
                                sr_err("Failed to request packet: %d.", ret);
                                return FALSE;