From: Yasushi SHOJI Date: Fri, 3 Jun 2016 20:39:29 +0000 (+0900) Subject: zeroplus: Fix config_list() wrt drvopts/devopts. X-Git-Tag: libsigrok-0.5.0~351 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=716d6dfcac07d8a07ca0a0b93fdd4063df06258c;p=libsigrok.git zeroplus: Fix config_list() wrt drvopts/devopts. When config_list() gets NULL as sdi, it must return driver opts. Some drivers, including zeroplus, don't check sdi and return both driver opts and device opts. --- diff --git a/src/hardware/zeroplus-logic-cube/api.c b/src/hardware/zeroplus-logic-cube/api.c index b2fe6079..dc9f2dea 100644 --- a/src/hardware/zeroplus-logic-cube/api.c +++ b/src/hardware/zeroplus-logic-cube/api.c @@ -54,8 +54,11 @@ static const struct zp_model zeroplus_models[] = { ALL_ZERO }; -static const uint32_t devopts[] = { +static const uint32_t drvopts[] = { SR_CONF_LOGIC_ANALYZER, +}; + +static const uint32_t devopts[] = { SR_CONF_LIMIT_SAMPLES | SR_CONF_SET | SR_CONF_LIST, SR_CONF_SAMPLERATE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST, SR_CONF_TRIGGER_MATCH | SR_CONF_LIST, @@ -408,8 +411,13 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst * switch (key) { case SR_CONF_DEVICE_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, - devopts, ARRAY_SIZE(devopts), sizeof(uint32_t)); + if (!sdi) { + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + drvopts, ARRAY_SIZE(drvopts), sizeof(uint32_t)); + } else { + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + devopts, ARRAY_SIZE(devopts), sizeof(uint32_t)); + } break; case SR_CONF_SAMPLERATE: devc = sdi->priv;