for (l = usb_devices; l; l = l->next) {
sdi = g_malloc0(sizeof(struct sr_dev_inst));
sdi->status = SR_ST_INACTIVE;
- sdi->vendor = g_strdup(VENDOR);
- sdi->model = g_strdup(MODEL);
+ sdi->vendor = g_strdup("UNI-T");
+ sdi->model = g_strdup("UT32x");
sdi->inst_type = SR_INST_USB;
sdi->conn = l->data;
for (i = 0; i < ARRAY_SIZE(channel_names); i++)
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;
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;
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;
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: