X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Funi-t-ut32x%2Fprotocol.c;h=01fa6f72d37c03e75c54a63f9c8c51648341414a;hb=1e726f568d6d72a8c6afdcd8fa98b98e910ad523;hp=1a910b3aa27b232fb84cbd4b0253c7fcfd2fd338;hpb=515ab0889ebde4b373d620044a1a98da37153056;p=libsigrok.git diff --git a/src/hardware/uni-t-ut32x/protocol.c b/src/hardware/uni-t-ut32x/protocol.c index 1a910b3a..01fa6f72 100644 --- a/src/hardware/uni-t-ut32x/protocol.c +++ b/src/hardware/uni-t-ut32x/protocol.c @@ -17,6 +17,7 @@ * along with this program. If not, see . */ +#include #include #include #include "protocol.h" @@ -61,7 +62,7 @@ static void process_packet(struct sr_dev_inst *sdi) { struct dev_context *devc; struct sr_datafeed_packet packet; - struct sr_datafeed_analog analog; + struct sr_datafeed_analog_old analog; GString *spew; float temp; int i; @@ -88,7 +89,7 @@ static void process_packet(struct sr_dev_inst *sdi) is_valid = FALSE; if (is_valid) { - memset(&analog, 0, sizeof(struct sr_datafeed_analog)); + memset(&analog, 0, sizeof(struct sr_datafeed_analog_old)); analog.mq = SR_MQ_TEMPERATURE; analog.mqflags = 0; switch (devc->packet[5] - 0x30) { @@ -127,9 +128,9 @@ static void process_packet(struct sr_dev_inst *sdi) if (is_valid) { analog.num_samples = 1; analog.data = &temp; - packet.type = SR_DF_ANALOG; + packet.type = SR_DF_ANALOG_OLD; packet.payload = &analog; - sr_session_send(devc->cb_data, &packet); + sr_session_send(sdi, &packet); g_slist_free(analog.channels); } } @@ -139,13 +140,12 @@ static void process_packet(struct sr_dev_inst *sdi) * memory slots come through as "----" measurements. */ 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); } } -SR_PRIV void uni_t_ut32x_receive_transfer(struct libusb_transfer *transfer) +SR_PRIV void LIBUSB_CALL uni_t_ut32x_receive_transfer(struct libusb_transfer *transfer) { struct dev_context *devc; struct sr_dev_inst *sdi; @@ -194,7 +194,6 @@ SR_PRIV int uni_t_ut32x_handle_events(int fd, int revents, void *cb_data) struct dev_context *devc; struct sr_dev_driver *di; struct sr_dev_inst *sdi; - struct sr_datafeed_packet packet; struct sr_usb_dev_inst *usb; struct timeval tv; int len, ret; @@ -207,7 +206,7 @@ SR_PRIV int uni_t_ut32x_handle_events(int fd, int revents, void *cb_data) return TRUE; di = sdi->driver; - drvc = di->priv; + drvc = di->context; if (!(devc = sdi->priv)) return TRUE; @@ -218,8 +217,7 @@ SR_PRIV int uni_t_ut32x_handle_events(int fd, int revents, void *cb_data) if (sdi->status == SR_ST_STOPPING) { usb_source_remove(sdi->session, drvc->sr_ctx); - packet.type = SR_DF_END; - sr_session_send(cb_data, &packet); + std_session_send_df_end(sdi, LOG_PREFIX); /* Tell the device to stop sending USB packets. */ usb = sdi->conn;