#include <sigrok.h>
#include <sigrok-internal.h>
-GSList *devices = NULL;
+static GSList *devices = NULL;
/**
* Scan the system for attached logic analyzers / devices.
#include <string.h>
#include "config.h"
-
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
-HANDLE hdl;
+static HANDLE hdl;
#endif
const char *serial_port_glob[] = {
return TRUE;
}
-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;
#include <sigrok-internal.h>
/* The list of loaded plugins lives here. */
-GSList *plugins;
+static GSList *plugins;
/*
* This enumerates which plugin capabilities correspond to user-settable
extern struct sr_device_plugin alsa_plugin_info;
#endif
-
/* 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
-
return SR_OK;
}
if (plugin->cleanup)
plugin->cleanup();
}
-
}
struct sr_device_instance *sr_device_instance_new(int index, int status,
g_free(sdi->model);
g_free(sdi->version);
g_free(sdi);
-
}
#ifdef HAVE_LIBUSB_1_0
#define CHUNKSIZE 4096
#define DEFAULT_NUM_PROBES 8
-
static int format_match(const char *filename)
{
/* suppress compiler warning */
};
/* There can only be one session at a time. */
+/* 'session' is not static, it's used elsewhere (via 'extern'). */
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)
{
void sr_session_destroy(void)
{
-
g_slist_free(session->devices);
/* TODO: Loop over protocol decoders and free them. */
}
}
free(fds);
-
}
int sr_session_start(void)
void sr_session_run(void)
{
-
sr_info("session: running");
session->running = TRUE;
else
/* real sources, use g_poll() main loop */
sr_session_run_poll();
-
}
void sr_session_halt(void)
{
-
sr_info("session: halting");
session->running = FALSE;
-
}
void sr_session_stop(void)
if (device->plugin && device->plugin->stop_acquisition)
device->plugin->stop_acquisition(device->plugin_index, device);
}
-
}
static void datafeed_dump(struct sr_datafeed_packet *packet)
default:
sr_dbg("bus: received unknown packet type %d", packet->type);
}
-
}
void sr_session_bus(struct sr_device *device, struct sr_datafeed_packet *packet)
free(new_sources);
}
}
-
0,
};
-
static struct session_vdevice *get_vdevice_by_index(int device_index)
{
struct sr_device_instance *sdi;
sr_session_source_remove(-1);
g_free(sessionfile);
-
}
static int hw_opendev(int device_index)
/* Avoid compiler warnings. */
(void)device_index;
- if (devices)
+ if (sr_device_list() != NULL)
return SR_OK;
else
return SR_ERR;
static int *hw_get_capabilities(void)
{
-
return capabilities;
}
return SR_OK;
}
+/* Not static, it's used elsewhere (via 'extern'). */
struct sr_device_plugin session_driver = {
"session",
"Session-emulating driver",
char *trigger;
};
-/* TODO: Get rid of this global variable. */
-extern GSList *devices;
-
/* Hardware plugin capabilities */
enum {
SR_HWCAP_DUMMY, /* Used to terminate lists */