X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=device.c;h=d11eea5c358177ae1b33db7eae50de59e8b54407;hb=13b0573369841c1e26834734699b0f34f35428eb;hp=dd3a4000bcc6b9f9405ba673aca5035eedb8acfe;hpb=2bf4aca64ad435a09359662446762840ac55db1d;p=libsigrok.git diff --git a/device.c b/device.c index dd3a4000..d11eea5c 100644 --- 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; @@ -146,7 +146,7 @@ void sr_device_probe_clear(struct sr_device *device, int probenum) } } -void sr_device_probe_add(struct sr_device *device, char *name) +void sr_device_probe_add(struct sr_device *device, const char *name) { struct sr_probe *p; char probename[16]; @@ -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; @@ -184,11 +184,12 @@ struct sr_probe *probe_find(struct sr_device *device, int probenum) } /* TODO: return SIGROK_ERR if probenum not found */ -void sr_device_probe_name(struct sr_device *device, int probenum, char *name) +void sr_device_probe_name(struct sr_device *device, int probenum, + const char *name) { struct sr_probe *p; - p = probe_find(device, probenum); + p = sr_device_probe_find(device, probenum); if (!p) return; @@ -207,7 +208,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; @@ -216,11 +217,12 @@ void sr_device_trigger_clear(struct sr_device *device) } /* TODO: return SIGROK_ERR if probenum not found */ -void sr_device_trigger_set(struct sr_device *device, int probenum, char *trigger) +void sr_device_trigger_set(struct sr_device *device, int probenum, + const char *trigger) { struct sr_probe *p; - p = probe_find(device, probenum); + p = sr_device_probe_find(device, probenum); if (!p) return; @@ -235,6 +237,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)