From: Bert Vermeulen Date: Fri, 13 Jul 2012 11:47:27 +0000 (+0200) Subject: demo: use driver struct-based device instance list X-Git-Tag: dsupstream~820 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=dcf03d6dbdba67eb92ee887de1bc72816a3cd01b;p=libsigrok.git demo: use driver struct-based device instance list --- diff --git a/hardware/demo/demo.c b/hardware/demo/demo.c index 175e7263..cdd4d1d3 100644 --- a/hardware/demo/demo.c +++ b/hardware/demo/demo.c @@ -130,7 +130,8 @@ static uint8_t pattern_sigrok[] = { /* TODO: struct context as with the other drivers. */ /* List of struct sr_dev_inst, maintained by dev_open()/dev_close(). */ -static GSList *dev_insts = NULL; +SR_PRIV struct sr_dev_driver demo_driver_info; +static struct sr_dev_driver *ddi = &demo_driver_info; static uint64_t cur_samplerate = SR_KHZ(200); static uint64_t limit_samples = 0; static uint64_t limit_msec = 0; @@ -158,7 +159,7 @@ static int hw_scan(void) return 0; } - dev_insts = g_slist_append(dev_insts, sdi); + ddi->instances = g_slist_append(ddi->instances, sdi); return 1; } @@ -194,7 +195,7 @@ static const void *hw_dev_info_get(int dev_index, int dev_info_id) struct sr_dev_inst *sdi; const void *info = NULL; - if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) { + if (!(sdi = sr_dev_inst_get(ddi->instances, dev_index))) { sr_err("demo: %s: sdi was NULL", __func__); return NULL; } @@ -527,4 +528,5 @@ SR_PRIV struct sr_dev_driver demo_driver_info = { .dev_config_set = hw_dev_config_set, .dev_acquisition_start = hw_dev_acquisition_start, .dev_acquisition_stop = hw_dev_acquisition_stop, + .instances = NULL, };