]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/rdtech-um/api.c
rdtech-um: rephrase channel count in profile description
[libsigrok.git] / src / hardware / rdtech-um / api.c
index 3f086ae63f2a0e16518581b95bf3e1edde5f9917..ce0356e03248610b9a2c27dc3a87c37514cbab80 100644 (file)
@@ -80,8 +80,10 @@ static GSList *rdtech_um_scan(struct sr_dev_driver *di,
        sdi->inst_type = SR_INST_SERIAL;
        sdi->conn = serial;
 
-       for (ch_idx = 0; (name = p->channels[ch_idx].name); ch_idx++)
+       for (ch_idx = 0; ch_idx < p->channel_count; ch_idx++) {
+               name = p->channels[ch_idx].name;
                sr_channel_new(sdi, ch_idx, SR_CHANNEL_ANALOG, TRUE, name);
+       }
 
        devices = g_slist_append(NULL, sdi);
        serial_close(serial);
@@ -102,22 +104,10 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
 {
        const char *conn;
        const char *serialcomm;
-       GSList *l;
-       struct sr_config *src;
 
        conn = NULL;
        serialcomm = RDTECH_UM_SERIALCOMM;
-       for (l = options; l; l = l->next) {
-               src = l->data;
-               switch (src->key) {
-               case SR_CONF_CONN:
-                       conn = g_variant_get_string(src->data, NULL);
-                       break;
-               case SR_CONF_SERIALCOMM:
-                       serialcomm = g_variant_get_string(src->data, NULL);
-                       break;
-               }
-       }
+       (void)sr_serial_extract_options(options, &conn, &serialcomm);
        if (!conn)
                return NULL;