From: Ken Taylor Date: Sat, 7 Oct 2023 09:02:12 +0000 (-0700) Subject: openbench-logic-sniffer: Properly set samplerate range X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=c058440bcef4604753febb9a06653bf74bb0fc00;p=libsigrok.git openbench-logic-sniffer: Properly set samplerate range Driver does query max_samplerate from SUMP metadata, but previously replied to SR_CONF_SAMPLERATE with fixed 1Hz-200MHz range. Update to use max_samplerate as top of range. May fix http://sigrok.org/bugzilla/show_bug.cgi?id=1465 --- diff --git a/src/hardware/openbench-logic-sniffer/api.c b/src/hardware/openbench-logic-sniffer/api.c index b644c923..988a157a 100644 --- a/src/hardware/openbench-logic-sniffer/api.c +++ b/src/hardware/openbench-logic-sniffer/api.c @@ -383,6 +383,9 @@ static int config_list(uint32_t key, GVariant **data, { struct dev_context *devc; int num_ols_changrp, i; + uint64_t samplerates_ovrd[3]; + + devc = (sdi) ? sdi->priv : NULL; switch (key) { case SR_CONF_SCAN_OPTIONS: @@ -390,7 +393,14 @@ static int config_list(uint32_t key, GVariant **data, return STD_CONFIG_LIST(key, data, sdi, cg, scanopts, drvopts, devopts); case SR_CONF_SAMPLERATE: - *data = std_gvar_samplerates_steps(ARRAY_AND_SIZE(samplerates)); + if (!devc) + return SR_ERR_ARG; + samplerates_ovrd[0] = samplerates[0]; + samplerates_ovrd[1] = samplerates[1]; + samplerates_ovrd[2] = samplerates[2]; + if (devc->max_samplerate) + samplerates_ovrd[1] = devc->max_samplerate; + *data = std_gvar_samplerates_steps(ARRAY_AND_SIZE(samplerates_ovrd)); break; case SR_CONF_TRIGGER_MATCH: *data = std_gvar_array_i32(ARRAY_AND_SIZE(trigger_matches));