X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fmanson-hcs-3xxx%2Fapi.c;h=d3bd5e1f4a3adf24497425e19985ec279bbaa1e9;hb=16aca7661b7ab34a399c323bb9214721e2b1be0c;hp=5f51b82cd86d177d3bcadeaab3fdc075597e95d0;hpb=91219afc75c9aa1d0c5e2da5c03343c1e43eb6df;p=libsigrok.git diff --git a/src/hardware/manson-hcs-3xxx/api.c b/src/hardware/manson-hcs-3xxx/api.c index 5f51b82c..d3bd5e1f 100644 --- a/src/hardware/manson-hcs-3xxx/api.c +++ b/src/hardware/manson-hcs-3xxx/api.c @@ -92,7 +92,6 @@ static GSList *scan(GSList *options) struct dev_context *devc; struct sr_dev_inst *sdi; struct sr_config *src; - struct sr_channel *ch; GSList *devices, *l; const char *conn, *serialcomm; struct sr_serial_dev_inst *serial; @@ -162,8 +161,7 @@ static GSList *scan(GSList *options) sdi->conn = serial; sdi->driver = di; - ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "CH1"); - sdi->channels = g_slist_append(sdi->channels, ch); + sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "CH1"); devc = g_malloc0(sizeof(struct dev_context)); devc->model = &models[model_id]; @@ -330,21 +328,26 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst * (void)cg; + /* Always available (with or 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; + } + + /* Return drvopts without sdi (and devopts with sdi, see below). */ 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; } + /* Every other key needs an sdi. */ if (!sdi) return SR_ERR_ARG; devc = sdi->priv; switch (key) { - case SR_CONF_SCAN_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, - scanopts, ARRAY_SIZE(scanopts), sizeof(uint32_t)); - break; case SR_CONF_DEVICE_OPTIONS: *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, devopts, ARRAY_SIZE(devopts), sizeof(uint32_t));