X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fhardware%2Fasix-omega-rtm-cli%2Fapi.c;h=60c3bfeac90954982e10a10b574613e69f89296e;hb=c18f4891912718a8fea61eb1ea98c86b99995bd3;hp=71e922543f1a4c453233f6b9cc3d78cfc2342f45;hpb=ba42283a3c35f4d6579de66865cbeb476f9ab575;p=libsigrok.git diff --git a/src/hardware/asix-omega-rtm-cli/api.c b/src/hardware/asix-omega-rtm-cli/api.c index 71e92254..60c3bfea 100644 --- a/src/hardware/asix-omega-rtm-cli/api.c +++ b/src/hardware/asix-omega-rtm-cli/api.c @@ -126,9 +126,10 @@ static const uint32_t devopts[] = { static GSList *scan(struct sr_dev_driver *di, GSList *options) { - const char *conn, *serno, *exe; - GSList *devices; - size_t argc, chidx; + const char *conn, *probe_names, *serno, *exe; + GSList *devices, *l; + struct sr_config *src; + size_t argc, chmax, chidx; gchar **argv, *output, *vers_text, *eol; GSpawnFlags flags; GError *error; @@ -139,9 +140,18 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) /* Extract optional serial number from conn= spec. */ conn = NULL; + probe_names = NULL; (void)sr_serial_extract_options(options, &conn, NULL); if (!conn || !*conn) conn = NULL; + for (l = options; l; l = l->next) { + src = l->data; + switch (src->key) { + case SR_CONF_PROBE_NAMES: + probe_names = g_variant_get_string(src->data, NULL); + break; + } + } serno = NULL; if (conn) { if (!g_str_has_prefix(conn, "sn=")) { @@ -242,13 +252,16 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) sdi->serial_num = g_strdup(serno); if (conn) sdi->connection_id = g_strdup(conn); - for (chidx = 0; chidx < ARRAY_SIZE(channel_names); chidx++) { + devc = g_malloc0(sizeof(*devc)); + sdi->priv = devc; + devc->channel_names = sr_parse_probe_names(probe_names, + channel_names, ARRAY_SIZE(channel_names), + ARRAY_SIZE(channel_names), &chmax); + for (chidx = 0; chidx < chmax; chidx++) { sr_channel_new(sdi, chidx, SR_CHANNEL_LOGIC, - TRUE, channel_names[chidx]); + TRUE, devc->channel_names[chidx]); } - devc = g_malloc0(sizeof(*devc)); - sdi->priv = devc; sr_sw_limits_init(&devc->limits); argc = 1; g_free(argv[argc]);