X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fserial-dmm%2Fprotocol.c;h=b98b698a8f1cb70176b04730d79aa0019fde9ccb;hb=f0ac4929d3aaa83e32b0be0637ae1f22040ea724;hp=a3f25d0eea5b3941ae57eeabc5fd94a7345706cc;hpb=f086b83011b1282f62f0058872f333aef4bf9daa;p=libsigrok.git diff --git a/hardware/serial-dmm/protocol.c b/hardware/serial-dmm/protocol.c index a3f25d0e..b98b698a 100644 --- a/hardware/serial-dmm/protocol.c +++ b/hardware/serial-dmm/protocol.c @@ -74,7 +74,8 @@ static void handle_packet(const uint8_t *buf, struct dev_context *devc, dmms[dmm].packet_parse(buf, &floatval, analog, info); analog->data = &floatval; - dmms[dmm].dmm_details(analog, info); + if (dmms[dmm].dmm_details) + dmms[dmm].dmm_details(analog, info); if (analog->mq != -1) { /* Got a measurement. */ @@ -120,6 +121,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; + int ret; (void)fd; @@ -132,6 +134,15 @@ static int receive_data(int fd, int revents, int dmm, void *info, void *cb_data) if (revents == G_IO_IN) { /* Serial data arrived. */ handle_new_data(devc, dmm, info); + } else { + /* Timeout, send another packet request (if DMM needs it). */ + if (dmms[dmm].packet_request) { + ret = dmms[dmm].packet_request(devc->serial); + if (ret < 0) { + sr_err("Failed to request packet: %d.", ret); + return FALSE; + } + } } if (devc->num_samples >= devc->limit_samples) { @@ -156,3 +167,17 @@ SR_PRIV int tekpower_tp4000zc_receive_data(int fd, int revents, void *cb_data) return receive_data(fd, revents, TEKPOWER_TP4000ZC, &info, cb_data); } + +SR_PRIV int metex_me31_receive_data(int fd, int revents, void *cb_data) +{ + struct metex14_info info; + + return receive_data(fd, revents, METEX_ME31, &info, cb_data); +} + +SR_PRIV int peaktech_3410_receive_data(int fd, int revents, void *cb_data) +{ + struct metex14_info info; + + return receive_data(fd, revents, PEAKTECH_3410, &info, cb_data); +}