]> sigrok.org Git - libsigrok.git/commitdiff
demo: use driver struct-based device instance list
authorBert Vermeulen <redacted>
Fri, 13 Jul 2012 11:47:27 +0000 (13:47 +0200)
committerBert Vermeulen <redacted>
Fri, 3 Aug 2012 08:27:38 +0000 (10:27 +0200)
hardware/demo/demo.c

index 175e72630ab48f11bc6eda9e5c633956b15a55cf..cdd4d1d3415045605f7adc82fd28c024c32e5295 100644 (file)
@@ -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,
 };