hantek-4032l: config_set(): Simplify SR_CONF_CAPTURE_RATIO case.
The sr_config_set() wrapper already checks the value.
This commit is contained in:
parent
2dcd904c18
commit
583fc126d0
|
@ -393,7 +393,7 @@ static int config_set(uint32_t key, GVariant *data,
|
||||||
int idx;
|
int idx;
|
||||||
struct dev_context *devc = sdi->priv;
|
struct dev_context *devc = sdi->priv;
|
||||||
struct h4032l_cmd_pkt *cmd_pkt = &devc->cmd_pkt;
|
struct h4032l_cmd_pkt *cmd_pkt = &devc->cmd_pkt;
|
||||||
uint64_t sample_rate, capture_ratio, number_samples;
|
uint64_t sample_rate, number_samples;
|
||||||
double low, high, threshold;
|
double low, high, threshold;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
|
@ -409,12 +409,7 @@ static int config_set(uint32_t key, GVariant *data,
|
||||||
devc->sample_rate = idx;
|
devc->sample_rate = idx;
|
||||||
break;
|
break;
|
||||||
case SR_CONF_CAPTURE_RATIO:
|
case SR_CONF_CAPTURE_RATIO:
|
||||||
capture_ratio = g_variant_get_uint64(data);
|
devc->capture_ratio = g_variant_get_uint64(data);
|
||||||
if (capture_ratio > 99) {
|
|
||||||
sr_err("Invalid capture ratio.");
|
|
||||||
return SR_ERR;
|
|
||||||
}
|
|
||||||
devc->capture_ratio = capture_ratio;
|
|
||||||
break;
|
break;
|
||||||
case SR_CONF_LIMIT_SAMPLES:
|
case SR_CONF_LIMIT_SAMPLES:
|
||||||
number_samples = g_variant_get_uint64(data);
|
number_samples = g_variant_get_uint64(data);
|
||||||
|
|
Loading…
Reference in New Issue