X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fscpi-pps%2Fapi.c;h=7448796298ddb082a777d123ed75b428e303bb0e;hb=e66d1892d0dd16ed166fc8f13493f95de0607362;hp=5d2488252aa0a5e154ea9a096f7cc1cdce5fd075;hpb=a9010323ddf4e479663e871386c05db05ea3522e;p=libsigrok.git diff --git a/src/hardware/scpi-pps/api.c b/src/hardware/scpi-pps/api.c index 5d248825..74487962 100644 --- a/src/hardware/scpi-pps/api.c +++ b/src/hardware/scpi-pps/api.c @@ -520,28 +520,18 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst * int i; const char *s[16]; - /* Always available, even without sdi. */ - if (key == SR_CONF_SCAN_OPTIONS) { - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, - scanopts, ARRAY_SIZE(scanopts), sizeof(uint32_t)); - return SR_OK; - } else if (key == SR_CONF_DEVICE_OPTIONS && !sdi) { - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, - drvopts, ARRAY_SIZE(drvopts), sizeof(uint32_t)); - return SR_OK; - } - - if (!sdi) - return SR_ERR_ARG; - devc = sdi->priv; + devc = (sdi) ? sdi->priv : NULL; if (!cg) { /* No channel group: global options. */ switch (key) { + case SR_CONF_SCAN_OPTIONS: case SR_CONF_DEVICE_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, - devc->device->devopts, devc->device->num_devopts, - sizeof(uint32_t)); + return std_opts_config_list(key, data, sdi, cg, + scanopts, ARRAY_SIZE(scanopts), + drvopts, ARRAY_SIZE(drvopts), + (devc) ? devc->device->devopts : NULL, + (devc) ? devc->device->num_devopts : 0); break; case SR_CONF_CHANNEL_CONFIG: /* Not used. */