]> sigrok.org Git - libsigrok.git/blobdiff - hardware/link-mso19/api.c
Rename 'struct sr_probe' to 'struct sr_channel' everywhere.
[libsigrok.git] / hardware / link-mso19 / api.c
index e283a2cb7fb9cacf94ef2409c18da3c6124eba04..daa08d1c4663c2c4df12bea15678778657f2126b 100644 (file)
@@ -217,7 +217,7 @@ static GSList *scan(GSList *options)
                sdi->priv = devc;
 
                for (i = 0; i < NUM_PROBES; i++) {
-                       struct sr_probe *probe;
+                       struct sr_channel *probe;
                        ptype = (i == 0) ? SR_PROBE_ANALOG : SR_PROBE_LOGIC;
                        if (!(probe = sr_probe_new(i, ptype, TRUE,
                                                   mso19_probe_names[i])))
@@ -276,11 +276,11 @@ static int cleanup(void)
 }
 
 static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
-               const struct sr_probe_group *probe_group)
+               const struct sr_channel_group *cg)
 {
        struct dev_context *devc;
 
-       (void)probe_group;
+       (void)cg;
 
        switch (id) {
        case SR_CONF_SAMPLERATE:
@@ -298,15 +298,16 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
 }
 
 static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
-               const struct sr_probe_group *probe_group)
+               const struct sr_channel_group *cg)
 {
        int ret;
        struct dev_context *devc;
-       uint64_t num_samples, slope;
+       uint64_t num_samples;
+       const char *slope;
        int trigger_pos;
        double pos;
 
-       (void)probe_group;
+       (void)cg;
        devc = sdi->priv;
 
        if (sdi->status != SR_ST_ACTIVE)
@@ -334,12 +335,14 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
                ret = SR_OK;
                break;
        case SR_CONF_TRIGGER_SLOPE:
-               slope = g_variant_get_uint64(data);
-               if (slope != SLOPE_NEGATIVE && slope != SLOPE_POSITIVE) {
+               slope = g_variant_get_string(data, NULL);
+
+               if (!slope || !(slope[0] == 'f' || slope[0] == 'r'))
                        sr_err("Invalid trigger slope");
                        ret = SR_ERR_ARG;
                } else {
-                       devc->trigger_slope = slope;
+                       devc->trigger_slope = (slope[0] == 'r')
+                               ? SLOPE_POSITIVE : SLOPE_NEGATIVE;
                        ret = SR_OK;
                }
                break;
@@ -366,12 +369,12 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
 }
 
 static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
-               const struct sr_probe_group *probe_group)
+               const struct sr_channel_group *cg)
 {
        GVariant *gvar;
        GVariantBuilder gvb;
 
-       (void)probe_group;
+       (void)cg;
        (void)sdi;
 
        switch (key) {