X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fserial-dmm%2Fprotocol.c;h=52efecb3526ad566cf2046016657f50138cdddcd;hb=50985c2019b2b5a6ce394589d89ee925b4f5e3a9;hp=cbbdcdcae75b8e2ab4b0a3baf861f06fcafaf632;hpb=3864648bb6ebf24106898a1296bc106daa55e964;p=libsigrok.git diff --git a/hardware/serial-dmm/protocol.c b/hardware/serial-dmm/protocol.c index cbbdcdca..52efecb3 100644 --- a/hardware/serial-dmm/protocol.c +++ b/hardware/serial-dmm/protocol.c @@ -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 * Copyright (C) 2012 Uwe Hermann @@ -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;