X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fzketech-ebd-usb%2Fprotocol.c;h=4c586f6fd71989deec056a650a2abf96fb4e29a2;hb=4da62209ddfa3aad12678c7141c19e9c3e8419c1;hp=be4aa285e2bad66ff0fff9e6c5e2515a46b2024b;hpb=330a32b240ffe7702ab41d5b736b92cb39cf693d;p=libsigrok.git diff --git a/src/hardware/zketech-ebd-usb/protocol.c b/src/hardware/zketech-ebd-usb/protocol.c index be4aa285..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. */ @@ -44,7 +44,6 @@ static int send_cmd(struct sr_serial_dev_inst *serial, uint8_t buf[], size_t cou sr_err("Error sending command: %d.", ret); return ret; } - sr_dbg("Sent %d bytes.", ret); return (ret == (int)count) ? SR_OK : SR_ERR; } @@ -100,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; @@ -225,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); @@ -258,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))