void *cb_data);
/* Dynamic */
- /** Device driver private data. Initialized by init(). */
- void *priv;
+ /** Device driver context, considered private. Initialized by init(). */
+ void *context;
};
/**
if ((!sdi->connection_id) && (sdi->inst_type == SR_INST_USB)) {
/* connection_id isn't populated, let's do that here. */
- drvc = sdi->driver->priv;
+ drvc = sdi->driver->context;
usb = sdi->conn;
if ((cnt = libusb_get_device_list(drvc->sr_ctx->libusb_ctx, &devlist)) < 0) {
const char *conn, *serialcomm;
char *buf, **tokens;
- drvc = di->priv;
+ drvc = di->context;
drvc->instances = NULL;
devices = NULL;
static GSList *dev_list(const struct sr_dev_driver *di)
{
- return ((struct drv_context *)(di->priv))->instances;
+ return ((struct drv_context *)(di->context))->instances;
}
static int cleanup(const struct sr_dev_driver *di)
.dev_close = std_serial_dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};
sr_info("Probing serial port %s.", conn);
- drvc = di->priv;
+ drvc = di->context;
drvc->instances = NULL;
serial_flush(serial);
static GSList *dev_list(const struct sr_dev_driver *di)
{
- return ((struct drv_context *)(di->priv))->instances;
+ return ((struct drv_context *)(di->context))->instances;
}
static int cleanup(const struct sr_dev_driver *di)
.dev_close = std_serial_dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};
(void)options;
- drvc = di->priv;
+ drvc = di->context;
devices = NULL;
static GSList *dev_list(const struct sr_dev_driver *di)
{
- return ((struct drv_context *)(di->priv))->instances;
+ return ((struct drv_context *)(di->context))->instances;
}
/*
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};
char channel[10];
devices = NULL;
- drvc = di->priv;
+ drvc = di->context;
drvc->instances = NULL;
conn = serialcomm = NULL;
static GSList *dev_list(const struct sr_dev_driver *di)
{
- return ((struct drv_context *)(di->priv))->instances;
+ return ((struct drv_context *)(di->context))->instances;
}
static int cleanup(const struct sr_dev_driver *di)
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};
(void)options;
- drvc = di->priv;
+ drvc = di->context;
devices = NULL;
devc = g_malloc0(sizeof(struct dev_context));
static GSList *dev_list(const struct sr_dev_driver *di)
{
- return ((struct drv_context *)(di->priv))->instances;
+ return ((struct drv_context *)(di->context))->instances;
}
static int dev_clear(const struct sr_dev_driver *di)
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};
int i, maxch;
devices = NULL;
- drvc = di->priv;
+ drvc = di->context;
drvc->instances = NULL;
/* Probe for /dev/beaglelogic */
static GSList *dev_list(const struct sr_dev_driver *di)
{
- return ((struct drv_context *)(di->priv))->instances;
+ return ((struct drv_context *)(di->context))->instances;
}
static int dev_clear(const struct sr_dev_driver *di)
GSList *l;
/* unused driver */
- if (!(drvc = di->priv))
+ if (!(drvc = di->context))
return SR_OK;
/* Clean up the instances */
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};
struct sr_config *src;
const char *conn;
- drvc = di->priv;
+ drvc = di->context;
drvc->instances = NULL;
conn = BRYMEN_BC86X;
static GSList *dev_list(const struct sr_dev_driver *di)
{
- return ((struct drv_context *)(di->priv))->instances;
+ return ((struct drv_context *)(di->context))->instances;
}
static int dev_open(struct sr_dev_inst *sdi)
{
struct sr_dev_driver *di = sdi->driver;
- struct drv_context *drvc = di->priv;
+ struct drv_context *drvc = di->context;
struct sr_usb_dev_inst *usb;
struct dev_context *devc;
int ret;
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};
devc = g_malloc0(sizeof(struct dev_context));
sdi->inst_type = SR_INST_SERIAL;
sdi->conn = serial;
- drvc = di->priv;
+ drvc = di->context;
sdi->priv = devc;
sdi->driver = di;
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "P1");
const char *conn, *serialcomm;
devices = NULL;
- drvc = di->priv;
+ drvc = di->context;
drvc->instances = NULL;
conn = serialcomm = NULL;
static GSList *dev_list(const struct sr_dev_driver *di)
{
- return ((struct drv_context *)(di->priv))->instances;
+ return ((struct drv_context *)(di->context))->instances;
}
static int cleanup(const struct sr_dev_driver *di)
.dev_close = std_serial_dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};
return NULL;
devices = NULL;
- drvc = di->priv;
+ drvc = di->context;
start = g_get_monotonic_time();
while (g_get_monotonic_time() - start < MAX_SCAN_TIME_US) {
if (serial_read_nonblocking(serial, &c, 1) == 1 && c == 0xa5) {
static GSList *dev_list(const struct sr_dev_driver *di)
{
- return ((struct drv_context *)(di->priv))->instances;
+ return ((struct drv_context *)(di->context))->instances;
}
static int dev_open(struct sr_dev_inst *sdi)
.dev_close = std_serial_dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};
if (serial_open(serial, SERIAL_RDWR) != SR_OK)
return NULL;
- drvc = center_devs[idx].di->priv;
+ drvc = center_devs[idx].di->context;
devices = NULL;
serial_flush(serial);
static GSList *dev_list(int idx)
{
- return ((struct drv_context *)(center_devs[idx].di->priv))->instances;
+ return ((struct drv_context *)(center_devs[idx].di->context))->instances;
}
static int cleanup(int idx)
.dev_close = std_serial_dev_close, \
.dev_acquisition_start = dev_acquisition_start_##ID_UPPER, \
.dev_acquisition_stop = dev_acquisition_stop, \
- .priv = NULL, \
+ .context = NULL, \
};
DRV(center_309, CENTER_309, "center-309", "Center 309")
ret = SR_OK;
- drvc = di->priv;
+ drvc = di->context;
/* Allocate memory for our private device context. */
devc = g_malloc0(sizeof(struct dev_context));
static GSList *dev_list(const struct sr_dev_driver *di)
{
- return ((struct drv_context *)(di->priv))->instances;
+ return ((struct drv_context *)(di->context))->instances;
}
static int dev_open(struct sr_dev_inst *sdi)
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};
GSList *devices, *l;
const char *conn, *serialcomm;
- drvc = di->priv;
+ drvc = di->context;
drvc->instances = NULL;
devices = NULL;
static GSList *dev_list(const struct sr_dev_driver *di)
{
- return ((struct drv_context *)(di->priv))->instances;
+ return ((struct drv_context *)(di->context))->instances;
}
static int dev_open(struct sr_dev_inst *sdi)
.dev_close = std_serial_dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};
const char *conn, *serialcomm;
devices = NULL;
- drvc = di->priv;
+ drvc = di->context;
drvc->instances = NULL;
conn = serialcomm = NULL;
static GSList *dev_list(const struct sr_dev_driver *di)
{
- return ((struct drv_context *)(di->priv))->instances;
+ return ((struct drv_context *)(di->context))->instances;
}
static int cleanup(const struct sr_dev_driver *di)
.dev_close = std_serial_dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};
int num_logic_channels, num_analog_channels, pattern, i;
char channel_name[16];
- drvc = di->priv;
+ drvc = di->context;
num_logic_channels = DEFAULT_NUM_LOGIC_CHANNELS;
num_analog_channels = DEFAULT_NUM_ANALOG_CHANNELS;
static GSList *dev_list(const struct sr_dev_driver *di)
{
- return ((struct drv_context *)(di->priv))->instances;
+ return ((struct drv_context *)(di->context))->instances;
}
static int dev_open(struct sr_dev_inst *sdi)
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};
{
struct drv_context *drvc;
- drvc = di->priv;
+ drvc = di->context;
sdi->driver = di;
drvc->instances = g_slist_append(drvc->instances, sdi);
static GSList *dev_list(const struct sr_dev_driver *di)
{
- return ((struct drv_context *)di->priv)->instances;
+ return ((struct drv_context *)di->context)->instances;
}
#define LOG_PREFIX "deree-de5000"
.dev_close = std_serial_dev_close,
.dev_acquisition_start = es51919_serial_acquisition_start,
.dev_acquisition_stop = es51919_serial_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};
if (serial_open(serial, SERIAL_RDWR) != SR_OK)
return NULL;
- drvc = di->priv;
+ drvc = di->context;
b = buf;
retry = 0;
devices = NULL;
static GSList *dev_list(const struct sr_dev_driver *di)
{
- return ((struct drv_context *)(di->priv))->instances;
+ return ((struct drv_context *)(di->context))->instances;
}
static int cleanup(const struct sr_dev_driver *di)
.dev_close = std_serial_dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};
const char *conn;
char manufacturer[64], product[64], serial_num[64], connection_id[64];
- drvc = di->priv;
+ drvc = di->context;
conn = NULL;
for (l = options; l; l = l->next) {
static GSList *dev_list(const struct sr_dev_driver *di)
{
- return ((struct drv_context *)(di->priv))->instances;
+ return ((struct drv_context *)(di->context))->instances;
}
static int dev_open(struct sr_dev_inst *sdi)
int ret;
struct drv_context *drvc;
- if (!(drvc = di->priv))
+ if (!(drvc = di->context))
return SR_OK;
ret = std_dev_clear(di, NULL);
return SR_ERR_DEV_CLOSED;
di = sdi->driver;
- drvc = di->priv;
+ drvc = di->context;
devc = sdi->priv;
devc->ctx = drvc->sr_ctx;
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};
uint8_t revid;
char connection_id[64];
- drvc = di->priv;
+ drvc = di->context;
devc = sdi->priv;
usb = sdi->conn;
gboolean serialcomm_given;
devices = NULL;
- drvc = di->priv;
+ drvc = di->context;
drvc->instances = NULL;
conn = serialcomm = NULL;
model = METRAHIT_NONE;
conn = serialcomm = NULL;
devices = NULL;
- drvc = di->priv;
+ drvc = di->context;
drvc->instances = NULL;
sr_spew("scan_2x_bd232() called!");
static GSList *dev_list(const struct sr_dev_driver *di)
{
- return ((struct drv_context *)(di->priv))->instances;
+ return ((struct drv_context *)(di->context))->instances;
}
static int dev_close(struct sr_dev_inst *sdi)
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start_1x_2x_rs232,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};
SR_PRIV struct sr_dev_driver gmc_mh_2x_bd232_driver_info = {
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start_2x_bd232,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};
static GSList *scan(struct sr_dev_driver *di, GSList *options)
{
- return sr_scpi_scan(di->priv, options, hmo_probe_serial_device);
+ return sr_scpi_scan(di->context, options, hmo_probe_serial_device);
}
static GSList *dev_list(const struct sr_dev_driver *di)
{
- return ((struct drv_context *)(di->priv))->instances;
+ return ((struct drv_context *)(di->context))->instances;
}
static void clear_helper(void *priv)
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};
devc->triggersource = g_strdup(DEFAULT_TRIGGER_SOURCE);
devc->triggerposition = DEFAULT_HORIZ_TRIGGERPOS;
sdi->priv = devc;
- drvc = hantek_dso_driver_info.priv;
+ drvc = hantek_dso_driver_info.context;
drvc->instances = g_slist_append(drvc->instances, sdi);
return sdi;
const char *conn;
char connection_id[64];
- drvc = di->priv;
+ drvc = di->context;
devices = 0;
static GSList *dev_list(const struct sr_dev_driver *di)
{
- return ((struct drv_context *)(di->priv))->instances;
+ return ((struct drv_context *)(di->context))->instances;
}
static int dev_open(struct sr_dev_inst *sdi)
sdi = cb_data;
di = sdi->driver;
- drvc = di->priv;
+ drvc = di->context;
devc = sdi->priv;
if (devc->dev_state == STOPPING) {
/* We've been told to wind up the acquisition. */
{
struct dev_context *devc;
struct sr_dev_driver *di = sdi->driver;
- struct drv_context *drvc = di->priv;
+ struct drv_context *drvc = di->context;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};
SR_PRIV int dso_open(struct sr_dev_inst *sdi)
{
struct dev_context *devc;
- struct drv_context *drvc = hantek_dso_driver_info.priv;
+ struct drv_context *drvc = hantek_dso_driver_info.context;
struct sr_usb_dev_inst *usb;
struct libusb_device_descriptor des;
libusb_device **devlist;
(void)options;
devices = NULL;
- drvc = di->priv;
+ drvc = di->context;
drvc->instances = NULL;
usb_devices = sr_usb_find(drvc->sr_ctx->libusb_ctx, USB_VID_PID);
static GSList *dev_list(const struct sr_dev_driver *di)
{
- return ((struct drv_context *)(di->priv))->instances;
+ return ((struct drv_context *)(di->context))->instances;
}
static void clear_dev_context(void *priv)
uint8_t buffer[PACKET_LENGTH];
int ret;
- if (!(drvc = di->priv)) {
+ if (!(drvc = di->context)) {
sr_err("Driver was not initialized.");
return SR_ERR;
}
struct sr_dev_driver *di = sdi->driver;
struct sr_usb_dev_inst *usb;
- if (!di->priv) {
+ if (!di->context) {
sr_err("Driver was not initialized.");
return SR_ERR;
}
return SR_ERR_DEV_CLOSED;
devc = sdi->priv;
- drvc = di->priv;
+ drvc = di->context;
devc->cb_data = cb_data;
devc->wait_data_ready_locked = TRUE;
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};
return TRUE;
di = sdi->driver;
- drvc = di->priv;
+ drvc = di->context;
current_time = g_get_monotonic_time();
if (devc->state == STATE_WAIT_DATA_READY &&
uint8_t buffer[PACKET_LENGTH];
int ret;
- drvc = ikalogic_scanalogic2_driver_info.priv;
+ drvc = ikalogic_scanalogic2_driver_info.context;
if (!dev_info)
return SR_ERR_ARG;
(void)options;
- drvc = di->priv;
+ drvc = di->context;
devices = NULL;
static GSList *dev_list(const struct sr_dev_driver *di)
{
- return ((struct drv_context *)(di->priv))->instances;
+ return ((struct drv_context *)(di->context))->instances;
}
static int dev_open(struct sr_dev_inst *sdi)
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};
int len, ret;
unsigned char cmd, buf[32];
- drvc = di->priv;
+ drvc = di->context;
if (sr_usb_open(drvc->sr_ctx->libusb_ctx, usb) != SR_OK)
return SR_ERR;
(void)options;
- drvc = di->priv;
+ drvc = di->context;
drvc->instances = NULL;
devices = NULL;
static GSList *dev_list(const struct sr_dev_driver *di)
{
- return ((struct drv_context *)(di->priv))->instances;
+ return ((struct drv_context *)(di->context))->instances;
}
static int dev_open(struct sr_dev_inst *sdi)
struct sr_usb_dev_inst *usb;
int ret;
- if (!(drvc = di->priv)) {
+ if (!(drvc = di->context)) {
sr_err("Driver was not initialized.");
return SR_ERR;
}
struct dev_context *devc;
struct sr_usb_dev_inst *usb;
- if (!di->priv) {
+ if (!di->context) {
sr_err("Driver was not initialized.");
return SR_ERR;
}
int ret;
struct drv_context *drvc;
- if (!(drvc = di->priv))
+ if (!(drvc = di->context))
/* Can get called on an unused driver, doesn't matter. */
return SR_OK;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
- if (!di->priv) {
+ if (!di->context) {
sr_err("Driver was not initialized.");
return SR_ERR;
}
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
- drvc = di->priv;
+ drvc = di->context;
devc = sdi->priv;
usb = sdi->conn;
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};
devc = sdi->priv;
usb = sdi->conn;
di = sdi->driver;
- drvc = di->priv;
+ drvc = di->context;
memset(&tv, 0, sizeof(struct timeval));
libusb_handle_events_timeout_completed(drvc->sr_ctx->libusb_ctx, &tv,
GSList *usb_devices, *devices, *l;
const char *conn;
- drvc = di->priv;
+ drvc = di->context;
conn = NULL;
for (l = options; l; l = l->next) {
static GSList *dev_list(const struct sr_dev_driver *di)
{
- return ((struct drv_context *)(di->priv))->instances;
+ return ((struct drv_context *)(di->context))->instances;
}
static int dev_open(struct sr_dev_inst *sdi)
struct sr_usb_dev_inst *usb;
int ret;
- if (!(drvc = di->priv)) {
+ if (!(drvc = di->context)) {
sr_err("Driver was not initialized.");
return SR_ERR;
}
struct sr_dev_driver *di = sdi->driver;
struct sr_usb_dev_inst *usb;
- if (!di->priv) {
+ if (!di->context) {
sr_err("Driver was not initialized.");
return SR_ERR;
}
int ret;
struct drv_context *drvc;
- if (!(drvc = di->priv))
+ if (!(drvc = di->context))
/* Can get called on an unused driver, doesn't matter. */
return SR_OK;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
- if (!di->priv) {
+ if (!di->context) {
sr_err("Driver was not initialized.");
return SR_ERR;
}
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
- if (!di->priv) {
+ if (!di->context) {
sr_err("Driver was not initialized.");
return SR_ERR;
}
- drvc = di->priv;
+ drvc = di->context;
devc = sdi->priv;
usb = sdi->conn;
devc->cb_data = cb_data;
struct sr_dev_driver *di = sdi->driver;
(void)cb_data;
- if (!di->priv) {
+ if (!di->context) {
sr_err("Driver was not initialized.");
return SR_ERR;
}
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};
sr_spew("Reading config block.");
- drvc = di->priv;
+ drvc = di->context;
*configlen = 0;
if (!(xfer_in = libusb_alloc_transfer(0)) ||
sr_spew("Writing config block.");
- drvc = di->priv;
+ drvc = di->context;
if (!(xfer_in = libusb_alloc_transfer(0)) ||
!(xfer_out = libusb_alloc_transfer(0)))
int dummy, ret, i;
unsigned char config[MAX_CONFIGBLOCK_SIZE];
- drvc = di->priv;
+ drvc = di->context;
sdi = NULL;
libusb_get_device_list(drvc->sr_ctx->libusb_ctx, &devlist);
SR_PRIV int lascar_el_usb_handle_events(int fd, int revents, void *cb_data)
{
- struct drv_context *drvc = di->priv;
+ struct drv_context *drvc = di->context;
struct sr_datafeed_packet packet;
struct sr_dev_inst *sdi;
struct timeval tv;
struct dev_context *devc;
int ret = SR_OK;
- if (!(drvc = di->priv))
+ if (!(drvc = di->context))
return SR_OK;
/* Properly close and free all devices. */
}
//Add the driver
- struct drv_context *drvc = di->priv;
+ struct drv_context *drvc = di->context;
drvc->instances = g_slist_append(drvc->instances, sdi);
devices = g_slist_append(devices, sdi);
}
static GSList *dev_list(const struct sr_dev_driver *di)
{
- return ((struct drv_context *)(di->priv))->instances;
+ return ((struct drv_context *)(di->context))->instances;
}
static int dev_open(struct sr_dev_inst *sdi)
.dev_close = std_serial_dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};
GSList *l;
int i;
- struct drv_context *drvc = di->priv;
+ struct drv_context *drvc = di->context;
/* Find this device's devc struct by its fd. */
struct dev_context *devc = NULL;
struct sr_serial_dev_inst *serial;
char reply[50], **tokens, *dummy;
- drvc = di->priv;
+ drvc = di->context;
drvc->instances = NULL;
devices = NULL;
conn = NULL;
static GSList *dev_list(const struct sr_dev_driver *di)
{
- return ((struct drv_context *)(di->priv))->instances;
+ return ((struct drv_context *)(di->context))->instances;
}
static int cleanup(const struct sr_dev_driver *di)
.dev_close = std_serial_dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};
if (!g_slist_find_custom(options, &default_modbusaddr, config_compare))
opts = g_slist_prepend(opts, &default_modbusaddr);
- devices = sr_modbus_scan(di->priv, opts, probe_device);
+ devices = sr_modbus_scan(di->context, opts, probe_device);
while (opts != options)
opts = g_slist_delete_link(opts, opts);
static GSList *dev_list(const struct sr_dev_driver *di)
{
- return ((struct drv_context *)(di->priv))->instances;
+ return ((struct drv_context *)(di->context))->instances;
}
static int dev_clear(const struct sr_dev_driver *di)
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};
if (serial_open(serial, SERIAL_RDWR) != SR_OK)
return NULL;
- drvc = mic_devs[idx].di->priv;
+ drvc = mic_devs[idx].di->context;
devices = NULL;
serial_flush(serial);
static GSList *dev_list(int idx)
{
- return ((struct drv_context *)(mic_devs[idx].di->priv))->instances;
+ return ((struct drv_context *)(mic_devs[idx].di->context))->instances;
}
static int cleanup(int idx)
.dev_close = std_serial_dev_close, \
.dev_acquisition_start = dev_acquisition_start_##ID_UPPER, \
.dev_acquisition_stop = dev_acquisition_stop, \
- .priv = NULL, \
+ .context = NULL, \
};
DRV(mic_98581, MIC_98581, "mic-98581", "MIC 98581")
static GSList *dev_list_lps301(const struct sr_dev_driver *di)
{
- return ((struct drv_context *)(di->priv))->instances;
+ return ((struct drv_context *)(di->context))->instances;
}
static void dev_clear_private(struct dev_context* devc)
.dev_close = std_serial_dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};
static GSList *dev_list(const struct sr_dev_driver *di)
{
- return ((struct drv_context *)(di->priv))->instances;
+ return ((struct drv_context *)(di->context))->instances;
}
static int dev_close(struct sr_dev_inst *sdi)
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};
SR_PRIV struct sr_dev_driver siemens_b102x_driver_info = {
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};
const char *conn, *serialcomm;
char buf[8];
- drvc = di->priv;
+ drvc = di->context;
devices = NULL;
static GSList *dev_list(const struct sr_dev_driver *di)
{
- return ((struct drv_context *)(di->priv))->instances;
+ return ((struct drv_context *)(di->context))->instances;
}
static int cleanup(const struct sr_dev_driver *di)
.dev_close = std_serial_dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};
(void)options;
- drvc = di->priv;
+ drvc = di->context;
devices = NULL;
static GSList *dev_list(const struct sr_dev_driver *di)
{
- return ((struct drv_context *)(di->priv))->instances;
+ return ((struct drv_context *)(di->context))->instances;
}
static void clear_helper(void *priv)
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};
static GSList *scan(struct sr_dev_driver *di, GSList *options)
{
- return sr_scpi_scan(di->priv, options, probe_device);
+ return sr_scpi_scan(di->context, options, probe_device);
}
static GSList *dev_list(const struct sr_dev_driver *di)
{
- return ((struct drv_context *)(di->priv))->instances;
+ return ((struct drv_context *)(di->context))->instances;
}
static int dev_open(struct sr_dev_inst *sdi)
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};
const char *conn;
char connection_id[64];
- drvc = di->priv;
+ drvc = di->context;
conn = NULL;
for (l = options; l; l = l->next) {
static GSList *dev_list(const struct sr_dev_driver *di)
{
- return ((struct drv_context *)(di->priv))->instances;
+ return ((struct drv_context *)(di->context))->instances;
}
static int logic16_dev_open(struct sr_dev_inst *sdi)
char connection_id[64];
di = sdi->driver;
- drvc = di->priv;
+ drvc = di->context;
usb = sdi->conn;
if (sdi->status == SR_ST_ACTIVE)
int ret;
struct drv_context *drvc;
- if (!(drvc = di->priv))
+ if (!(drvc = di->context))
/* Can get called on an unused driver, doesn't matter. */
return SR_OK;
sdi = cb_data;
di = sdi->driver;
- drvc = di->priv;
+ drvc = di->context;
devc = sdi->priv;
tv.tv_sec = tv.tv_usec = 0;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
- drvc = di->priv;
+ drvc = di->context;
devc = sdi->priv;
usb = sdi->conn;
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};
static GSList *scan(struct sr_dev_driver *di, GSList *options)
{
- return sr_scpi_scan(di->priv, options, probe_device);
+ return sr_scpi_scan(di->context, options, probe_device);
}
static GSList *dev_list(const struct sr_dev_driver *di)
{
- return ((struct drv_context *)(di->priv))->instances;
+ return ((struct drv_context *)(di->context))->instances;
}
static int dev_clear(const struct sr_dev_driver *di)
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};
sr_info("Probing serial port %s.", conn);
- drvc = di->priv;
+ drvc = di->context;
devices = NULL;
serial_flush(serial);
static GSList *dev_list(const struct sr_dev_driver *di)
{
- return ((struct drv_context *)(di->priv))->instances;
+ return ((struct drv_context *)(di->context))->instances;
}
static int cleanup(const struct sr_dev_driver *di)
.dev_close = std_serial_dev_close, \
.dev_acquisition_start = dev_acquisition_start, \
.dev_acquisition_stop = dev_acquisition_stop, \
- .priv = NULL, \
+ .context = NULL, \
}, \
VENDOR, MODEL, CONN, BAUDRATE, PACKETSIZE, TIMEOUT, DELAY, \
REQUEST, VALID, PARSE, DETAILS, sizeof(struct CHIPSET##_info) \
struct sr_config *src;
const char *conn;
- drvc = di->priv;
+ drvc = di->context;
conn = USB_VID_PID;
for (node = options; node != NULL; node = node->next) {
{
struct drv_context *drvc;
- drvc = di->priv;
+ drvc = di->context;
return drvc->instances;
}
struct sr_usb_dev_inst *usb;
int ret;
- drvc = di->priv;
+ drvc = di->context;
if (!drvc) {
sr_err("Driver was not initialized.");
{
struct sr_usb_dev_inst *usb;
- if (!di->priv) {
+ if (!di->context) {
sr_err("Driver was not initialized.");
return SR_ERR;
}
return SR_ERR_DEV_CLOSED;
devc = sdi->priv;
- drvc = di->priv;
+ drvc = di->context;
if (devc->acquisition) {
sr_err("Acquisition still in progress?");
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};
sr_info("Probing serial port %s.", conn);
- drvc = di->priv;
+ drvc = di->context;
drvc->instances = NULL;
serial_flush(serial);
static GSList *dev_list(const struct sr_dev_driver *di)
{
- return ((struct drv_context *)(di->priv))->instances;
+ return ((struct drv_context *)(di->context))->instances;
}
static int cleanup(const struct sr_dev_driver *di)
.dev_close = std_serial_dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};
char manufacturer[64], product[64], connection_id[64];
devices = NULL;
- drvc = di->priv;
+ drvc = di->context;
drvc->instances = NULL;
conn_devices = NULL;
static GSList *dev_list(const struct sr_dev_driver *di)
{
- return ((struct drv_context *)(di->priv))->instances;
+ return ((struct drv_context *)(di->context))->instances;
}
static int dev_clear(const struct sr_dev_driver *di)
static int dev_open(struct sr_dev_inst *sdi)
{
struct sr_dev_driver *di = sdi->driver;
- struct drv_context *drvc = di->priv;
+ struct drv_context *drvc = di->context;
struct sr_usb_dev_inst *usb;
libusb_device **devlist;
int ret, i;
char connection_id[64];
- if (!di->priv) {
+ if (!di->context) {
sr_err("Driver was not initialized.");
return SR_ERR;
}
struct sr_dev_driver *di = sdi->driver;
struct sr_usb_dev_inst *usb;
- if (!di->priv) {
+ if (!di->context) {
sr_err("Driver was not initialized.");
return SR_ERR;
}
int ret;
struct drv_context *drvc;
- if (!(drvc = di->priv))
+ if (!(drvc = di->context))
return SR_OK;
ret = dev_clear(di);
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
- if (!di->priv) {
+ if (!di->context) {
sr_err("Driver was not initialized.");
return SR_ERR;
}
sdi = cb_data;
devc = sdi->priv;
di = sdi->driver;
- drvc = di->priv;
+ drvc = di->context;
if (devc->limit_msec) {
now = g_get_monotonic_time() / 1000;
int ret;
unsigned char *buf;
- drvc = di->priv;
+ drvc = di->context;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
- if (!di->priv) {
+ if (!di->context) {
sr_err("Driver was not initialized.");
return SR_ERR;
}
struct sr_dev_driver *di = sdi->driver;
(void)cb_data;
- if (!di->priv) {
+ if (!di->context) {
sr_err("Driver was not initialized.");
return SR_ERR;
}
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};
const char *conn, *serialcomm;
struct sr_serial_dev_inst *serial;
- drvc = di->priv;
+ drvc = di->context;
drvc->instances = NULL;
devices = NULL;
static GSList *dev_list(const struct sr_dev_driver *di)
{
- return ((struct drv_context *)(di->priv))->instances;
+ return ((struct drv_context *)(di->context))->instances;
}
static int cleanup(const struct sr_dev_driver *di)
.dev_close = std_serial_dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};
struct sr_config *src;
const char *conn;
- drvc = di->priv;
+ drvc = di->context;
dmm = (struct dmm_info *)di;
conn = NULL;
static GSList *dev_list(const struct sr_dev_driver *di)
{
- return ((struct drv_context *)(di->priv))->instances;
+ return ((struct drv_context *)(di->context))->instances;
}
static int dev_open(struct sr_dev_inst *sdi)
int ret;
di = sdi->driver;
- drvc = di->priv;
+ drvc = di->context;
usb = sdi->conn;
if ((ret = sr_usb_open(drvc->sr_ctx->libusb_ctx, usb)) == SR_OK)
.dev_close = dev_close, \
.dev_acquisition_start = dev_acquisition_start, \
.dev_acquisition_stop = dev_acquisition_stop, \
- .priv = NULL, \
+ .context = NULL, \
}, \
VENDOR, MODEL, BAUDRATE, PACKETSIZE, \
VALID, PARSE, DETAILS, sizeof(struct CHIPSET##_info) \
unsigned int i;
const char *conn;
- drvc = di->priv;
+ drvc = di->context;
drvc->instances = NULL;
conn = NULL;
static GSList *dev_list(const struct sr_dev_driver *di)
{
- return ((struct drv_context *)(di->priv))->instances;
+ return ((struct drv_context *)(di->context))->instances;
}
static int dev_open(struct sr_dev_inst *sdi)
struct sr_usb_dev_inst *usb;
int ret;
- if (!(drvc = di->priv)) {
+ if (!(drvc = di->context)) {
sr_err("Driver was not initialized.");
return SR_ERR;
}
struct sr_dev_driver *di = sdi->driver;
struct sr_usb_dev_inst *usb;
- if (!di->priv) {
+ if (!di->context) {
sr_err("Driver was not initialized.");
return SR_ERR;
}
int ret;
struct drv_context *drvc;
- if (!(drvc = di->priv))
+ if (!(drvc = di->context))
/* Can get called on an unused driver, doesn't matter. */
return SR_OK;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
- if (!di->priv) {
+ if (!di->context) {
sr_err("Driver was not initialized.");
return SR_ERR;
}
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
- drvc = di->priv;
+ drvc = di->context;
devc = sdi->priv;
usb = sdi->conn;
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};
return TRUE;
di = sdi->driver;
- drvc = di->priv;
+ drvc = di->context;
if (!(devc = sdi->priv))
return TRUE;
(void)options;
- drvc = di->priv;
+ drvc = di->context;
devices = NULL;
libusb_get_device_list(drvc->sr_ctx->libusb_ctx, &devlist);
static GSList *dev_list(const struct sr_dev_driver *di)
{
- return ((struct drv_context *)(di->priv))->instances;
+ return ((struct drv_context *)(di->context))->instances;
}
static int dev_open(struct sr_dev_inst *sdi)
{
struct sr_dev_driver *di = sdi->driver;
- struct drv_context *drvc = di->priv;
+ struct drv_context *drvc = di->context;
struct sr_usb_dev_inst *usb;
libusb_device **devlist;
int ret, i;
char connection_id[64];
- if (!di->priv) {
+ if (!di->context) {
sr_err("Driver was not initialized.");
return SR_ERR;
}
struct sr_dev_driver *di = sdi->driver;
struct sr_usb_dev_inst *usb;
- if (!di->priv) {
+ if (!di->context) {
sr_err("Driver was not initialized.");
return SR_ERR;
}
int ret;
struct drv_context *drvc;
- if (!(drvc = di->priv))
+ if (!(drvc = di->context))
/* Can get called on an unused driver, doesn't matter. */
return SR_OK;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
- if (!di->priv) {
+ if (!di->context) {
sr_err("Driver was not initialized.");
return SR_ERR;
}
sdi = cb_data;
devc = sdi->priv;
di = sdi->driver;
- drvc = di->priv;
+ drvc = di->context;
if (devc->limit_msec) {
now = g_get_monotonic_time() / 1000;
{
struct sr_dev_driver *di = sdi->driver;
struct dev_context *devc;
- struct drv_context *drvc = di->priv;
+ struct drv_context *drvc = di->context;
struct sr_usb_dev_inst *usb;
struct libusb_transfer *transfer;
int ret;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
- if (!di->priv) {
+ if (!di->context) {
sr_err("Driver was not initialized.");
return SR_ERR;
}
struct sr_dev_driver *di = sdi->driver;
(void)cb_data;
- if (!di->priv) {
+ if (!di->context) {
sr_err("Driver was not initialized.");
return SR_ERR;
}
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};
static GSList *scan(struct sr_dev_driver *di, GSList *options)
{
- return sr_scpi_scan(di->priv, options, probe_usbtmc_device);
+ return sr_scpi_scan(di->context, options, probe_usbtmc_device);
}
static GSList *dev_list(const struct sr_dev_driver *di)
{
- return ((struct drv_context *)(di->priv))->instances;
+ return ((struct drv_context *)(di->context))->instances;
}
static void clear_helper(void *priv)
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};
(void)options;
- drvc = di->priv;
+ drvc = di->context;
devices = NULL;
static GSList *dev_list(const struct sr_dev_driver *di)
{
- return ((struct drv_context *)(di->priv))->instances;
+ return ((struct drv_context *)(di->context))->instances;
}
static int dev_open(struct sr_dev_inst *sdi)
int device_count, ret, i;
char connection_id[64];
- drvc = di->priv;
+ drvc = di->context;
usb = sdi->conn;
if (!(devc = sdi->priv)) {
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
- .priv = NULL,
+ .context = NULL,
};
return NULL;
}
- if (!driver->priv) {
+ if (!driver->context) {
sr_err("Driver not initialized, can't scan for devices.");
return NULL;
}
for (i = 0; drivers[i]; i++) {
if (drivers[i]->cleanup)
drivers[i]->cleanup(drivers[i]);
- drivers[i]->priv = NULL;
+ drivers[i]->context = NULL;
}
}
struct drv_context *drvc;
GSList *l;
- drvc = di->priv;
+ drvc = di->context;
for (l = drvc->instances; l; l = l->next)
sr_dev_inst_free(l->data);
g_slist_free(drvc->instances);
struct session_vdev *vdev;
di = sdi->driver;
- drvc = di->priv;
+ drvc = di->context;
vdev = g_malloc0(sizeof(struct session_vdev));
sdi->priv = vdev;
drvc->instances = g_slist_append(drvc->instances, sdi);
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = NULL,
- .priv = NULL,
+ .context = NULL,
};
drvc = g_malloc0(sizeof(struct drv_context));
drvc->sr_ctx = sr_ctx;
drvc->instances = NULL;
- di->priv = drvc;
+ di->context = drvc;
return SR_OK;
}
GSList *l;
int ret;
- if (!(drvc = driver->priv))
+ if (!(drvc = driver->context))
/* Driver was never initialized, nothing to do. */
return SR_OK;