X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fkecheng-kc-330b%2Fprotocol.c;h=968ef6968872f86e46b074483d56f122a5a83097;hb=b02bb45f4cf6378520e5a5b82ff39013cfa270b6;hp=bcc6846988c6a6856503f1ebeee9084b0e09fe33;hpb=3be42bc22f8b36599a448273c12a76d3e0f7a940;p=libsigrok.git diff --git a/src/hardware/kecheng-kc-330b/protocol.c b/src/hardware/kecheng-kc-330b/protocol.c index bcc68469..968ef696 100644 --- a/src/hardware/kecheng-kc-330b/protocol.c +++ b/src/hardware/kecheng-kc-330b/protocol.c @@ -20,8 +20,6 @@ #include #include #include "protocol.h" - -extern struct sr_dev_driver kecheng_kc_330b_driver_info; extern const uint64_t kecheng_kc_330b_sample_intervals[][2]; SR_PRIV int kecheng_kc_330b_handle_events(int fd, int revents, void *cb_data) @@ -53,7 +51,7 @@ SR_PRIV int kecheng_kc_330b_handle_events(int fd, int revents, void *cb_data) if (sdi->status == SR_ST_STOPPING) { libusb_free_transfer(devc->xfer); usb_source_remove(sdi->session, drvc->sr_ctx); - std_session_send_df_end(cb_data, LOG_PREFIX); + std_session_send_df_end(sdi); sdi->status = SR_ST_ACTIVE; return TRUE; } @@ -69,8 +67,7 @@ SR_PRIV int kecheng_kc_330b_handle_events(int fd, int revents, void *cb_data) if (ret != 0 || len != 1) { sr_dbg("Failed to request new acquisition: %s", libusb_error_name(ret)); - sdi->driver->dev_acquisition_stop((struct sr_dev_inst *)sdi, - devc->cb_data); + sdi->driver->dev_acquisition_stop(sdi); return TRUE; } libusb_submit_transfer(devc->xfer); @@ -91,8 +88,7 @@ SR_PRIV int kecheng_kc_330b_handle_events(int fd, int revents, void *cb_data) if (ret != 0 || len != 4) { sr_dbg("Failed to request next chunk: %s", libusb_error_name(ret)); - sdi->driver->dev_acquisition_stop((struct sr_dev_inst *)sdi, - devc->cb_data); + sdi->driver->dev_acquisition_stop(sdi); return TRUE; } libusb_submit_transfer(devc->xfer); @@ -119,8 +115,7 @@ static void send_data(const struct sr_dev_inst *sdi, void *buf, unsigned int buf analog.data = buf; packet.type = SR_DF_ANALOG_OLD; packet.payload = &analog; - sr_session_send(devc->cb_data, &packet); - + sr_session_send(sdi, &packet); } SR_PRIV void LIBUSB_CALL kecheng_kc_330b_receive_transfer(struct libusb_transfer *transfer) @@ -137,8 +132,7 @@ SR_PRIV void LIBUSB_CALL kecheng_kc_330b_receive_transfer(struct libusb_transfer switch (transfer->status) { case LIBUSB_TRANSFER_NO_DEVICE: /* USB device was unplugged. */ - sdi->driver->dev_acquisition_stop((struct sr_dev_inst *)sdi, - devc->cb_data); + sdi->driver->dev_acquisition_stop(sdi); return; case LIBUSB_TRANSFER_COMPLETED: case LIBUSB_TRANSFER_TIMED_OUT: /* We may have received some data though */ @@ -159,8 +153,7 @@ SR_PRIV void LIBUSB_CALL kecheng_kc_330b_receive_transfer(struct libusb_transfer send_data(sdi, fvalue, 1); devc->num_samples++; if (devc->limit_samples && devc->num_samples >= devc->limit_samples) { - sdi->driver->dev_acquisition_stop((struct sr_dev_inst *)sdi, - devc->cb_data); + sdi->driver->dev_acquisition_stop(sdi); } else { /* let USB event handler fire off another * request when the time is right. */ @@ -180,8 +173,7 @@ SR_PRIV void LIBUSB_CALL kecheng_kc_330b_receive_transfer(struct libusb_transfer send_data(sdi, fvalue, 1); devc->num_samples += num_samples; if (devc->num_samples >= devc->stored_samples) { - sdi->driver->dev_acquisition_stop((struct sr_dev_inst *)sdi, - devc->cb_data); + sdi->driver->dev_acquisition_stop(sdi); } else { /* let USB event handler fire off another * request when the time is right. */