From: Gerhard Sittig Date: Thu, 25 May 2017 17:06:36 +0000 (+0200) Subject: asix-sigma: Disable support for triggers, they don't work right now X-Git-Tag: libsigrok-0.5.0~46 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=de3f7acb4df5ff584b116b6c5f1a1eee0814ccf5;p=libsigrok.git asix-sigma: Disable support for triggers, they don't work right now 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. --- diff --git a/src/hardware/asix-sigma/api.c b/src/hardware/asix-sigma/api.c index 0aebe695..3ea726d8 100644 --- a/src/hardware/asix-sigma/api.c +++ b/src/hardware/asix-sigma/api.c @@ -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; } diff --git a/src/hardware/asix-sigma/protocol.c b/src/hardware/asix-sigma/protocol.c index 25bfc2bf..b1e0145e 100644 --- a/src/hardware/asix-sigma/protocol.c +++ b/src/hardware/asix-sigma/protocol.c @@ -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; diff --git a/src/hardware/asix-sigma/protocol.h b/src/hardware/asix-sigma/protocol.h index 3621f157..5886546b 100644 --- a/src/hardware/asix-sigma/protocol.h +++ b/src/hardware/asix-sigma/protocol.h @@ -30,6 +30,14 @@ #include #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