X-Git-Url: https://sigrok.org/gitweb/?p=sigrok-cli.git;a=blobdiff_plain;f=sigrok-cli.c;h=2aec20593269085241b28ccfb5ab9c205030e597;hp=a5cec612a2b0b52b49ebba28fbab57f4544cfb37;hb=e2dd5a767b7ac36614ecb626216fcce6ebe22585;hpb=0a56f4ecc9155ec168a2a000ca5310b1fc1b645b diff --git a/sigrok-cli.c b/sigrok-cli.c index a5cec61..2aec205 100644 --- a/sigrok-cli.c +++ b/sigrok-cli.c @@ -65,8 +65,8 @@ 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}, @@ -94,6 +94,11 @@ static void show_version(void) printf("sigrok-cli %s\n\n", VERSION); + printf("Using libsigrok %s (lib version %s).\n", + sr_package_version_string_get(), sr_lib_version_string_get()); + printf("Using libsigrokdecode %s (lib version %s).\n\n", + srd_package_version_string_get(), srd_lib_version_string_get()); + printf("Supported hardware drivers:\n"); drivers = sr_driver_list(); for (i = 0; drivers[i]; i++) { @@ -279,7 +284,7 @@ static void show_pd_detail(void) printf("- %s\n %s\n", ann[0], ann[1]); } } - if ((doc = srd_decoder_doc(dec))) { + if ((doc = srd_decoder_doc_get(dec))) { printf("Documentation:\n%s\n", doc[0] == '\n' ? doc+1 : doc); g_free(doc); } @@ -292,7 +297,7 @@ static void show_pd_detail(void) static void datafeed_in(struct sr_dev *dev, struct sr_datafeed_packet *packet) { static struct sr_output *o = NULL; - static int probelist[SR_MAX_NUM_PROBES] = { 0 }; + static int probelist[SR_MAX_NUM_PROBES + 1] = { 0 }; static uint64_t received_samples = 0; static int unitsize = 0; static int triggered = 0; @@ -302,7 +307,7 @@ static void datafeed_in(struct sr_dev *dev, struct sr_datafeed_packet *packet) struct sr_datafeed_logic *logic; int num_enabled_probes, sample_size, ret, i; uint64_t output_len, filter_out_len; - char *output_buf, *filter_out; + uint8_t *output_buf, *filter_out; /* If the first packet to come in isn't a header, don't even try. */ if (packet->type != SR_DF_HEADER && o == NULL) @@ -498,7 +503,7 @@ static int register_pds(struct sr_dev *dev, const char *pdstring) * is the probe name as specified in the decoder class, and the * value is the probe number i.e. the order in which the PD's * incoming samples are arranged. */ - if (srd_inst_probes_set(di, pd_opthash) != SRD_OK) + if (srd_inst_probe_set_all(di, pd_opthash) != SRD_OK) goto err_out; g_hash_table_destroy(pd_opthash); pd_opthash = NULL; @@ -1016,7 +1021,7 @@ int main(int argc, char **argv) printf("Failed to register protocol decoders\n"); return 1; } - if (srd_register_callback(SRD_OUTPUT_ANN, + if (srd_pd_output_callback_add(SRD_OUTPUT_ANN, show_pd_annotation, NULL) != SRD_OK) { printf("Failed to register protocol decoder callback\n"); return 1; @@ -1039,7 +1044,7 @@ int main(int argc, char **argv) printf("Cannot stack protocol decoder '%s': instance not found.\n", pds[i]); return 1; } - if ((ret = srd_inst_stack(di_from, di_to) != SRD_OK)) + if ((ret = srd_inst_stack(di_from, di_to)) != SRD_OK) return ret; /* Don't show annotation from this PD. Only the last PD in