X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fhardware%2Fbrymen-dmm%2Fprotocol.c;h=4db460afd63c255fcdcd7f0edeb72e5cedd27517;hb=ce19d4c6157b2998aa88a2f32670dd7bdcca02e8;hp=5fb5ec29cb4c6cbfdcb87ffeb3bcb1b485a6bf3d;hpb=1a46cc62e2b528bcaeb1f8dc0c952a81b3bcba5c;p=libsigrok.git
diff --git a/src/hardware/brymen-dmm/protocol.c b/src/hardware/brymen-dmm/protocol.c
index 5fb5ec29..4db460af 100644
--- a/src/hardware/brymen-dmm/protocol.c
+++ b/src/hardware/brymen-dmm/protocol.c
@@ -17,6 +17,7 @@
* along with this program. If not, see .
*/
+#include
#include "protocol.h"
static void handle_packet(const uint8_t *buf, struct sr_dev_inst *sdi)
@@ -24,7 +25,7 @@ static void handle_packet(const uint8_t *buf, struct sr_dev_inst *sdi)
float floatval;
struct dev_context *devc;
struct sr_datafeed_packet packet;
- struct sr_datafeed_analog analog;
+ struct sr_datafeed_analog_old analog;
devc = sdi->priv;
@@ -39,7 +40,7 @@ static void handle_packet(const uint8_t *buf, struct sr_dev_inst *sdi)
if (analog.mq != -1) {
/* Got a measurement. */
- packet.type = SR_DF_ANALOG;
+ packet.type = SR_DF_ANALOG_OLD;
packet.payload = &analog;
sr_session_send(devc->cb_data, &packet);
devc->num_samples++;
@@ -179,7 +180,9 @@ SR_PRIV int brymen_stream_detect(struct sr_serial_dev_inst *serial,
{
int64_t start, time, byte_delay_us;
size_t ibuf, i, maxlen;
- int status, len, packet_len, stream_len;
+ ssize_t len, stream_len;
+ int packet_len;
+ int status;
maxlen = *buflen;
@@ -195,7 +198,7 @@ SR_PRIV int brymen_stream_detect(struct sr_serial_dev_inst *serial,
len = serial_read_nonblocking(serial, &buf[ibuf], maxlen - ibuf);
if (len > 0) {
ibuf += len;
- sr_spew("Read %d bytes.", len);
+ sr_spew("Read %zd bytes.", len);
}
time = g_get_monotonic_time() - start;
@@ -247,14 +250,14 @@ SR_PRIV int brymen_stream_detect(struct sr_serial_dev_inst *serial,
if (time >= (int64_t)timeout_ms) {
/* Timeout */
- sr_dbg("Detection timed out after %dms.", time);
+ sr_dbg("Detection timed out after %" PRIi64 "ms.", time);
break;
}
g_usleep(byte_delay_us);
}
*buflen = ibuf;
- sr_err("Didn't find a valid packet (read %d bytes).", ibuf);
+ sr_err("Didn't find a valid packet (read %zu bytes).", ibuf);
return SR_ERR;
}