]> sigrok.org Git - libsigrok.git/commitdiff
fx2lafw: implement config_get for SR_CONF_LIMIT_SAMPLES and tidy up.
authorMartin Ling <redacted>
Tue, 15 Apr 2014 10:03:59 +0000 (11:03 +0100)
committerBert Vermeulen <redacted>
Wed, 30 Apr 2014 21:01:52 +0000 (14:01 -0700)
hardware/fx2lafw/api.c

index 7bfbdad934e809ea56d2c0383eca57170dafe16d..c4f0bd14d630c019d222fce6261397518e81052c 100644 (file)
@@ -355,9 +355,14 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
 
        (void)cg;
 
+       if (!sdi)
+               return SR_ERR_ARG;
+
+       devc = sdi->priv;
+
        switch (id) {
        case SR_CONF_CONN:
-               if (!sdi || !sdi->conn)
+               if (!sdi->conn)
                        return SR_ERR_ARG;
                usb = sdi->conn;
                if (usb->address == 255)
@@ -367,10 +372,10 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
                snprintf(str, 128, "%d.%d", usb->bus, usb->address);
                *data = g_variant_new_string(str);
                break;
+       case SR_CONF_LIMIT_SAMPLES:
+               *data = g_variant_new_uint64(devc->limit_samples);
+               break;
        case SR_CONF_SAMPLERATE:
-               if (!sdi)
-                       return SR_ERR;
-               devc = sdi->priv;
                *data = g_variant_new_uint64(devc->cur_samplerate);
                break;
        default: