]> sigrok.org Git - sigrok-cli.git/blobdiff - sigrok-cli.c
cli: correctly map probes on every instance, not just the last one.
[sigrok-cli.git] / sigrok-cli.c
index ae6a63771333467098d683096bbda556d99391f3..1bf6c7d801d40770f99f1d075ed0d251925abf5e 100644 (file)
@@ -495,14 +495,16 @@ static int register_pds(struct sr_device *device, const char *pdstring)
                        goto err_out;
                }
                g_datalist_set_data(&pd_ann_visible, di->instance_id, pd_name);
-       }
 
-       /* Any keys left in the options hash are probes, where the key
-        * 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_instance_set_probes(di, pd_opthash) != SRD_OK)
-               return 1;
+               /* Any keys left in the options hash are probes, where the key
+                * 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_instance_set_probes(di, pd_opthash) != SRD_OK)
+                       goto err_out;
+               g_hash_table_destroy(pd_opthash);
+               pd_opthash = NULL;
+       }
 
 err_out:
        g_strfreev(pdtokens);
@@ -1027,12 +1029,12 @@ int main(int argc, char **argv)
                        return 1;
                }
 
-               if (!(di_from = srd_instance_find(pds[0]))) {
+               if (!(di_from = srd_instance_find_by_id(pds[0]))) {
                        printf("Cannot stack protocol decoder '%s': instance not found.\n", pds[0]);
                        return 1;
                }
                for (i = 1; pds[i]; i++) {
-                       if (!(di_to = srd_instance_find(pds[i]))) {
+                       if (!(di_to = srd_instance_find_by_id(pds[i]))) {
                                printf("Cannot stack protocol decoder '%s': instance not found.\n", pds[i]);
                                return 1;
                        }