]> sigrok.org Git - libsigrok.git/commitdiff
sr/drivers: add proper probe list to instances of all drivers
authorBert Vermeulen <redacted>
Tue, 24 Jul 2012 17:10:09 +0000 (19:10 +0200)
committerBert Vermeulen <redacted>
Fri, 3 Aug 2012 09:29:00 +0000 (11:29 +0200)
hardware/asix-sigma/asix-sigma.c
hardware/chronovu-la8/api.c
hardware/demo/demo.c
hardware/hantek-dso/api.c
libsigrok.h

index 5cb6130c29ae8723bbbab76ae310228848314a6b..918a0e158307a47b785c3f0372751b1fd3dd15e3 100644 (file)
@@ -443,12 +443,13 @@ static int hw_init(void)
 static GSList *hw_scan(GSList *options)
 {
        struct sr_dev_inst *sdi;
+       struct sr_probe *probe;
        struct context *ctx;
        GSList *devices;
        struct ftdi_device_list *devlist;
        char serial_txt[10];
        uint32_t serial;
-       int ret;
+       int ret, i;
 
        (void)options;
        devices = NULL;
@@ -499,6 +500,14 @@ static GSList *hw_scan(GSList *options)
                goto free;
        }
        sdi->driver = adi;
+
+       for (i = 0; probe_names[i]; i++) {
+               if (!(probe = sr_probe_new(i, SR_PROBE_ANALOG, TRUE,
+                               probe_names[i])))
+                       return NULL;
+               sdi->probes = g_slist_append(sdi->probes, probe);
+       }
+
        devices = g_slist_append(devices, sdi);
        adi->instances = g_slist_append(adi->instances, sdi);
        sdi->priv = ctx;
index a8888604e40be1805a7282a47ec17fd851cd95de..61bbfc36b3715a5dbfc0135b3a6bc53a3088027e 100644 (file)
@@ -77,6 +77,7 @@ static int hw_init(void)
 static GSList *hw_scan(GSList *options)
 {
        struct sr_dev_inst *sdi;
+       struct sr_probe *probe;
        struct context *ctx;
        GSList *devices;
        unsigned int i;
@@ -146,6 +147,13 @@ static GSList *hw_scan(GSList *options)
        sdi->driver = cdi;
        sdi->priv = ctx;
 
+       for (i = 0; probe_names[i]; i++) {
+               if (!(probe = sr_probe_new(i, SR_PROBE_ANALOG, TRUE,
+                               probe_names[i])))
+                       return NULL;
+               sdi->probes = g_slist_append(sdi->probes, probe);
+       }
+
        devices = g_slist_append(devices, sdi);
        cdi->instances = g_slist_append(cdi->instances, sdi);
 
index 2f845108a934ab7fdf6652a1b78c84cbe84b7b53..89ea6df3e5c083dac9d8924d34eecc3fae3bb94c 100644 (file)
@@ -152,7 +152,9 @@ static int hw_init(void)
 static GSList *hw_scan(GSList *options)
 {
        struct sr_dev_inst *sdi;
+       struct sr_probe *probe;
        GSList *devices;
+       int i;
 
        (void)options;
        devices = NULL;
@@ -164,6 +166,13 @@ static GSList *hw_scan(GSList *options)
        }
        sdi->driver = ddi;
 
+       for (i = 0; probe_names[i]; i++) {
+               if (!(probe = sr_probe_new(i, SR_PROBE_ANALOG, TRUE,
+                               probe_names[i])))
+                       return NULL;
+               sdi->probes = g_slist_append(sdi->probes, probe);
+       }
+
        devices = g_slist_append(devices, sdi);
        ddi->instances = g_slist_append(ddi->instances, sdi);
 
index fbb84760386b3e9ab58e9e7e44e134e69ec9bc02..4efeb65eb0ce11fc42d7a7742236cef69c722e18 100644 (file)
@@ -151,7 +151,9 @@ static struct sr_dev_driver *hdi = &hantek_dso_driver_info;
 static struct sr_dev_inst *dso_dev_new(int index, const struct dso_profile *prof)
 {
        struct sr_dev_inst *sdi;
+       struct sr_probe *probe;
        struct context *ctx;
+       int i;
 
        sdi = sr_dev_inst_new(index, SR_ST_INITIALIZING,
                prof->vendor, prof->model, NULL);
@@ -159,6 +161,16 @@ static struct sr_dev_inst *dso_dev_new(int index, const struct dso_profile *prof
                return NULL;
        sdi->driver = hdi;
 
+       /* Add only the real probes -- EXT isn't a source of data, only
+        * a trigger source internal to the device.
+        */
+       for (i = 0; probe_names[i]; i++) {
+               if (!(probe = sr_probe_new(i, SR_PROBE_ANALOG, TRUE,
+                               probe_names[i])))
+                       return NULL;
+               sdi->probes = g_slist_append(sdi->probes, probe);
+       }
+
        if (!(ctx = g_try_malloc0(sizeof(struct context)))) {
                sr_err("hantek-dso: ctx malloc failed");
                return NULL;
index 2ff6244ea0912670e9f16cb74091a599f4ba735e..e7b988c4a60afc3fe5e35ed37c9c13e0390a5ac6 100644 (file)
@@ -251,6 +251,7 @@ struct sr_dev {
 
 enum {
        SR_PROBE_LOGIC,
+       SR_PROBE_ANALOG,
 };
 
 struct sr_probe {