]> sigrok.org Git - libsigrok.git/blobdiff - hardware/uni-t-ut32x/protocol.c
Add struct sr_session parameter to all session source backends.
[libsigrok.git] / hardware / uni-t-ut32x / protocol.c
index 95f512b33aa0bf880f21e0b9cdc8aea7384d1e75..65cb756bd87774dc4b275d5673710507d9654d94 100644 (file)
@@ -82,7 +82,7 @@ static void process_packet(struct sr_dev_inst *sdi)
        is_valid = TRUE;
        if (devc->packet[1] == 0x3b && devc->packet[2] == 0x3b
                        && devc->packet[3] == 0x3b && devc->packet[4] == 0x3b)
-               /* No measurement: missing probe, empty storage location, ... */
+               /* No measurement: missing channel, empty storage location, ... */
                is_valid = FALSE;
 
        temp = parse_temperature(devc->packet + 1);
@@ -109,21 +109,21 @@ static void process_packet(struct sr_dev_inst *sdi)
                }
                switch (devc->packet[13] - 0x30) {
                case 0:
-                       /* Probe T1. */
-                       analog.probes = g_slist_append(NULL, g_slist_nth_data(sdi->probes, 0));
+                       /* Channel T1. */
+                       analog.channels = g_slist_append(NULL, g_slist_nth_data(sdi->channels, 0));
                        break;
                case 1:
-                       /* Probe T2. */
-                       analog.probes = g_slist_append(NULL, g_slist_nth_data(sdi->probes, 1));
+                       /* Channel T2. */
+                       analog.channels = g_slist_append(NULL, g_slist_nth_data(sdi->channels, 1));
                        break;
                case 2:
                case 3:
-                       /* Probe T1-T2. */
-                       analog.probes = g_slist_append(NULL, g_slist_nth_data(sdi->probes, 2));
+                       /* Channel T1-T2. */
+                       analog.channels = g_slist_append(NULL, g_slist_nth_data(sdi->channels, 2));
                        analog.mqflags |= SR_MQFLAG_RELATIVE;
                        break;
                default:
-                       sr_err("Unknown probe 0x%.2x.", devc->packet[13]);
+                       sr_err("Unknown channel 0x%.2x.", devc->packet[13]);
                        is_valid = FALSE;
                }
                if (is_valid) {
@@ -132,7 +132,7 @@ static void process_packet(struct sr_dev_inst *sdi)
                        packet.type = SR_DF_ANALOG;
                        packet.payload = &analog;
                        sr_session_send(devc->cb_data, &packet);
-                       g_slist_free(analog.probes);
+                       g_slist_free(analog.channels);
                }
        }
 
@@ -198,11 +198,12 @@ SR_PRIV int uni_t_ut32x_handle_events(int fd, int revents, void *cb_data)
        struct sr_datafeed_packet packet;
        struct sr_usb_dev_inst *usb;
        struct timeval tv;
-       int len, ret, i;
+       int len, ret;
        unsigned char cmd[2];
 
        (void)fd;
        (void)revents;
+
        drvc = di->priv;
 
        if (!(sdi = cb_data))
@@ -216,8 +217,7 @@ SR_PRIV int uni_t_ut32x_handle_events(int fd, int revents, void *cb_data)
                        NULL);
 
        if (sdi->status == SR_ST_STOPPING) {
-               for (i = 0; devc->usbfd[i] != -1; i++)
-                       sr_source_remove(devc->usbfd[i]);
+               usb_source_remove(sdi->session, drvc->sr_ctx);
                packet.type = SR_DF_END;
                sr_session_send(cb_data, &packet);