]> sigrok.org Git - sigrok-cli.git/blobdiff - sigrok-cli.c
Use new sr_config_info*_get() calls.
[sigrok-cli.git] / sigrok-cli.c
index 9d870ab9662aa38d62e2cc87e35aebc5a73bca11..9938260cc2bd232675b876c364fdd02354c1d1b6 100644 (file)
@@ -125,7 +125,7 @@ static GSList *hash_to_hwopt(GHashTable *hash)
        opts = NULL;
        for (gl = keys; gl; gl = gl->next) {
                key = gl->data;
-               if (!(srci = sr_drvopt_name_get(key))) {
+               if (!(srci = sr_config_info_name_get(key))) {
                        g_critical("Unknown option %s", key);
                        return NULL;
                }
@@ -346,7 +346,7 @@ static void show_dev_detail(void)
                        NULL) == SR_OK) && hwopts) {
                printf("Supported driver options:\n");
                for (i = 0; hwopts[i]; i++) {
-                       if (!(srci = sr_drvopt_get(hwopts[i])))
+                       if (!(srci = sr_config_info_get(hwopts[i])))
                                continue;
                        printf("    %s\n", srci->id);
                }
@@ -359,7 +359,7 @@ static void show_dev_detail(void)
                return;
 
        for (cap = 0; hwcaps[cap]; cap++) {
-               if (!(srci = sr_devopt_get(hwcaps[cap])))
+               if (!(srci = sr_config_info_get(hwcaps[cap])))
                        continue;
 
                if (title) {
@@ -568,8 +568,10 @@ static GArray *get_enabled_logic_probes(const struct sr_dev_inst *sdi)
 static void datafeed_in(const struct sr_dev_inst *sdi,
                const struct sr_datafeed_packet *packet)
 {
+       const struct sr_datafeed_meta *meta;
        const struct sr_datafeed_logic *logic;
        const struct sr_datafeed_analog *analog;
+       struct sr_config *src;
        static struct sr_output *o = NULL;
        static GArray *logic_probelist = NULL;
        static uint64_t received_samples = 0;
@@ -580,6 +582,7 @@ static void datafeed_in(const struct sr_dev_inst *sdi,
        uint64_t *samplerate, output_len, filter_out_len;
        uint8_t *output_buf, *filter_out;
        GString *out;
+       GSList *l;
 
        /* If the first packet to come in isn't a header, don't even try. */
        if (packet->type != SR_DF_HEADER && o == NULL)
@@ -676,6 +679,23 @@ static void datafeed_in(const struct sr_dev_inst *sdi,
                o = NULL;
                break;
 
+       case SR_DF_META:
+               g_debug("cli: received SR_DF_META");
+               meta = packet->payload;
+               for (l = meta->config; l; l = l->next) {
+                       src = l->data;
+                       switch (src->key) {
+                       case SR_HWCAP_SAMPLERATE:
+                               samplerate = (uint64_t *)src->value;
+                               g_debug("cli: got samplerate %"PRIu64, *samplerate);
+                               break;
+                       default:
+                               /* Unknown metadata is not an error. */
+                               break;
+                       }
+               }
+               break;
+
        case SR_DF_TRIGGER:
                g_debug("cli: received SR_DF_TRIGGER");
                if (o->format->event)
@@ -1224,7 +1244,7 @@ static int set_dev_options(struct sr_dev_inst *sdi, GHashTable *args)
 
        g_hash_table_iter_init(&iter, args);
        while (g_hash_table_iter_next(&iter, &key, &value)) {
-               if (!(srci = sr_devopt_name_get(key))) {
+               if (!(srci = sr_config_info_name_get(key))) {
                        g_critical("Unknown device option '%s'.", (char *) key);
                        return SR_ERR;
                }