From: Martin Ling Date: Tue, 15 Apr 2014 10:03:59 +0000 (+0100) Subject: fx2lafw: implement config_get for SR_CONF_LIMIT_SAMPLES and tidy up. X-Git-Tag: libsigrok-0.3.0~25 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=a920a7d899be7aabcf7cc70c671b15e628c3d51f;p=libsigrok.git fx2lafw: implement config_get for SR_CONF_LIMIT_SAMPLES and tidy up. --- diff --git a/hardware/fx2lafw/api.c b/hardware/fx2lafw/api.c index 7bfbdad9..c4f0bd14 100644 --- a/hardware/fx2lafw/api.c +++ b/hardware/fx2lafw/api.c @@ -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: