static gchar *opt_pds = NULL;
static gchar *opt_pd_stack = NULL;
static gchar *opt_input_format = NULL;
-static gchar *opt_format = NULL;
+static gchar *opt_output_format = NULL;
static gchar *opt_time = NULL;
static gchar *opt_samples = NULL;
static gchar *opt_continuous = NULL;
static GOptionEntry optargs[] = {
{"version", 'V', 0, G_OPTION_ARG_NONE, &opt_version, "Show version and support list", NULL},
- {"loglevel", 'l', 0, G_OPTION_ARG_INT, &opt_loglevel, "Select libsigrok loglevel", NULL},
- {"list-devices", 'D', 0, G_OPTION_ARG_NONE, &opt_list_devs, "List devices", NULL},
+ {"loglevel", 'l', 0, G_OPTION_ARG_INT, &opt_loglevel, "Select libsigrok/libsigrokdecode loglevel", NULL},
+ {"list-devices", 'D', 0, G_OPTION_ARG_NONE, &opt_list_devs, "Scan for devices", NULL},
+ {"device", 'd', 0, G_OPTION_ARG_STRING, &opt_dev, "Use specified device", NULL},
{"input-file", 'i', 0, G_OPTION_ARG_FILENAME, &opt_input_file, "Load input from file", NULL},
+ {"input-format", 'I', 0, G_OPTION_ARG_STRING, &opt_input_format, "Input format", NULL},
{"output-file", 'o', 0, G_OPTION_ARG_FILENAME, &opt_output_file, "Save output to file", NULL},
- {"device", 'd', 0, G_OPTION_ARG_STRING, &opt_dev, "Use device ID", NULL},
+ {"output-format", 'O', 0, G_OPTION_ARG_STRING, &opt_output_format, "Output format", NULL},
{"probes", 'p', 0, G_OPTION_ARG_STRING, &opt_probes, "Probes to use", NULL},
{"triggers", 't', 0, G_OPTION_ARG_STRING, &opt_triggers, "Trigger configuration", NULL},
{"wait-trigger", 'w', 0, G_OPTION_ARG_NONE, &opt_wait_trigger, "Wait for trigger", NULL},
- {"protocol-decoders", 'a', 0, G_OPTION_ARG_STRING, &opt_pds, "Protocol decoder sequence", NULL},
+ {"protocol-decoders", 'a', 0, G_OPTION_ARG_STRING, &opt_pds, "Protocol decoders to run", NULL},
{"protocol-decoder-stack", 's', 0, G_OPTION_ARG_STRING, &opt_pd_stack, "Protocol decoder stack", NULL},
- {"input-format", 'I', 0, G_OPTION_ARG_STRING, &opt_input_format, "Input format", NULL},
- {"format", 'f', 0, G_OPTION_ARG_STRING, &opt_format, "Output format", NULL},
{"time", 0, 0, G_OPTION_ARG_STRING, &opt_time, "How long to sample (ms)", NULL},
{"samples", 0, 0, G_OPTION_ARG_STRING, &opt_samples, "Number of samples to acquire", NULL},
{"continuous", 0, 0, G_OPTION_ARG_NONE, &opt_continuous, "Sample continuously", NULL},
printf("sigrok-cli %s\n\n", VERSION);
printf("Supported hardware drivers:\n");
- drivers = sr_hw_list();
+ drivers = sr_driver_list();
for (i = 0; drivers[i]; i++) {
printf(" %-20s %s\n", drivers[i]->name, drivers[i]->longname);
}
if (srd_init(NULL) == SRD_OK) {
printf("Supported protocol decoders:\n");
- srd_decoders_load_all();
- for (l = srd_decoders_list(); l; l = l->next) {
+ srd_decoder_load_all();
+ for (l = srd_decoder_list(); l; l = l->next) {
dec = l->data;
printf(" %-20s %s\n", dec->id, dec->longname);
}
if (hwo->hwcap == SR_HWCAP_PATTERN_MODE) {
printf(" %s", hwo->shortname);
- if (sr_dev_info_get(dev, SR_DI_PATTERNMODES,
+ if (sr_dev_info_get(dev, SR_DI_PATTERNS,
(const void **)&stropts) == SR_OK) {
- printf(" - supported modes:\n");
+ printf(" - supported patterns:\n");
for (i = 0; stropts[i]; i++)
printf(" %s\n", stropts[i]);
} else {
}
} else {
/* saving to a file in whatever format was set
- * with --format, so all we need is a filehandle */
+ * with -O, so all we need is a filehandle */
outfile = g_fopen(opt_output_file, "wb");
}
}
goto cleanup;
if (opt_pds) {
- if (srd_session_feed(received_samples, (uint8_t*)filter_out,
+ if (srd_session_send(received_samples, (uint8_t*)filter_out,
filter_out_len) != SRD_OK)
sr_session_halt();
} 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. */
return;
if (opt_continuous) {
- if (!sr_hw_has_hwcap(dev->driver, 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->driver, SR_HWCAP_LIMIT_MSEC)) {
+ 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");
}
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
g_strfreev(pds);
}
- if (!opt_format) {
- opt_format = DEFAULT_OUTPUT_FORMAT;
+ if (!opt_output_format) {
+ opt_output_format = DEFAULT_OUTPUT_FORMAT;
/* we'll need to remember this so when saving to a file
* later, sigrok session format will be used.
*/
default_output_format = TRUE;
}
- fmtargs = parse_generic_arg(opt_format);
+ fmtargs = parse_generic_arg(opt_output_format);
fmtspec = g_hash_table_lookup(fmtargs, "sigrok_key");
if (!fmtspec) {
printf("Invalid output format.\n");
break;
}
if (!output_format) {
- printf("invalid output format %s\n", opt_format);
+ printf("invalid output format %s\n", opt_output_format);
return 1;
}