]> sigrok.org Git - libsigrok.git/blobdiff - hardware/hameg-hmo/api.c
hwdriver: Change TRIGGER_SLOPE setting to string type.
[libsigrok.git] / hardware / hameg-hmo / api.c
index d61a5e87b323802af1ee71c6b1a951092fa60050..b63ee51bb8cf4347032e6bb8920c66d77c38e8a0 100644 (file)
@@ -189,6 +189,9 @@ skip_device:
 
        return tty_devs;
 #else
+       (void)vendor_id;
+       (void)product_id;
+
        return NULL;
 #endif
 }
@@ -510,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;
 
@@ -609,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;
@@ -935,6 +938,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
 
        devc = sdi->priv;
 
+       devc->num_frames = 0;
        g_slist_free(devc->enabled_probes);
        devc->enabled_probes = NULL;
        scpi = sdi->conn;