#include <sigrok.h>
#include "config.h"
-source_callback_add source_cb_add = NULL;
-source_callback_remove source_cb_remove = NULL;
-
/* The list of loaded plugins lives here. */
GSList *plugins;
#ifdef HAVE_LA_LINK_MSO19
extern struct device_plugin link_mso19_plugin_info;
#endif
+#ifdef HAVE_LA_ALSA
+extern struct device_plugin alsa_plugin_info;
+#endif
/* TODO: No linked list needed, this can be a simple array. */
#ifdef HAVE_LA_LINK_MSO19
plugins = g_slist_append(plugins, (gpointer *)&link_mso19_plugin_info);
#endif
+#ifdef HAVE_LA_ALSA
+ plugins = g_slist_append(plugins, (gpointer *)&alsa_plugin_info);
+#endif
- return SIGROK_OK;
+
+ return SR_OK;
}
GSList *list_hwplugins(void)
return plugins;
}
-struct sigrok_device_instance *sigrok_device_instance_new(int index, int status,
+struct sr_device_instance *sr_device_instance_new(int index, int status,
const char *vendor, const char *model, const char *version)
{
- struct sigrok_device_instance *sdi;
+ struct sr_device_instance *sdi;
- if (!(sdi = malloc(sizeof(struct sigrok_device_instance))))
+ if (!(sdi = malloc(sizeof(struct sr_device_instance))))
return NULL;
sdi->index = index;
return sdi;
}
-struct sigrok_device_instance *get_sigrok_device_instance(
+struct sr_device_instance *get_sr_device_instance(
GSList *device_instances, int device_index)
{
- struct sigrok_device_instance *sdi;
+ struct sr_device_instance *sdi;
GSList *l;
for (l = device_instances; l; l = l->next) {
- sdi = (struct sigrok_device_instance *)(l->data);
+ sdi = (struct sr_device_instance *)(l->data);
if (sdi->index == device_index)
return sdi;
}
return NULL;
}
-void sigrok_device_instance_free(struct sigrok_device_instance *sdi)
+void sr_device_instance_free(struct sr_device_instance *sdi)
{
switch (sdi->instance_type) {
case USB_INSTANCE:
return NULL;
}
+/* unnecessary level of indirection follows. */
+
void source_remove(int fd)
{
- if (source_cb_remove)
- source_cb_remove(fd);
+
+ session_source_remove(fd);
+
}
void source_add(int fd, int events, int timeout, receive_data_callback rcv_cb,
void *user_data)
{
- if (source_cb_add)
- source_cb_add(fd, events, timeout, rcv_cb, user_data);
+
+ session_source_add(fd, events, timeout, rcv_cb, user_data);
+
}