Fix #442 by renaming sr_dev_driver.priv to .context

This commit is contained in:
Soeren Apel 2015-07-06 21:55:36 +02:00 committed by Uwe Hermann
parent c11a1e6122
commit 41812aca43
57 changed files with 214 additions and 214 deletions

View File

@ -1073,8 +1073,8 @@ struct sr_dev_driver {
void *cb_data);
/* Dynamic */
/** Device driver private data. Initialized by init(). */
void *priv;
/** Device driver context, considered private. Initialized by init(). */
void *context;
};
/**

View File

@ -547,7 +547,7 @@ SR_API const char *sr_dev_inst_connid_get(const struct sr_dev_inst *sdi)
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) {

View File

@ -89,7 +89,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
const char *conn, *serialcomm;
char *buf, **tokens;
drvc = di->priv;
drvc = di->context;
drvc->instances = NULL;
devices = NULL;
@ -163,7 +163,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
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)
@ -275,5 +275,5 @@ SR_PRIV struct sr_dev_driver agdmm_driver_info = {
.dev_close = std_serial_dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
.context = NULL,
};

View File

@ -86,7 +86,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
sr_info("Probing serial port %s.", conn);
drvc = di->priv;
drvc = di->context;
drvc->instances = NULL;
serial_flush(serial);
@ -122,7 +122,7 @@ scan_cleanup:
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)
@ -281,5 +281,5 @@ SR_PRIV struct sr_dev_driver appa_55ii_driver_info = {
.dev_close = std_serial_dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
.context = NULL,
};

View File

@ -345,7 +345,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
(void)options;
drvc = di->priv;
drvc = di->context;
devices = NULL;
@ -411,7 +411,7 @@ free:
static GSList *dev_list(const struct sr_dev_driver *di)
{
return ((struct drv_context *)(di->priv))->instances;
return ((struct drv_context *)(di->context))->instances;
}
/*
@ -1554,5 +1554,5 @@ SR_PRIV struct sr_dev_driver asix_sigma_driver_info = {
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
.context = NULL,
};

View File

@ -100,7 +100,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options, int modelid)
char channel[10];
devices = NULL;
drvc = di->priv;
drvc = di->context;
drvc->instances = NULL;
conn = serialcomm = NULL;
@ -201,7 +201,7 @@ static GSList *scan_3203(struct sr_dev_driver *di, GSList *options)
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)
@ -523,5 +523,5 @@ SR_PRIV struct sr_dev_driver atten_pps3203_driver_info = {
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
.context = NULL,
};

View File

@ -68,7 +68,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
(void)options;
drvc = di->priv;
drvc = di->context;
devices = NULL;
devc = g_malloc0(sizeof(struct dev_context));
@ -143,7 +143,7 @@ err_out:
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)
@ -442,5 +442,5 @@ SR_PRIV struct sr_dev_driver baylibre_acme_driver_info = {
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
.context = NULL,
};

View File

@ -87,7 +87,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
int i, maxch;
devices = NULL;
drvc = di->priv;
drvc = di->context;
drvc->instances = NULL;
/* Probe for /dev/beaglelogic */
@ -146,7 +146,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
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)
@ -205,7 +205,7 @@ static int cleanup(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 */
@ -422,5 +422,5 @@ SR_PRIV struct sr_dev_driver beaglelogic_driver_info = {
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
.context = NULL,
};

View File

@ -49,7 +49,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
struct sr_config *src;
const char *conn;
drvc = di->priv;
drvc = di->context;
drvc->instances = NULL;
conn = BRYMEN_BC86X;
@ -93,13 +93,13 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
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;
@ -299,5 +299,5 @@ SR_PRIV struct sr_dev_driver brymen_bm86x_driver_info = {
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
.context = NULL,
};

View File

@ -80,7 +80,7 @@ static GSList *brymen_scan(const char *conn, const char *serialcomm)
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");
@ -101,7 +101,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
const char *conn, *serialcomm;
devices = NULL;
drvc = di->priv;
drvc = di->context;
drvc->instances = NULL;
conn = serialcomm = NULL;
@ -132,7 +132,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
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)
@ -249,5 +249,5 @@ SR_PRIV struct sr_dev_driver brymen_bm857_driver_info = {
.dev_close = std_serial_dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
.context = NULL,
};

View File

@ -102,7 +102,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
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) {
@ -137,7 +137,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
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)
@ -431,5 +431,5 @@ SR_PRIV struct sr_dev_driver cem_dt_885x_driver_info = {
.dev_close = std_serial_dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
.context = NULL,
};

View File

@ -79,7 +79,7 @@ static GSList *center_scan(const char *conn, const char *serialcomm, int idx)
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);
@ -140,7 +140,7 @@ static GSList *scan(GSList *options, int idx)
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)
@ -278,7 +278,7 @@ SR_PRIV struct sr_dev_driver ID##_driver_info = { \
.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")

View File

@ -83,7 +83,7 @@ static int add_device(int idx, int model, GSList **devices)
ret = SR_OK;
drvc = di->priv;
drvc = di->context;
/* Allocate memory for our private device context. */
devc = g_malloc0(sizeof(struct dev_context));
@ -191,7 +191,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
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)
@ -542,5 +542,5 @@ SR_PRIV struct sr_dev_driver chronovu_la_driver_info = {
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
.context = NULL,
};

View File

@ -58,7 +58,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
GSList *devices, *l;
const char *conn, *serialcomm;
drvc = di->priv;
drvc = di->context;
drvc->instances = NULL;
devices = NULL;
@ -98,7 +98,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
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)
@ -219,5 +219,5 @@ SR_PRIV struct sr_dev_driver colead_slm_driver_info = {
.dev_close = std_serial_dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
.context = NULL,
};

View File

@ -55,7 +55,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
const char *conn, *serialcomm;
devices = NULL;
drvc = di->priv;
drvc = di->context;
drvc->instances = NULL;
conn = serialcomm = NULL;
@ -107,7 +107,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
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)
@ -218,5 +218,5 @@ SR_PRIV struct sr_dev_driver conrad_digi_35_cpu_driver_info = {
.dev_close = std_serial_dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
.context = NULL,
};

View File

@ -278,7 +278,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
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;
@ -370,7 +370,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
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)
@ -925,5 +925,5 @@ SR_PRIV struct sr_dev_driver demo_driver_info = {
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
.context = NULL,
};

View File

@ -28,7 +28,7 @@ static void std_dev_attach(struct sr_dev_driver *di, struct sr_dev_inst *sdi)
{
struct drv_context *drvc;
drvc = di->priv;
drvc = di->context;
sdi->driver = di;
drvc->instances = g_slist_append(drvc->instances, sdi);
@ -36,7 +36,7 @@ static void std_dev_attach(struct sr_dev_driver *di, struct sr_dev_inst *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"
@ -81,5 +81,5 @@ SR_PRIV struct sr_dev_driver deree_de5000_driver_info = {
.dev_close = std_serial_dev_close,
.dev_acquisition_start = es51919_serial_acquisition_start,
.dev_acquisition_stop = es51919_serial_acquisition_stop,
.priv = NULL,
.context = NULL,
};

View File

@ -79,7 +79,7 @@ static GSList *fluke_scan(struct sr_dev_driver *di, const char *conn,
if (serial_open(serial, SERIAL_RDWR) != SR_OK)
return NULL;
drvc = di->priv;
drvc = di->context;
b = buf;
retry = 0;
devices = NULL;
@ -190,7 +190,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
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)
@ -305,5 +305,5 @@ SR_PRIV struct sr_dev_driver flukedmm_driver_info = {
.dev_close = std_serial_dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
.context = NULL,
};

View File

@ -193,7 +193,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
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) {
@ -355,7 +355,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
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)
@ -468,7 +468,7 @@ static int cleanup(const struct sr_dev_driver *di)
int ret;
struct drv_context *drvc;
if (!(drvc = di->priv))
if (!(drvc = di->context))
return SR_OK;
ret = std_dev_clear(di, NULL);
@ -764,7 +764,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
return SR_ERR_DEV_CLOSED;
di = sdi->driver;
drvc = di->priv;
drvc = di->context;
devc = sdi->priv;
devc->ctx = drvc->sr_ctx;
@ -815,5 +815,5 @@ SR_PRIV struct sr_dev_driver fx2lafw_driver_info = {
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
.context = NULL,
};

View File

@ -194,7 +194,7 @@ SR_PRIV int fx2lafw_dev_open(struct sr_dev_inst *sdi, struct sr_dev_driver *di)
uint8_t revid;
char connection_id[64];
drvc = di->priv;
drvc = di->context;
devc = sdi->priv;
usb = sdi->conn;

View File

@ -161,7 +161,7 @@ static GSList *scan_1x_2x_rs232(struct sr_dev_driver *di, GSList *options)
gboolean serialcomm_given;
devices = NULL;
drvc = di->priv;
drvc = di->context;
drvc->instances = NULL;
conn = serialcomm = NULL;
model = METRAHIT_NONE;
@ -256,7 +256,7 @@ static GSList *scan_2x_bd232(struct sr_dev_driver *di, GSList *options)
conn = serialcomm = NULL;
devices = NULL;
drvc = di->priv;
drvc = di->context;
drvc->instances = NULL;
sr_spew("scan_2x_bd232() called!");
@ -354,7 +354,7 @@ exit_err:
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)
@ -551,7 +551,7 @@ SR_PRIV struct sr_dev_driver gmc_mh_1x_2x_rs232_driver_info = {
.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 = {
@ -570,5 +570,5 @@ 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,
};

View File

@ -116,12 +116,12 @@ fail:
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)
@ -809,5 +809,5 @@ SR_PRIV struct sr_dev_driver hameg_hmo_driver_info = {
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
.context = NULL,
};

View File

@ -208,7 +208,7 @@ static struct sr_dev_inst *dso_dev_new(const struct dso_profile *prof)
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;
@ -273,7 +273,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
const char *conn;
char connection_id[64];
drvc = di->priv;
drvc = di->context;
devices = 0;
@ -363,7 +363,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
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)
@ -876,7 +876,7 @@ static int handle_event(int fd, int revents, void *cb_data)
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. */
@ -976,7 +976,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
{
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;
@ -1035,5 +1035,5 @@ SR_PRIV struct sr_dev_driver hantek_dso_driver_info = {
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
.context = NULL,
};

View File

@ -111,7 +111,7 @@ err:
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;

View File

@ -72,7 +72,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
(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);
@ -163,7 +163,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
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)
@ -193,7 +193,7 @@ static int dev_open(struct sr_dev_inst *sdi)
uint8_t buffer[PACKET_LENGTH];
int ret;
if (!(drvc = di->priv)) {
if (!(drvc = di->context)) {
sr_err("Driver was not initialized.");
return SR_ERR;
}
@ -261,7 +261,7 @@ static int dev_close(struct sr_dev_inst *sdi)
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;
}
@ -397,7 +397,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
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;
@ -505,5 +505,5 @@ SR_PRIV struct sr_dev_driver ikalogic_scanalogic2_driver_info = {
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
.context = NULL,
};

View File

@ -215,7 +215,7 @@ SR_PRIV int ikalogic_scanalogic2_receive_data(int fd, int revents, void *cb_data
return TRUE;
di = sdi->driver;
drvc = di->priv;
drvc = di->context;
current_time = g_get_monotonic_time();
if (devc->state == STATE_WAIT_DATA_READY &&
@ -643,7 +643,7 @@ SR_PRIV int sl2_get_device_info(struct sr_usb_dev_inst usb,
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;

View File

@ -80,7 +80,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
(void)options;
drvc = di->priv;
drvc = di->context;
devices = NULL;
@ -150,7 +150,7 @@ err_free_devc:
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)
@ -420,5 +420,5 @@ SR_PRIV struct sr_dev_driver ikalogic_scanaplus_driver_info = {
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
.context = NULL,
};

View File

@ -74,7 +74,7 @@ static int scan_kecheng(struct sr_dev_driver *di,
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;
@ -117,7 +117,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
(void)options;
drvc = di->priv;
drvc = di->context;
drvc->instances = NULL;
devices = NULL;
@ -161,7 +161,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
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)
@ -171,7 +171,7 @@ 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;
}
@ -201,7 +201,7 @@ static int dev_close(struct sr_dev_inst *sdi)
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;
}
@ -231,7 +231,7 @@ static int cleanup(const struct sr_dev_driver *di)
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;
@ -305,7 +305,7 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
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;
}
@ -430,7 +430,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi,
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
drvc = di->priv;
drvc = di->context;
devc = sdi->priv;
usb = sdi->conn;
@ -566,5 +566,5 @@ SR_PRIV struct sr_dev_driver kecheng_kc_330b_driver_info = {
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
.context = NULL,
};

View File

@ -44,7 +44,7 @@ SR_PRIV int kecheng_kc_330b_handle_events(int fd, int revents, void *cb_data)
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,

View File

@ -51,7 +51,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
GSList *usb_devices, *devices, *l;
const char *conn;
drvc = di->priv;
drvc = di->context;
conn = NULL;
for (l = options; l; l = l->next) {
@ -90,7 +90,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
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)
@ -100,7 +100,7 @@ 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;
}
@ -124,7 +124,7 @@ static int dev_close(struct sr_dev_inst *sdi)
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;
}
@ -148,7 +148,7 @@ static int cleanup(const struct sr_dev_driver *di)
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;
@ -206,7 +206,7 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
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;
}
@ -340,12 +340,12 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
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;
@ -451,7 +451,7 @@ SR_PRIV int dev_acquisition_stop(struct sr_dev_inst *sdi, void *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;
}
@ -483,5 +483,5 @@ SR_PRIV struct sr_dev_driver lascar_el_usb_driver_info = {
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
.context = NULL,
};

View File

@ -96,7 +96,7 @@ SR_PRIV int lascar_get_config(libusb_device_handle *dev_hdl,
sr_spew("Reading config block.");
drvc = di->priv;
drvc = di->context;
*configlen = 0;
if (!(xfer_in = libusb_alloc_transfer(0)) ||
@ -213,7 +213,7 @@ static int lascar_save_config(libusb_device_handle *dev_hdl,
sr_spew("Writing config block.");
drvc = di->priv;
drvc = di->context;
if (!(xfer_in = libusb_alloc_transfer(0)) ||
!(xfer_out = libusb_alloc_transfer(0)))
@ -356,7 +356,7 @@ SR_PRIV struct sr_dev_inst *lascar_scan(int bus, int address)
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);
@ -479,7 +479,7 @@ static void lascar_el_usb_dispatch(struct sr_dev_inst *sdi, unsigned char *buf,
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;

View File

@ -60,7 +60,7 @@ static int dev_clear(const struct sr_dev_driver *di)
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. */
@ -219,7 +219,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
}
//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);
}
@ -229,7 +229,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
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)
@ -483,5 +483,5 @@ SR_PRIV struct sr_dev_driver link_mso19_driver_info = {
.dev_close = std_serial_dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
.context = NULL,
};

View File

@ -357,7 +357,7 @@ SR_PRIV int mso_receive_data(int fd, int revents, void *cb_data)
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;

View File

@ -96,7 +96,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
struct sr_serial_dev_inst *serial;
char reply[50], **tokens, *dummy;
drvc = di->priv;
drvc = di->context;
drvc->instances = NULL;
devices = NULL;
conn = NULL;
@ -204,7 +204,7 @@ exit_err:
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)
@ -433,5 +433,5 @@ SR_PRIV struct sr_dev_driver manson_hcs_3xxx_driver_info = {
.dev_close = std_serial_dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
.context = NULL,
};

View File

@ -188,7 +188,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
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);
@ -200,7 +200,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
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)
@ -516,5 +516,5 @@ SR_PRIV struct sr_dev_driver maynuo_m97_driver_info = {
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
.context = NULL,
};

View File

@ -79,7 +79,7 @@ static GSList *mic_scan(const char *conn, const char *serialcomm, int idx)
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);
@ -146,7 +146,7 @@ static GSList *scan(GSList *options, int idx)
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)
@ -291,7 +291,7 @@ SR_PRIV struct sr_dev_driver ID##_driver_info = { \
.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")

View File

@ -516,7 +516,7 @@ static GSList *scan_lps301(struct sr_dev_driver *di, GSList *options)
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)
@ -849,5 +849,5 @@ SR_PRIV struct sr_dev_driver motech_lps_301_driver_info = {
.dev_close = std_serial_dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
.context = NULL,
};

View File

@ -175,7 +175,7 @@ static GSList *scan(struct sr_dev_driver* drv, GSList *options)
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)
@ -307,7 +307,7 @@ SR_PRIV struct sr_dev_driver norma_dmm_driver_info = {
.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 = {
@ -326,5 +326,5 @@ 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,
};

View File

@ -105,7 +105,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
const char *conn, *serialcomm;
char buf[8];
drvc = di->priv;
drvc = di->context;
devices = NULL;
@ -215,7 +215,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
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)
@ -608,5 +608,5 @@ SR_PRIV struct sr_dev_driver ols_driver_info = {
.dev_close = std_serial_dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
.context = NULL,
};

View File

@ -93,7 +93,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
(void)options;
drvc = di->priv;
drvc = di->context;
devices = NULL;
@ -201,7 +201,7 @@ err_free_ftdi_buf:
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)
@ -739,5 +739,5 @@ SR_PRIV struct sr_dev_driver p_ols_driver_info = {
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
.context = NULL,
};

View File

@ -407,12 +407,12 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi)
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)
@ -1091,5 +1091,5 @@ SR_PRIV struct sr_dev_driver rigol_ds_driver_info = {
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
.context = NULL,
};

View File

@ -152,7 +152,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
const char *conn;
char connection_id[64];
drvc = di->priv;
drvc = di->context;
conn = NULL;
for (l = options; l; l = l->next) {
@ -242,7 +242,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
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)
@ -256,7 +256,7 @@ 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)
@ -416,7 +416,7 @@ static int cleanup(const struct sr_dev_driver *di)
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;
@ -687,7 +687,7 @@ static int receive_data(int fd, int revents, void *cb_data)
sdi = cb_data;
di = sdi->driver;
drvc = di->priv;
drvc = di->context;
devc = sdi->priv;
tv.tv_sec = tv.tv_usec = 0;
@ -717,7 +717,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
drvc = di->priv;
drvc = di->context;
devc = sdi->priv;
usb = sdi->conn;
@ -845,5 +845,5 @@ SR_PRIV struct sr_dev_driver saleae_logic16_driver_info = {
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
.context = NULL,
};

View File

@ -173,12 +173,12 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi)
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)
@ -620,5 +620,5 @@ SR_PRIV struct sr_dev_driver scpi_pps_driver_info = {
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
.context = NULL,
};

View File

@ -92,7 +92,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
sr_info("Probing serial port %s.", conn);
drvc = di->priv;
drvc = di->context;
devices = NULL;
serial_flush(serial);
@ -152,7 +152,7 @@ scan_cleanup:
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)
@ -270,7 +270,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
.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) \

View File

@ -118,7 +118,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
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) {
@ -158,7 +158,7 @@ static GSList *dev_list(const struct sr_dev_driver *di)
{
struct drv_context *drvc;
drvc = di->priv;
drvc = di->context;
return drvc->instances;
}
@ -186,7 +186,7 @@ static int dev_open(struct sr_dev_inst *sdi)
struct sr_usb_dev_inst *usb;
int ret;
drvc = di->priv;
drvc = di->context;
if (!drvc) {
sr_err("Driver was not initialized.");
@ -220,7 +220,7 @@ static int dev_close(struct sr_dev_inst *sdi)
{
struct sr_usb_dev_inst *usb;
if (!di->priv) {
if (!di->context) {
sr_err("Driver was not initialized.");
return SR_ERR;
}
@ -482,7 +482,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
return SR_ERR_DEV_CLOSED;
devc = sdi->priv;
drvc = di->priv;
drvc = di->context;
if (devc->acquisition) {
sr_err("Acquisition still in progress?");
@ -557,5 +557,5 @@ SR_PRIV struct sr_dev_driver sysclk_lwla_driver_info = {
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
.context = NULL,
};

View File

@ -79,7 +79,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
sr_info("Probing serial port %s.", conn);
drvc = di->priv;
drvc = di->context;
drvc->instances = NULL;
serial_flush(serial);
@ -134,7 +134,7 @@ scan_cleanup:
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)
@ -248,5 +248,5 @@ SR_PRIV struct sr_dev_driver teleinfo_driver_info = {
.dev_close = std_serial_dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
.context = NULL,
};

View File

@ -63,7 +63,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
char manufacturer[64], product[64], connection_id[64];
devices = NULL;
drvc = di->priv;
drvc = di->context;
drvc->instances = NULL;
conn_devices = NULL;
@ -151,7 +151,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
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)
@ -162,13 +162,13 @@ 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;
}
@ -215,7 +215,7 @@ static int dev_close(struct sr_dev_inst *sdi)
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;
}
@ -238,7 +238,7 @@ static int cleanup(const struct sr_dev_driver *di)
int ret;
struct drv_context *drvc;
if (!(drvc = di->priv))
if (!(drvc = di->context))
return SR_OK;
ret = dev_clear(di);
@ -283,7 +283,7 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
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;
}
@ -427,7 +427,7 @@ static int handle_events(int fd, int revents, void *cb_data)
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;
@ -461,11 +461,11 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
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;
}
@ -510,7 +510,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *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;
}
@ -539,5 +539,5 @@ SR_PRIV struct sr_dev_driver testo_driver_info = {
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
.context = NULL,
};

View File

@ -54,7 +54,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
const char *conn, *serialcomm;
struct sr_serial_dev_inst *serial;
drvc = di->priv;
drvc = di->context;
drvc->instances = NULL;
devices = NULL;
@ -107,7 +107,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
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)
@ -205,5 +205,5 @@ SR_PRIV struct sr_dev_driver tondaj_sl_814_driver_info = {
.dev_close = std_serial_dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
.context = NULL,
};

View File

@ -66,7 +66,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
struct sr_config *src;
const char *conn;
drvc = di->priv;
drvc = di->context;
dmm = (struct dmm_info *)di;
conn = NULL;
@ -109,7 +109,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
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)
@ -120,7 +120,7 @@ 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)
@ -244,7 +244,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
.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) \

View File

@ -53,7 +53,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
unsigned int i;
const char *conn;
drvc = di->priv;
drvc = di->context;
drvc->instances = NULL;
conn = NULL;
@ -99,7 +99,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
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)
@ -109,7 +109,7 @@ 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;
}
@ -152,7 +152,7 @@ static int dev_close(struct sr_dev_inst *sdi)
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;
}
@ -175,7 +175,7 @@ static int cleanup(const struct sr_dev_driver *di)
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;
@ -222,7 +222,7 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
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;
}
@ -283,7 +283,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi,
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
drvc = di->priv;
drvc = di->context;
devc = sdi->priv;
usb = sdi->conn;
@ -365,5 +365,5 @@ SR_PRIV struct sr_dev_driver uni_t_ut32x_driver_info = {
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
.context = NULL,
};

View File

@ -207,7 +207,7 @@ SR_PRIV int uni_t_ut32x_handle_events(int fd, int revents, void *cb_data)
return TRUE;
di = sdi->driver;
drvc = di->priv;
drvc = di->context;
if (!(devc = sdi->priv))
return TRUE;

View File

@ -67,7 +67,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
(void)options;
drvc = di->priv;
drvc = di->context;
devices = NULL;
libusb_get_device_list(drvc->sr_ctx->libusb_ctx, &devlist);
@ -107,19 +107,19 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
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;
}
@ -168,7 +168,7 @@ static int dev_close(struct sr_dev_inst *sdi)
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;
}
@ -192,7 +192,7 @@ static int cleanup(const struct sr_dev_driver *di)
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;
@ -237,7 +237,7 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
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;
}
@ -343,7 +343,7 @@ static int handle_events(int fd, int revents, void *cb_data)
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;
@ -371,7 +371,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
{
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;
@ -380,7 +380,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
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;
}
@ -419,7 +419,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *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;
}
@ -450,5 +450,5 @@ SR_PRIV struct sr_dev_driver victor_dmm_driver_info = {
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
.context = NULL,
};

View File

@ -127,12 +127,12 @@ fail:
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)
@ -718,5 +718,5 @@ SR_PRIV struct sr_dev_driver yokogawa_dlm_driver_info = {
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
.context = NULL,
};

View File

@ -174,7 +174,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
(void)options;
drvc = di->priv;
drvc = di->context;
devices = NULL;
@ -262,7 +262,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
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)
@ -275,7 +275,7 @@ 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)) {
@ -740,5 +740,5 @@ SR_PRIV struct sr_dev_driver zeroplus_logic_cube_driver_info = {
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
.context = NULL,
};

View File

@ -397,7 +397,7 @@ SR_API GSList *sr_driver_scan(struct sr_dev_driver *driver, GSList *options)
return NULL;
}
if (!driver->priv) {
if (!driver->context) {
sr_err("Driver not initialized, can't scan for devices.");
return NULL;
}
@ -434,7 +434,7 @@ SR_PRIV void sr_hw_cleanup_all(const struct sr_context *ctx)
for (i = 0; drivers[i]; i++) {
if (drivers[i]->cleanup)
drivers[i]->cleanup(drivers[i]);
drivers[i]->priv = NULL;
drivers[i]->context = NULL;
}
}

View File

@ -171,7 +171,7 @@ static int dev_clear(const struct sr_dev_driver *di)
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);
@ -187,7 +187,7 @@ static int dev_open(struct sr_dev_inst *sdi)
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);
@ -335,5 +335,5 @@ SR_PRIV struct sr_dev_driver session_driver = {
.dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = NULL,
.priv = NULL,
.context = NULL,
};

View File

@ -56,7 +56,7 @@ SR_PRIV int std_init(struct sr_context *sr_ctx, struct sr_dev_driver *di,
drvc = g_malloc0(sizeof(struct drv_context));
drvc->sr_ctx = sr_ctx;
drvc->instances = NULL;
di->priv = drvc;
di->context = drvc;
return SR_OK;
}
@ -247,7 +247,7 @@ SR_PRIV int std_dev_clear(const struct sr_dev_driver *driver,
GSList *l;
int ret;
if (!(drvc = driver->priv))
if (!(drvc = driver->context))
/* Driver was never initialized, nothing to do. */
return SR_OK;