Hi,

On Fri, 03 Jun 2016 22:08:35 +0900,
Yasushi SHOJI wrote:
> 
> The reason seems to be a mismatch between sigrok-cli and libsigrok
> `sr_key_info_config`.  That is, sigrok-cli is printing id when
> srci->datatype == SR_T_STRING, but `sr_key_info_config` does not have
> id set.

That was wrong.

A bit of digging and much help from IRC, it seems to be a zeroplus
driver's bug.

When config_list() get NULL as sdi, it must return driver opts.  Some
drivers, including zeroplus, don't check sdi and return both(?)
driver opts and device opts.

Here is a quick patch to show a proposing fix.  If it's good way to
go, I'll work on it.
-- 
            yashi


diff --git a/src/hardware/zeroplus-logic-cube/api.c 
b/src/hardware/zeroplus-logic-cube/api.c
index 547d815..1561b22 100644
--- a/src/hardware/zeroplus-logic-cube/api.c
+++ b/src/hardware/zeroplus-logic-cube/api.c
@@ -54,8 +54,11 @@ static const struct zp_model zeroplus_models[] = {
        ALL_ZERO
 };
 
-static const uint32_t devopts[] = {
+static const uint32_t drvopts[] = {
        SR_CONF_LOGIC_ANALYZER,
+};
+
+static const uint32_t devopts[] = {
        SR_CONF_LIMIT_SAMPLES | SR_CONF_SET | SR_CONF_LIST,
        SR_CONF_SAMPLERATE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
        SR_CONF_TRIGGER_MATCH | SR_CONF_LIST,
@@ -408,8 +411,13 @@ static int config_list(uint32_t key, GVariant **data, 
const struct sr_dev_inst *
 
        switch (key) {
        case SR_CONF_DEVICE_OPTIONS:
-               *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32,
-                               devopts, ARRAY_SIZE(devopts), sizeof(uint32_t));
+               if (!sdi) {
+                       *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32,
+                                                         drvopts, 
ARRAY_SIZE(drvopts), sizeof(uint32_t));
+               } else {
+                       *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32,
+                                                         devopts, 
ARRAY_SIZE(devopts), sizeof(uint32_t));
+               }
                break;
        case SR_CONF_SAMPLERATE:
                devc = sdi->priv;

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
sigrok-devel mailing list
sigrok-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sigrok-devel

Reply via email to