X-Git-Url: https://sigrok.org/gitweb/?p=sigrok-cli.git;a=blobdiff_plain;f=sigrok-cli.c;h=1b34bf5c9701ccd772ce2b696cca02e207cc9fb2;hp=1627522d27748efc18e3adb3a7d9891e0412a897;hb=bc8e240025339710ddf4f9f0827275ae9a1fe9b7;hpb=b921027525e5dbde831dfde9b0793b2afff3854d diff --git a/sigrok-cli.c b/sigrok-cli.c index 1627522..1b34bf5 100644 --- a/sigrok-cli.c +++ b/sigrok-cli.c @@ -85,8 +85,8 @@ static GOptionEntry optargs[] = { static void show_version(void) { - GSList *plugins, *p, *l; - struct sr_dev_plugin *plugin; + GSList *l; + struct sr_dev_plugin **plugins; struct sr_input_format **inputs; struct sr_output_format **outputs; struct srd_decoder *dec; @@ -96,9 +96,8 @@ static void show_version(void) printf("Supported hardware drivers:\n"); plugins = sr_hw_list(); - for (p = plugins; p; p = p->next) { - plugin = p->data; - printf(" %-20s %s\n", plugin->name, plugin->longname); + for (i = 0; plugins[i]; i++) { + printf(" %-20s %s\n", plugins[i]->name, plugins[i]->longname); } printf("\n"); @@ -178,7 +177,7 @@ static void show_dev_detail(void) struct sr_dev *dev; struct sr_hwcap_option *hwo; const struct sr_samplerates *samplerates; - int cap, *capabilities, i; + int cap, *hwcaps, i; char *s, *title; const char *charopts, **stropts; @@ -201,9 +200,9 @@ static void show_dev_detail(void) } title = "Supported options:\n"; - capabilities = dev->plugin->get_capabilities(); - for (cap = 0; capabilities[cap]; cap++) { - if (!(hwo = sr_hw_hwcap_get(capabilities[cap]))) + hwcaps = dev->plugin->hwcap_get_all(); + for (cap = 0; hwcaps[cap]; cap++) { + if (!(hwo = sr_hw_hwcap_get(hwcaps[cap]))) continue; if (title) { @@ -211,7 +210,7 @@ static void show_dev_detail(void) title = NULL; } - if (hwo->capability == SR_HWCAP_PATTERN_MODE) { + if (hwo->hwcap == SR_HWCAP_PATTERN_MODE) { printf(" %s", hwo->shortname); if (sr_dev_info_get(dev, SR_DI_PATTERNMODES, (const void **)&stropts) == SR_OK) { @@ -221,7 +220,7 @@ static void show_dev_detail(void) } else { printf("\n"); } - } else if (hwo->capability == SR_HWCAP_SAMPLERATE) { + } else if (hwo->hwcap == SR_HWCAP_SAMPLERATE) { printf(" %s", hwo->shortname); /* Supported samplerates */ if (sr_dev_info_get(dev, SR_DI_SAMPLERATES, @@ -733,7 +732,7 @@ static int set_dev_options(struct sr_dev *dev, GHashTable *args) g_hash_table_iter_init(&iter, args); while (g_hash_table_iter_next(&iter, &key, &value)) { found = FALSE; - for (i = 0; sr_hwcap_options[i].capability; i++) { + for (i = 0; sr_hwcap_options[i].hwcap; i++) { if (strcmp(sr_hwcap_options[i].shortname, key)) continue; if ((value == NULL) && @@ -747,20 +746,20 @@ static int set_dev_options(struct sr_dev *dev, GHashTable *args) ret = sr_parse_sizestring(value, &tmp_u64); if (ret != SR_OK) break; - ret = dev->plugin->set_configuration(dev->plugin_index, - sr_hwcap_options[i].capability, &tmp_u64); + ret = dev->plugin->dev_config_set(dev->plugin_index, + sr_hwcap_options[i].hwcap, &tmp_u64); break; case SR_T_CHAR: - ret = dev->plugin->set_configuration(dev->plugin_index, - sr_hwcap_options[i].capability, value); + ret = dev->plugin->dev_config_set(dev->plugin_index, + sr_hwcap_options[i].hwcap, value); break; case SR_T_BOOL: if (!value) tmp_bool = TRUE; else tmp_bool = sr_parse_boolstring(value); - ret = dev->plugin->set_configuration(dev->plugin_index, - sr_hwcap_options[i].capability, + ret = dev->plugin->dev_config_set(dev->plugin_index, + sr_hwcap_options[i].hwcap, GINT_TO_POINTER(tmp_bool)); break; default: @@ -870,8 +869,8 @@ static void run_session(void) } if (sr_hw_has_hwcap(dev->plugin, SR_HWCAP_LIMIT_MSEC)) { - if (dev->plugin->set_configuration(dev->plugin_index, - SR_HWCAP_LIMIT_MSEC, &time_msec) != SR_OK) { + if (dev->plugin->dev_config_set(dev->plugin_index, + SR_HWCAP_LIMIT_MSEC, &time_msec) != SR_OK) { printf("Failed to configure time limit.\n"); sr_session_destroy(); return; @@ -895,8 +894,8 @@ static void run_session(void) return; } - if (dev->plugin->set_configuration(dev->plugin_index, - SR_HWCAP_LIMIT_SAMPLES, &limit_samples) != SR_OK) { + if (dev->plugin->dev_config_set(dev->plugin_index, + SR_HWCAP_LIMIT_SAMPLES, &limit_samples) != SR_OK) { printf("Failed to configure time-based sample limit.\n"); sr_session_destroy(); return; @@ -906,15 +905,15 @@ static void run_session(void) if (opt_samples) { if ((sr_parse_sizestring(opt_samples, &limit_samples) != SR_OK) - || (dev->plugin->set_configuration(dev->plugin_index, - SR_HWCAP_LIMIT_SAMPLES, &limit_samples) != SR_OK)) { + || (dev->plugin->dev_config_set(dev->plugin_index, + SR_HWCAP_LIMIT_SAMPLES, &limit_samples) != SR_OK)) { printf("Failed to configure sample limit.\n"); sr_session_destroy(); return; } } - if (dev->plugin->set_configuration(dev->plugin_index, + if (dev->plugin->dev_config_set(dev->plugin_index, SR_HWCAP_PROBECONFIG, (char *)dev->probes) != SR_OK) { printf("Failed to configure probes.\n"); sr_session_destroy();