X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Funi-t-ut32x%2Fprotocol.c;h=0b4d2da2f763310f16305a4edd4593118c96d1fb;hb=b02bb45f4cf6378520e5a5b82ff39013cfa270b6;hp=0c7829f85c8d2069d04b999c6d2d34fa2f449fa3;hpb=41812aca436805b0614f2a8f31cf2f8ce494aea0;p=libsigrok.git
diff --git a/src/hardware/uni-t-ut32x/protocol.c b/src/hardware/uni-t-ut32x/protocol.c
index 0c7829f8..0b4d2da2 100644
--- a/src/hardware/uni-t-ut32x/protocol.c
+++ b/src/hardware/uni-t-ut32x/protocol.c
@@ -17,12 +17,11 @@
* along with this program. If not, see .
*/
+#include
#include
#include
#include "protocol.h"
-extern struct sr_dev_driver uni_t_ut32x_driver_info;
-
static float parse_temperature(unsigned char *buf)
{
float temp;
@@ -61,7 +60,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 +87,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 +126,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,8 +138,7 @@ 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);
}
}
@@ -194,7 +192,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;
@@ -218,8 +215,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);
/* Tell the device to stop sending USB packets. */
usb = sdi->conn;