X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fcolead-slm%2Fprotocol.c;h=d14a382bae8cbcec3f9db76691ae3be8a9a915b0;hb=d00088ca6daf91270f8c2f063167eedf2644bb8f;hp=85ecc108afd07d7bf4f850f83e1a1124a4b0c9d6;hpb=a8d09e13264be77bcf1fe53202880ce4c26e39f9;p=libsigrok.git diff --git a/hardware/colead-slm/protocol.c b/hardware/colead-slm/protocol.c index 85ecc108..d14a382b 100644 --- a/hardware/colead-slm/protocol.c +++ b/hardware/colead-slm/protocol.c @@ -75,6 +75,7 @@ static void process_packet(const struct sr_dev_inst *sdi) memset(&analog, 0, sizeof(struct sr_datafeed_analog)); analog.mq = SR_MQ_SOUND_PRESSURE_LEVEL; analog.unit = SR_UNIT_DECIBEL_SPL; + analog.probes = sdi->probes; analog.num_samples = 1; analog.data = &fvalue; @@ -183,6 +184,8 @@ SR_PRIV int colead_slm_receive_data(int fd, int revents, void *cb_data) int len; char buf[128]; + (void)fd; + if (!(sdi = cb_data)) return TRUE; @@ -194,20 +197,21 @@ SR_PRIV int colead_slm_receive_data(int fd, int revents, void *cb_data) return TRUE; if (devc->state == IDLE) { - if (serial_read(fd, buf, 128) != 1 || buf[0] != 0x10) + if (serial_read(devc->serial, buf, 128) != 1 || buf[0] != 0x10) /* Nothing there, or caught the tail end of a previous packet, * or some garbage. Unless it's a single "data ready" byte, * we don't want it. */ return TRUE; /* Got 0x10, "measurement ready". */ - if (serial_write(fd, "\x20", 1) == -1) + if (serial_write(devc->serial, "\x20", 1) == -1) sr_err("unable to send command: %s", strerror(errno)); else { devc->state = COMMAND_SENT; devc->buflen = 0; } } else { - len = serial_read(fd, devc->buf + devc->buflen, 10 - devc->buflen); + len = serial_read(devc->serial, devc->buf + devc->buflen, + 10 - devc->buflen); if (len < 1) return TRUE; devc->buflen += len;