X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fhameg-hmo%2Fapi.c;h=b63ee51bb8cf4347032e6bb8920c66d77c38e8a0;hb=ca9b9f4834f106ba8387cf962a216425e0476de5;hp=2dd3c011a87712dfc184a19d1ea886db1cdd0112;hpb=fe90fbb7829ac745d59be37e61fa55e45b251a4e;p=libsigrok.git diff --git a/hardware/hameg-hmo/api.c b/hardware/hameg-hmo/api.c index 2dd3c011..b63ee51b 100644 --- a/hardware/hameg-hmo/api.c +++ b/hardware/hameg-hmo/api.c @@ -513,7 +513,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, struct scope_config *model; struct scope_state *state; const char *tmp; - uint64_t p, q, tmp_u64; + uint64_t p, q; double tmp_d; gboolean update_sample_rate; @@ -612,16 +612,16 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, ret = sr_scpi_send(sdi->conn, command); break; case SR_CONF_TRIGGER_SLOPE: - tmp_u64 = g_variant_get_uint64(data); + tmp = g_variant_get_string(data, NULL); - if (tmp_u64 != 0 && tmp_u64 != 1) - return SR_ERR; + if (!tmp || !(tmp[0] == 'f' || tmp[0] == 'r')) + return SR_ERR_ARG; - state->trigger_slope = tmp_u64; + state->trigger_slope = (tmp[0] == 'r') ? 0 : 1; g_snprintf(command, sizeof(command), (*model->scpi_dialect)[SCPI_CMD_SET_TRIGGER_SLOPE], - tmp_u64 ? "POS" : "NEG"); + (state->trigger_slope == 0) ? "POS" : "NEG"); ret = sr_scpi_send(sdi->conn, command); break;