static void show_version(void)
{
- GSList *plugins, *p, *l;
- struct sr_dev_plugin *plugin;
+ GSList *l;
+ struct sr_dev_driver **drivers;
struct sr_input_format **inputs;
struct sr_output_format **outputs;
struct srd_decoder *dec;
printf("sigrok-cli %s\n\n", VERSION);
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);
+ drivers = sr_driver_list();
+ for (i = 0; drivers[i]; i++) {
+ printf(" %-20s %s\n", drivers[i]->name, drivers[i]->longname);
}
printf("\n");
}
title = "Supported options:\n";
- hwcaps = dev->plugin->hwcap_get_all();
+ hwcaps = dev->driver->hwcap_get_all();
for (cap = 0; hwcaps[cap]; cap++) {
if (!(hwo = sr_hw_hwcap_get(hwcaps[cap])))
continue;
} else {
printf(" - supported samplerates:\n");
for (i = 0; samplerates->list[i]; i++) {
- printf(" %7s\n", sr_samplerate_string(samplerates->list[i]));
+ printf(" %s\n", sr_samplerate_string(samplerates->list[i]));
}
}
} else {
return 0;
}
-void show_pd_annotation(struct srd_proto_data *pdata, void *user_data)
+void show_pd_annotation(struct srd_proto_data *pdata, void *cb_data)
{
int i;
char **annotations;
- /* 'user_data' is not used in this specific callback. */
- (void)user_data;
+ /* 'cb_data' is not used in this specific callback. */
+ (void)cb_data;
if (pdata->ann_format != 0) {
/* CLI only shows the default annotation format. */
for (i = 0; i < max_probes; i++) {
if (probelist[i]) {
- sr_dev_probe_name(dev, i + 1, probelist[i]);
+ sr_dev_probe_name_set(dev, i + 1, probelist[i]);
g_free(probelist[i]);
} else {
probe = sr_dev_probe_find(dev, i + 1);
ret = sr_parse_sizestring(value, &tmp_u64);
if (ret != SR_OK)
break;
- ret = dev->plugin->set_configuration(dev->plugin_index,
- sr_hwcap_options[i].hwcap, &tmp_u64);
+ ret = dev->driver->dev_config_set(dev->driver_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].hwcap, value);
+ ret = dev->driver->dev_config_set(dev->driver_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,
+ ret = dev->driver->dev_config_set(dev->driver_index,
sr_hwcap_options[i].hwcap,
GINT_TO_POINTER(tmp_bool));
break;
return;
if (opt_continuous) {
- if (!sr_hw_has_hwcap(dev->plugin, SR_HWCAP_CONTINUOUS)) {
+ if (!sr_driver_hwcap_exists(dev->driver, SR_HWCAP_CONTINUOUS)) {
printf("This device does not support continuous sampling.");
sr_session_destroy();
return;
return;
}
- 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 (sr_driver_hwcap_exists(dev->driver, SR_HWCAP_LIMIT_MSEC)) {
+ if (dev->driver->dev_config_set(dev->driver_index,
+ SR_HWCAP_LIMIT_MSEC, &time_msec) != SR_OK) {
printf("Failed to configure time limit.\n");
sr_session_destroy();
return;
return;
}
- if (dev->plugin->set_configuration(dev->plugin_index,
- SR_HWCAP_LIMIT_SAMPLES, &limit_samples) != SR_OK) {
+ if (dev->driver->dev_config_set(dev->driver_index,
+ SR_HWCAP_LIMIT_SAMPLES, &limit_samples) != SR_OK) {
printf("Failed to configure time-based sample limit.\n");
sr_session_destroy();
return;
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->driver->dev_config_set(dev->driver_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->driver->dev_config_set(dev->driver_index,
SR_HWCAP_PROBECONFIG, (char *)dev->probes) != SR_OK) {
printf("Failed to configure probes.\n");
sr_session_destroy();
}
static void logger(const gchar *log_domain, GLogLevelFlags log_level,
- const gchar *message, gpointer user_data)
+ const gchar *message, gpointer cb_data)
{
/* Avoid compiler warnings. */
(void)log_domain;
- (void)user_data;
+ (void)cb_data;
/*
* All messages, warnings, errors etc. go to stderr (not stdout) in