fx2lafw: implement config_get for SR_CONF_LIMIT_SAMPLES and tidy up.

This commit is contained in:
Martin Ling 2014-04-15 11:03:59 +01:00 committed by Bert Vermeulen
parent a54edb1dfb
commit a920a7d899
1 changed files with 9 additions and 4 deletions

View File

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