hantek-dso: config_set(): Shorten SR_CONF_CAPTURE_RATIO case.

The sr_config_set() wrapper already checks for SR_CONF_CAPTURE_RATIO
being 0..100.
This commit is contained in:
Uwe Hermann 2018-01-10 22:16:37 +01:00
parent be702d16d0
commit 04069272b4
1 changed files with 1 additions and 7 deletions

View File

@ -506,7 +506,6 @@ static int config_set(uint32_t key, GVariant *data,
const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
{ {
struct dev_context *devc; struct dev_context *devc;
int rat;
int ch_idx, idx; int ch_idx, idx;
float flt; float flt;
@ -532,12 +531,7 @@ static int config_set(uint32_t key, GVariant *data,
devc->triggerslope = idx; devc->triggerslope = idx;
break; break;
case SR_CONF_CAPTURE_RATIO: case SR_CONF_CAPTURE_RATIO:
rat = g_variant_get_uint64(data); devc->capture_ratio = g_variant_get_uint64(data);
if (rat < 0 || rat > 100) {
sr_err("Capture ratio must be in [0,100].");
return SR_ERR_ARG;
} else
devc->capture_ratio = rat;
break; break;
case SR_CONF_BUFFERSIZE: case SR_CONF_BUFFERSIZE:
if ((idx = std_u64_idx(data, devc->profile->buffersizes, NUM_BUFFER_SIZES)) < 0) if ((idx = std_u64_idx(data, devc->profile->buffersizes, NUM_BUFFER_SIZES)) < 0)