siglent-sds: Fix SR_CONF_TRIGGER_SLOPE config_set() code.
Also use "r" and "f" as trigger slope values for now, since that's what most other drivers do currently. This also fixes two scan-build issues: api.c:559:3: warning: Value stored to 'tmp_str' is never read tmp_str = g_variant_get_string(data, NULL); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ api.c:561:9: warning: Use of memory after it is freed ret = siglent_sds_config_set(sdi, "%s:TRSL %s", ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This commit is contained in:
parent
a7f066bfca
commit
2dedd64e11
|
@ -134,7 +134,7 @@ static const char *trigger_sources[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *trigger_slopes[] = {
|
static const char *trigger_slopes[] = {
|
||||||
"Rising", "Falling",
|
"r", "f",
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *coupling[] = {
|
static const char *coupling[] = {
|
||||||
|
@ -534,7 +534,7 @@ static int config_set(uint32_t key, GVariant *data,
|
||||||
uint64_t p, q;
|
uint64_t p, q;
|
||||||
double t_dbl;
|
double t_dbl;
|
||||||
unsigned int i, j;
|
unsigned int i, j;
|
||||||
int ret;
|
int ret, idx;
|
||||||
const char *tmp_str;
|
const char *tmp_str;
|
||||||
char buffer[16];
|
char buffer[16];
|
||||||
|
|
||||||
|
@ -555,8 +555,10 @@ static int config_set(uint32_t key, GVariant *data,
|
||||||
devc->limit_frames = g_variant_get_uint64(data);
|
devc->limit_frames = g_variant_get_uint64(data);
|
||||||
break;
|
break;
|
||||||
case SR_CONF_TRIGGER_SLOPE:
|
case SR_CONF_TRIGGER_SLOPE:
|
||||||
tmp_str = g_variant_get_string(data, NULL);
|
if ((idx = std_str_idx(data, ARRAY_AND_SIZE(trigger_slopes))) < 0)
|
||||||
|
return SR_ERR_ARG;
|
||||||
g_free(devc->trigger_slope);
|
g_free(devc->trigger_slope);
|
||||||
|
devc->trigger_slope = g_strdup((trigger_slopes[idx][0] == 'r') ? "POS" : "NEG");
|
||||||
ret = siglent_sds_config_set(sdi, "%s:TRSL %s",
|
ret = siglent_sds_config_set(sdi, "%s:TRSL %s",
|
||||||
devc->trigger_source, devc->trigger_slope);
|
devc->trigger_source, devc->trigger_slope);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue