X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fdemo%2Fdemo.c;h=b7a07c12a3ad0b44470bf0e80db570fd59666ec8;hb=57d0a2e195c6dac9e00bf6af3aa35bc394500b15;hp=69f48f12d1c6e5a10eee4d4adcb353462de61c7d;hpb=3b412e3a305cf06ac9bbb91ca5025d1712617b71;p=libsigrok.git diff --git a/hardware/demo/demo.c b/hardware/demo/demo.c index 69f48f12..b7a07c12 100644 --- a/hardware/demo/demo.c +++ b/hardware/demo/demo.c @@ -145,9 +145,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data); static int dev_clear(void) { - /* Nothing needed so far. */ - - return SR_OK; + return std_dev_clear(di, NULL); } static int init(struct sr_context *sr_ctx) @@ -224,34 +222,16 @@ static int dev_close(struct sr_dev_inst *sdi) static int cleanup(void) { - GSList *l; - struct sr_dev_inst *sdi; - struct drv_context *drvc; - int ret = SR_OK; - - if (!(drvc = di->priv)) - return SR_OK; - - /* Properly close and free all devices. */ - for (l = drvc->instances; l; l = l->next) { - if (!(sdi = l->data)) { - /* Log error, but continue cleaning up the rest. */ - sr_err("%s: sdi was NULL, continuing", __func__); - ret = SR_ERR_BUG; - continue; - } - sr_dev_inst_free(sdi); - } - g_slist_free(drvc->instances); - drvc->instances = NULL; - - return ret; + return dev_clear(); } -static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi) +static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, + const struct sr_probe_group *probe_group) { struct dev_context *const devc = sdi->priv; + (void)probe_group; + switch (id) { case SR_CONF_SAMPLERATE: *data = g_variant_new_uint64(devc->cur_samplerate); @@ -288,11 +268,13 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi) return SR_OK; } -static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi) +static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, + const struct sr_probe_group *probe_group) { int ret; const char *stropt; + (void)probe_group; struct dev_context *const devc = sdi->priv; if (sdi->status != SR_ST_ACTIVE) @@ -340,12 +322,14 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi) return ret; } -static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi) +static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, + const struct sr_probe_group *probe_group) { GVariant *gvar; GVariantBuilder gvb; (void)sdi; + (void)probe_group; switch (key) { case SR_CONF_DEVICE_OPTIONS: