hameg-hmo: fix "invalid argument" exception when setting trigger edges
The hameg-hmo driver uses the values from the trigger_slopes array.
This commit is contained in:
parent
da1726cc4c
commit
e3abd15d08
|
@ -437,17 +437,17 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
|
||||||
break;
|
break;
|
||||||
case SR_CONF_TRIGGER_SLOPE:
|
case SR_CONF_TRIGGER_SLOPE:
|
||||||
tmp = g_variant_get_string(data, NULL);
|
tmp = g_variant_get_string(data, NULL);
|
||||||
|
for (i = 0; (*model->trigger_slopes)[i]; i++) {
|
||||||
|
if (g_strcmp0(tmp, (*model->trigger_slopes)[i]) != 0)
|
||||||
|
continue;
|
||||||
|
state->trigger_slope = i;
|
||||||
|
g_snprintf(command, sizeof(command),
|
||||||
|
(*model->scpi_dialect)[SCPI_CMD_SET_TRIGGER_SLOPE],
|
||||||
|
(*model->trigger_slopes)[i]);
|
||||||
|
|
||||||
if (!tmp || !(tmp[0] == 'f' || tmp[0] == 'r'))
|
ret = sr_scpi_send(sdi->conn, command);
|
||||||
return SR_ERR_ARG;
|
break;
|
||||||
|
}
|
||||||
state->trigger_slope = (tmp[0] == 'r') ? 0 : 1;
|
|
||||||
|
|
||||||
g_snprintf(command, sizeof(command),
|
|
||||||
(*model->scpi_dialect)[SCPI_CMD_SET_TRIGGER_SLOPE],
|
|
||||||
(state->trigger_slope == 0) ? "POS" : "NEG");
|
|
||||||
|
|
||||||
ret = sr_scpi_send(sdi->conn, command);
|
|
||||||
break;
|
break;
|
||||||
case SR_CONF_COUPLING:
|
case SR_CONF_COUPLING:
|
||||||
if (cg_type == CG_NONE) {
|
if (cg_type == CG_NONE) {
|
||||||
|
|
Loading…
Reference in New Issue