X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fzketech-ebd-usb%2Fprotocol.c;h=4c586f6fd71989deec056a650a2abf96fb4e29a2;hb=e3c852854f9b7eea8276328cd611f44821a8db23;hp=3a7fc5467eebab1fe92281d2603981e760a3c75c;hpb=d4b3f44fa798d1cc080bf59809ae03ac3642723a;p=libsigrok.git diff --git a/src/hardware/zketech-ebd-usb/protocol.c b/src/hardware/zketech-ebd-usb/protocol.c index 3a7fc546..4c586f6f 100644 --- a/src/hardware/zketech-ebd-usb/protocol.c +++ b/src/hardware/zketech-ebd-usb/protocol.c @@ -30,7 +30,7 @@ static void log_buf(const char *message, uint8_t buf[], size_t count) buffer[count * 2] = 0; - sr_dbg("%s: %s [%lu bytes]", message, buffer, count); + sr_dbg("%s: %s [%zu bytes]", message, buffer, count); } /* Send a command to the device. */ @@ -99,6 +99,9 @@ SR_PRIV int ebd_loadstart(struct sr_serial_dev_inst *serial, struct dev_context int ret; ret = send_cmd(serial, start, 10); + if (ret) + return ret; + sr_dbg("Current limit: %f.", devc->current_limit); if (ebd_current_is0(devc)) return SR_OK; @@ -224,9 +227,7 @@ SR_PRIV int ebd_receive_data(int fd, int revents, void *cb_data) sr_dbg("Current limit %f", current_limit); /* Begin frame. */ - packet.type = SR_DF_FRAME_BEGIN; - packet.payload = NULL; - sr_session_send(sdi, &packet); + std_session_send_df_frame_begin(sdi); sr_analog_init(&analog, &encoding, &meaning, &spec, 4); @@ -257,9 +258,7 @@ SR_PRIV int ebd_receive_data(int fd, int revents, void *cb_data) g_slist_free(l); /* End frame. */ - packet.type = SR_DF_FRAME_END; - packet.payload = NULL; - sr_session_send(sdi, &packet); + std_session_send_df_frame_end(sdi); sr_sw_limits_update_samples_read(&devc->limits, 1); if (sr_sw_limits_check(&devc->limits))