The 'GSList *devices' from device.c was actually really global (i.e.,
listed in sigrok.h), which is now fixed.
#include <sigrok.h>
#include <sigrok-internal.h>
#include <sigrok.h>
#include <sigrok-internal.h>
+static GSList *devices = NULL;
/**
* Scan the system for attached logic analyzers / devices.
/**
* Scan the system for attached logic analyzers / devices.
#include <string.h>
#include "config.h"
#include <string.h>
#include "config.h"
int ezusb_reset(struct libusb_device_handle *hdl, int set_clear)
{
int err;
int ezusb_reset(struct libusb_device_handle *hdl, int set_clear)
{
int err;
// FIXME: Must be moved, or rather passed as function argument.
#ifdef _WIN32
// FIXME: Must be moved, or rather passed as function argument.
#ifdef _WIN32
#endif
const char *serial_port_glob[] = {
#endif
const char *serial_port_glob[] = {
-void receive_transfer(struct libusb_transfer *transfer)
+static void receive_transfer(struct libusb_transfer *transfer)
{
/* TODO: these statics have to move to fx2_device struct */
static int num_samples = 0;
{
/* TODO: these statics have to move to fx2_device struct */
static int num_samples = 0;
#include <sigrok-internal.h>
/* The list of loaded plugins lives here. */
#include <sigrok-internal.h>
/* The list of loaded plugins lives here. */
/*
* This enumerates which plugin capabilities correspond to user-settable
/*
* This enumerates which plugin capabilities correspond to user-settable
extern struct sr_device_plugin alsa_plugin_info;
#endif
extern struct sr_device_plugin alsa_plugin_info;
#endif
/* TODO: No linked list needed, this can be a simple array. */
int load_hwplugins(void)
{
/* TODO: No linked list needed, this can be a simple array. */
int load_hwplugins(void)
{
plugins = g_slist_append(plugins, (gpointer *)&alsa_plugin_info);
#endif
plugins = g_slist_append(plugins, (gpointer *)&alsa_plugin_info);
#endif
if (plugin->cleanup)
plugin->cleanup();
}
if (plugin->cleanup)
plugin->cleanup();
}
}
struct sr_device_instance *sr_device_instance_new(int index, int status,
}
struct sr_device_instance *sr_device_instance_new(int index, int status,
g_free(sdi->model);
g_free(sdi->version);
g_free(sdi);
g_free(sdi->model);
g_free(sdi->version);
g_free(sdi);
#define CHUNKSIZE 4096
#define DEFAULT_NUM_PROBES 8
#define CHUNKSIZE 4096
#define DEFAULT_NUM_PROBES 8
static int format_match(const char *filename)
{
/* suppress compiler warning */
static int format_match(const char *filename)
{
/* suppress compiler warning */
};
/* There can only be one session at a time. */
};
/* There can only be one session at a time. */
+/* 'session' is not static, it's used elsewhere (via 'extern'). */
struct sr_session *session;
struct sr_session *session;
-int num_sources = 0;
-
-struct source *sources = NULL;
-int source_timeout = -1;
+static int num_sources = 0;
+static struct source *sources = NULL;
+static int source_timeout = -1;
struct sr_session *sr_session_new(void)
{
struct sr_session *sr_session_new(void)
{
void sr_session_destroy(void)
{
void sr_session_destroy(void)
{
g_slist_free(session->devices);
/* TODO: Loop over protocol decoders and free them. */
g_slist_free(session->devices);
/* TODO: Loop over protocol decoders and free them. */
}
int sr_session_start(void)
}
int sr_session_start(void)
void sr_session_run(void)
{
void sr_session_run(void)
{
sr_info("session: running");
session->running = TRUE;
sr_info("session: running");
session->running = TRUE;
else
/* real sources, use g_poll() main loop */
sr_session_run_poll();
else
/* real sources, use g_poll() main loop */
sr_session_run_poll();
}
void sr_session_halt(void)
{
}
void sr_session_halt(void)
{
sr_info("session: halting");
session->running = FALSE;
sr_info("session: halting");
session->running = FALSE;
}
void sr_session_stop(void)
}
void sr_session_stop(void)
if (device->plugin && device->plugin->stop_acquisition)
device->plugin->stop_acquisition(device->plugin_index, device);
}
if (device->plugin && device->plugin->stop_acquisition)
device->plugin->stop_acquisition(device->plugin_index, device);
}
}
static void datafeed_dump(struct sr_datafeed_packet *packet)
}
static void datafeed_dump(struct sr_datafeed_packet *packet)
default:
sr_dbg("bus: received unknown packet type %d", packet->type);
}
default:
sr_dbg("bus: received unknown packet type %d", packet->type);
}
}
void sr_session_bus(struct sr_device *device, struct sr_datafeed_packet *packet)
}
void sr_session_bus(struct sr_device *device, struct sr_datafeed_packet *packet)
static struct session_vdevice *get_vdevice_by_index(int device_index)
{
struct sr_device_instance *sdi;
static struct session_vdevice *get_vdevice_by_index(int device_index)
{
struct sr_device_instance *sdi;
sr_session_source_remove(-1);
g_free(sessionfile);
sr_session_source_remove(-1);
g_free(sessionfile);
}
static int hw_opendev(int device_index)
}
static int hw_opendev(int device_index)
/* Avoid compiler warnings. */
(void)device_index;
/* Avoid compiler warnings. */
(void)device_index;
+ if (sr_device_list() != NULL)
return SR_OK;
else
return SR_ERR;
return SR_OK;
else
return SR_ERR;
static int *hw_get_capabilities(void)
{
static int *hw_get_capabilities(void)
{
+/* Not static, it's used elsewhere (via 'extern'). */
struct sr_device_plugin session_driver = {
"session",
"Session-emulating driver",
struct sr_device_plugin session_driver = {
"session",
"Session-emulating driver",
-/* TODO: Get rid of this global variable. */
-extern GSList *devices;
-
/* Hardware plugin capabilities */
enum {
SR_HWCAP_DUMMY, /* Used to terminate lists */
/* Hardware plugin capabilities */
enum {
SR_HWCAP_DUMMY, /* Used to terminate lists */