Trying to configure an invalid capture ratio would reset the
previously configured value. Instead, we should just reject the
new value and keep the original one.
---
I didn't actually test this patch since I own none of the hardware for
the affected drivers.
src/hardware/beaglelogic/api.c | 1 -
src/hardware/fx2lafw/api.c | 1 -
src/hardware/openbench-logic-sniffer/api.c | 1 -
src/hardware/pipistrello-ols/api.c | 1 -
src/hardware/saleae-logic16/api.c | 1 -
5 files changed, 5 deletions(-)
diff --git a/src/hardware/beaglelogic/api.c b/src/hardware/beaglelogic/api.c
index 1c8e43b..9f2967f 100644
--- a/src/hardware/beaglelogic/api.c
+++ b/src/hardware/beaglelogic/api.c
@@ -285,7 +285,6 @@ static int config_set(uint32_t key, GVariant *data, const
struct sr_dev_inst *sd
case SR_CONF_CAPTURE_RATIO:
devc->capture_ratio = g_variant_get_uint64(data);
if (devc->capture_ratio > 100) {
- devc->capture_ratio = 0;
return SR_ERR;
}
return SR_OK;
diff --git a/src/hardware/fx2lafw/api.c b/src/hardware/fx2lafw/api.c
index fc6081b..5ee459a 100644
--- a/src/hardware/fx2lafw/api.c
+++ b/src/hardware/fx2lafw/api.c
@@ -554,7 +554,6 @@ static int config_set(uint32_t key, GVariant *data, const
struct sr_dev_inst *sd
case SR_CONF_CAPTURE_RATIO:
devc->capture_ratio = g_variant_get_uint64(data);
if (devc->capture_ratio > 100) {
- devc->capture_ratio = 0;
ret = SR_ERR;
} else
ret = SR_OK;
diff --git a/src/hardware/openbench-logic-sniffer/api.c
b/src/hardware/openbench-logic-sniffer/api.c
index e61bd10..c47a6df 100644
--- a/src/hardware/openbench-logic-sniffer/api.c
+++ b/src/hardware/openbench-logic-sniffer/api.c
@@ -292,7 +292,6 @@ static int config_set(uint32_t key, GVariant *data, const
struct sr_dev_inst *sd
case SR_CONF_CAPTURE_RATIO:
devc->capture_ratio = g_variant_get_uint64(data);
if (devc->capture_ratio < 0 || devc->capture_ratio > 100) {
- devc->capture_ratio = 0;
ret = SR_ERR;
} else
ret = SR_OK;
diff --git a/src/hardware/pipistrello-ols/api.c
b/src/hardware/pipistrello-ols/api.c
index c467f0c..82887c0 100644
--- a/src/hardware/pipistrello-ols/api.c
+++ b/src/hardware/pipistrello-ols/api.c
@@ -300,7 +300,6 @@ static int config_set(uint32_t key, GVariant *data, const
struct sr_dev_inst *sd
case SR_CONF_CAPTURE_RATIO:
devc->capture_ratio = g_variant_get_uint64(data);
if (devc->capture_ratio < 0 || devc->capture_ratio > 100) {
- devc->capture_ratio = 0;
ret = SR_ERR;
} else
ret = SR_OK;
diff --git a/src/hardware/saleae-logic16/api.c
b/src/hardware/saleae-logic16/api.c
index 43477d5..d6144f5 100644
--- a/src/hardware/saleae-logic16/api.c
+++ b/src/hardware/saleae-logic16/api.c
@@ -503,7 +503,6 @@ static int config_set(uint32_t key, GVariant *data, const
struct sr_dev_inst *sd
case SR_CONF_CAPTURE_RATIO:
devc->capture_ratio = g_variant_get_uint64(data);
if (devc->capture_ratio > 100) {
- devc->capture_ratio = 0;
ret = SR_ERR;
} else
ret = SR_OK;
--
2.2.1
------------------------------------------------------------------------------
_______________________________________________
sigrok-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sigrok-devel