X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fopenbench-logic-sniffer%2Fapi.c;h=0191d08bc1d22b7967957325fb9edf338a79ba6e;hb=c1bcb8cc633cc69ce4a872f59ec2b686bc00bd04;hp=8df4a8cd178739871894394287778f115ff3bcb1;hpb=854434de0bc581f16f87f85595f473ee41ca9e0c;p=libsigrok.git diff --git a/hardware/openbench-logic-sniffer/api.c b/hardware/openbench-logic-sniffer/api.c index 8df4a8cd..0191d08b 100644 --- a/hardware/openbench-logic-sniffer/api.c +++ b/hardware/openbench-logic-sniffer/api.c @@ -37,6 +37,7 @@ static const int32_t hwcaps[] = { SR_CONF_PATTERN_MODE, SR_CONF_SWAP, SR_CONF_RLE, + SR_CONF_MAX_UNCOMPRESSED_SAMPLES, }; #define STR_PATTERN_EXTERNAL "external" @@ -159,7 +160,7 @@ static GSList *scan(GSList *options) if (probefd.revents != G_IO_IN) return NULL; - if (serial_read(serial, buf, 4) != 4) + if (serial_read_blocking(serial, buf, 4) != 4) return NULL; if (strncmp(buf, "1SLO", 4) && strncmp(buf, "1ALS", 4)) return NULL; @@ -219,6 +220,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_probe_group *probe_group) { struct dev_context *devc; + int num_channels, i; (void)probe_group; @@ -245,6 +247,24 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, case SR_CONF_RLE: *data = g_variant_new_boolean(devc->flag_reg & FLAG_RLE ? TRUE : FALSE); break; + case SR_CONF_MAX_UNCOMPRESSED_SAMPLES: + if (devc->flag_reg & FLAG_RLE) + return SR_ERR_NA; + if (devc->max_samples == 0) + /* Device didn't specify sample memory size in metadata. */ + return SR_ERR_NA; + /* + * Channel groups are turned off if no probes in that group are + * enabled, making more room for samples for the enabled group. + */ + ols_configure_probes(sdi); + num_channels = 0; + for (i = 0; i < 4; i++) { + if (devc->probe_mask & (0xff << (i * 8))) + num_channels++; + } + *data = g_variant_new_uint64(devc->max_samples / num_channels); + break; default: return SR_ERR_NA; }