]> sigrok.org Git - libsigrok.git/blobdiff - device.c
Make load_hwplugins() private.
[libsigrok.git] / device.c
index dd3a4000bcc6b9f9405ba673aca5035eedb8acfe..bf87e811e90c6ffb9530214b0fcf381215bde610 100644 (file)
--- a/device.c
+++ b/device.c
@@ -30,7 +30,7 @@ void sr_device_scan(void)
        GSList *plugins, *l;
        struct sr_device_plugin *plugin;
 
-       plugins = list_hwplugins();
+       plugins = sr_list_hwplugins();
 
        /*
         * Initialize all plugins first. Since the init() call may involve
@@ -131,7 +131,7 @@ void sr_device_probe_clear(struct sr_device *device, int probenum)
 {
        struct sr_probe *p;
 
-       p = probe_find(device, probenum);
+       p = sr_device_probe_find(device, probenum);
        if (!p)
                return;
 
@@ -166,7 +166,7 @@ void sr_device_probe_add(struct sr_device *device, char *name)
        device->probes = g_slist_append(device->probes, p);
 }
 
-struct sr_probe *probe_find(struct sr_device *device, int probenum)
+struct sr_probe *sr_device_probe_find(struct sr_device *device, int probenum)
 {
        GSList *l;
        struct sr_probe *p, *found_probe;
@@ -188,7 +188,7 @@ void sr_device_probe_name(struct sr_device *device, int probenum, char *name)
 {
        struct sr_probe *p;
 
-       p = probe_find(device, probenum);
+       p = sr_device_probe_find(device, probenum);
        if (!p)
                return;
 
@@ -207,7 +207,7 @@ void sr_device_trigger_clear(struct sr_device *device)
                return;
 
        for (pnum = 1; pnum <= g_slist_length(device->probes); pnum++) {
-               p = probe_find(device, pnum);
+               p = sr_device_probe_find(device, pnum);
                if (p && p->trigger) {
                        g_free(p->trigger);
                        p->trigger = NULL;
@@ -220,7 +220,7 @@ void sr_device_trigger_set(struct sr_device *device, int probenum, char *trigger
 {
        struct sr_probe *p;
 
-       p = probe_find(device, probenum);
+       p = sr_device_probe_find(device, probenum);
        if (!p)
                return;
 
@@ -235,6 +235,9 @@ gboolean sr_device_has_hwcap(struct sr_device *device, int hwcap)
 {
        int *capabilities, i;
 
+       if (!device || !device->plugin)
+               return;
+
        if ((capabilities = device->plugin->get_capabilities()))
                for (i = 0; capabilities[i]; i++)
                        if (capabilities[i] == hwcap)