]> sigrok.org Git - libsigrok.git/commitdiff
asix-sigma: Disable support for triggers, they don't work right now
authorGerhard Sittig <redacted>
Thu, 25 May 2017 17:06:36 +0000 (19:06 +0200)
committerUwe Hermann <redacted>
Fri, 26 May 2017 20:48:02 +0000 (22:48 +0200)
This works around bug #359. Triggers currently are not operational for
Asix Sigma. Don't claim support in the driver so that UIs won't use the
feature. Yet allow research in this issue, by concentrating the switch
for the feature's support in a central location.

Add/update a comment and unobfuscate an error code path while we are here.

src/hardware/asix-sigma/api.c
src/hardware/asix-sigma/protocol.c
src/hardware/asix-sigma/protocol.h

index 0aebe695c3bec49308a40427746a7b37bf7491d4..3ea726d8a1f2118af2585a80c9c7d02ef39e5df7 100644 (file)
@@ -44,8 +44,10 @@ static const uint32_t devopts[] = {
        SR_CONF_LIMIT_MSEC | SR_CONF_GET | SR_CONF_SET,
        SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET,
        SR_CONF_SAMPLERATE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
+#if ASIX_SIGMA_WITH_TRIGGER
        SR_CONF_TRIGGER_MATCH | SR_CONF_LIST,
        SR_CONF_CAPTURE_RATIO | SR_CONF_GET | SR_CONF_SET,
+#endif
 };
 
 static const int32_t trigger_matches[] = {
@@ -189,9 +191,11 @@ static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *s
        case SR_CONF_LIMIT_SAMPLES:
                *data = g_variant_new_uint64(devc->limit_samples);
                break;
+#if ASIX_SIGMA_WITH_TRIGGER
        case SR_CONF_CAPTURE_RATIO:
                *data = g_variant_new_uint64(devc->capture_ratio);
                break;
+#endif
        default:
                return SR_ERR_NA;
        }
@@ -230,13 +234,14 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
                devc->limit_samples = tmp;
                devc->limit_msec = sigma_limit_samples_to_msec(devc, tmp);
                break;
+#if ASIX_SIGMA_WITH_TRIGGER
        case SR_CONF_CAPTURE_RATIO:
                tmp = g_variant_get_uint64(data);
-               if (tmp <= 100)
-                       devc->capture_ratio = tmp;
-               else
-                       ret = SR_ERR;
+               if (tmp > 100)
+                       return SR_ERR;
+               devc->capture_ratio = tmp;
                break;
+#endif
        default:
                ret = SR_ERR_NA;
        }
@@ -268,11 +273,13 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *
                g_variant_builder_add(&gvb, "{sv}", "samplerates", gvar);
                *data = g_variant_builder_end(&gvb);
                break;
+#if ASIX_SIGMA_WITH_TRIGGER
        case SR_CONF_TRIGGER_MATCH:
                *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
                                trigger_matches, ARRAY_SIZE(trigger_matches),
                                sizeof(int32_t));
                break;
+#endif
        default:
                return SR_ERR_NA;
        }
index 25bfc2bf86aadfe8b3e6846612362bbaf1a3dfda..b1e0145e8f9970c13b34febf7eee709d339f0e6f 100644 (file)
@@ -784,7 +784,11 @@ static void sigma_decode_dram_cluster(struct sigma_dram_cluster *dram_cluster,
                samples[2 * i + 0] = dram_cluster->samples[i].sample_hi;
        }
 
-       /* Send data up to trigger point (if triggered). */
+       /*
+        * If a trigger position applies, then provide the datafeed with
+        * the first part of data up to that position, then send the
+        * trigger marker.
+        */
        int trigger_offset = 0;
        if (triggered) {
                /*
@@ -810,6 +814,10 @@ static void sigma_decode_dram_cluster(struct sigma_dram_cluster *dram_cluster,
                }
        }
 
+       /*
+        * Send the data after the trigger, or all of the received data
+        * if no trigger position applies.
+        */
        if (events_in_cluster > 0) {
                packet.type = SR_DF_LOGIC;
                logic.length = events_in_cluster * logic.unitsize;
index 3621f157d3c2b5ba73c0329010af488fd017f550..5886546bb1973ca493efe59bb41cd7f96f94cce7 100644 (file)
 #include <libsigrok/libsigrok.h>
 #include "libsigrok-internal.h"
 
+/*
+ * Triggers are not working in this implementation. Stop claiming
+ * support for the feature which effectively is not available, until
+ * the implementation got fixed. Yet keep the code in place and allow
+ * developers to turn on this switch during development.
+ */
+#define ASIX_SIGMA_WITH_TRIGGER        0
+
 #define LOG_PREFIX "asix-sigma"
 
 #define USB_VENDOR                     0xa600