]> sigrok.org Git - libsigrok.git/blobdiff - device.c
Remove duplicate FIRMWARE_DIR includes.
[libsigrok.git] / device.c
index 1f46573b01f5202e635ede2d14b1a9d447a48a2e..752041d5f21b69513fb5508e5711d61bbd014bc1 100644 (file)
--- a/device.c
+++ b/device.c
@@ -29,7 +29,7 @@ void device_scan(void)
 {
        GSList *plugins, *l;
        struct device_plugin *plugin;
-       int num_devices, num_probes, i;
+       int num_devices, num_probes, i, probe_type;
 
        plugins = list_hwplugins();
 
@@ -43,9 +43,16 @@ void device_scan(void)
                g_message("initializing %s plugin", plugin->name);
                num_devices = plugin->init(NULL);
                for (i = 0; i < num_devices; i++) {
-                       num_probes = (int)plugin->get_device_info(i,
-                                                       DI_NUM_PROBES);
-                       device_new(plugin, i, num_probes);
+                       num_probes
+                         = (int)(unsigned long)plugin->get_device_info(i,
+                           DI_NUM_PROBES);
+                       probe_type = (int)(unsigned long)
+                               plugin->get_device_info(i, DI_PROBE_TYPE);
+
+                       if (probe_type != PROBE_TYPE_ANALOG)
+                               probe_type = PROBE_TYPE_LOGIC;
+
+                       device_new(plugin, i, num_probes, probe_type);
                }
        }
 }
@@ -68,7 +75,7 @@ GSList *device_list(void)
 }
 
 struct device *device_new(struct device_plugin *plugin, int plugin_index,
-                         int num_probes)
+                         int num_probes, int probe_type)
 {
        struct device *device;
        int i;
@@ -77,6 +84,7 @@ struct device *device_new(struct device_plugin *plugin, int plugin_index,
        device = g_malloc0(sizeof(struct device));
        device->plugin = plugin;
        device->plugin_index = plugin_index;
+       device->probe_type = probe_type;
        devices = g_slist_append(devices, device);
 
        for (i = 0; i < num_probes; i++) {