return devices;
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
-static int dev_clear(const struct sr_dev_driver *di)
-{
- return std_dev_clear(di, NULL);
-}
-
static int dev_open(struct sr_dev_inst *sdi)
{
struct sr_dev_driver *di = sdi->driver;
int ret, i;
char connection_id[64];
- if (!di->context) {
- sr_err("Driver was not initialized.");
- return SR_ERR;
- }
-
usb = sdi->conn;
libusb_get_device_list(drvc->sr_ctx->libusb_ctx, &devlist);
for (i = 0; devlist[i]; i++) {
static int dev_close(struct sr_dev_inst *sdi)
{
- struct sr_dev_driver *di = sdi->driver;
struct sr_usb_dev_inst *usb;
- if (!di->context) {
- sr_err("Driver was not initialized.");
- return SR_ERR;
- }
-
usb = sdi->conn;
if (!usb->devhdl)
/* Nothing to do. */
return SR_OK;
}
-static int cleanup(const struct sr_dev_driver *di)
-{
- int ret;
- struct drv_context *drvc;
-
- if (!(drvc = di->context))
- return SR_OK;
-
- ret = dev_clear(di);
- g_free(drvc);
-
- return ret;
-}
-
static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
- struct sr_dev_driver *di = sdi->driver;
struct dev_context *devc;
gint64 now;
int ret;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
- if (!di->context) {
- sr_err("Driver was not initialized.");
- return SR_ERR;
- }
-
devc = sdi->priv;
ret = SR_OK;
switch (key) {
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
- if (!di->context) {
- sr_err("Driver was not initialized.");
- return SR_ERR;
- }
devc = sdi->priv;
usb = sdi->conn;
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
{
- struct sr_dev_driver *di = sdi->driver;
-
- if (!di->context) {
- sr_err("Driver was not initialized.");
- return SR_ERR;
- }
-
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
.longname = "Testo",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
- .dev_clear = dev_clear,
+ .dev_list = std_dev_list,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,