]> sigrok.org Git - libsigrok.git/commitdiff
manson-hcs-3xxx: Fix incorrect SR_CONF_SCAN_OPTIONS handling.
authorUwe Hermann <redacted>
Sun, 23 Nov 2014 20:09:37 +0000 (21:09 +0100)
committerUwe Hermann <redacted>
Sun, 23 Nov 2014 20:13:16 +0000 (21:13 +0100)
The SR_CONF_SCAN_OPTIONS key must be listable with or without sdi,
otherwise the device will not be detected by frontends.

src/hardware/manson-hcs-3xxx/api.c

index 5f51b82cd86d177d3bcadeaab3fdc075597e95d0..d3e5f8fa70213d94408eda213170e10328e4d3e9 100644 (file)
@@ -330,21 +330,26 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *
 
        (void)cg;
 
+       /* Always available (with or without sdi). */
+       if (key == SR_CONF_SCAN_OPTIONS) {
+               *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32,
+                       scanopts, ARRAY_SIZE(scanopts), sizeof(uint32_t));
+               return SR_OK;
+       }
+
+       /* Return drvopts without sdi (and devopts with sdi, see below). */
        if (key == SR_CONF_DEVICE_OPTIONS && !sdi) {
                *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32,
                                drvopts, ARRAY_SIZE(drvopts), sizeof(uint32_t));
                return SR_OK;
        }
 
+       /* Every other key needs an sdi. */
        if (!sdi)
                return SR_ERR_ARG;
        devc = sdi->priv;
 
        switch (key) {
-       case SR_CONF_SCAN_OPTIONS:
-               *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32,
-                       scanopts, ARRAY_SIZE(scanopts), sizeof(uint32_t));
-               break;
        case SR_CONF_DEVICE_OPTIONS:
                *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32,
                                devopts, ARRAY_SIZE(devopts), sizeof(uint32_t));