]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/uni-t-ut32x/api.c
uni-t-ut32x: pre-set to default conn= spec
[libsigrok.git] / src / hardware / uni-t-ut32x / api.c
index a03c8ec6762eaf83871cd10bb4491106f76912bb..b49080d0b9ab7514ef3af0a9612ac70b6d102de2 100644 (file)
@@ -55,7 +55,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
 
        drvc = di->context;
 
-       conn = NULL;
+       conn = "1a86.e008";
        for (l = options; l; l = l->next) {
                src = l->data;
                switch (src->key) {
@@ -149,8 +149,8 @@ static int dev_close(struct sr_dev_inst *sdi)
        return SR_OK;
 }
 
-static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
-               const struct sr_channel_group *cg)
+static int config_get(uint32_t key, GVariant **data,
+       const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
 {
        struct dev_context *devc;
 
@@ -174,11 +174,11 @@ static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *s
        return SR_OK;
 }
 
-static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
-               const struct sr_channel_group *cg)
+static int config_set(uint32_t key, GVariant *data,
+       const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
 {
        struct dev_context *devc;
-       const char *tmp_str;
+       int idx;
 
        (void)cg;
 
@@ -189,13 +189,9 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
                devc->limit_samples = g_variant_get_uint64(data);
                break;
        case SR_CONF_DATA_SOURCE:
-               tmp_str = g_variant_get_string(data, NULL);
-               if (!strcmp(tmp_str, "Live"))
-                       devc->data_source = DATA_SOURCE_LIVE;
-               else if (!strcmp(tmp_str, "Memory"))
-                       devc->data_source = DATA_SOURCE_MEMORY;
-               else
-                       return SR_ERR;
+               if ((idx = std_str_idx(data, ARRAY_AND_SIZE(data_sources))) < 0)
+                       return SR_ERR_ARG;
+               devc->data_source = idx;
                break;
        default:
                return SR_ERR_NA;
@@ -204,8 +200,8 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
        return SR_OK;
 }
 
-static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
-               const struct sr_channel_group *cg)
+static int config_list(uint32_t key, GVariant **data,
+       const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
 {
        switch (key) {
        case SR_CONF_SCAN_OPTIONS: