#include <stdio.h>
#include <glib.h>
#include <sigrok.h>
+#include <sigrok-internal.h>
extern struct sr_global *global;
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
{
int num_devices, num_probes, i;
- g_message("initializing %s plugin", plugin->name);
+ sr_info("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, SR_DI_NUM_PROBES);
{
struct sr_probe *p;
- p = probe_find(device, probenum);
+ p = sr_device_probe_find(device, probenum);
if (!p)
return;
}
}
-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];
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;
}
/* 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;
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;
}
/* 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;
{
int *capabilities, i;
+ if (!device || !device->plugin)
+ return FALSE;
+
if ((capabilities = device->plugin->get_capabilities()))
for (i = 0; capabilities[i]; i++)
if (capabilities[i] == hwcap)