return devices;
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
.init = init,
.cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.dev_clear = NULL,
.config_get = NULL,
.config_set = config_set,
return devices;
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
.init = init,
.cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.dev_clear = NULL,
.config_get = config_get,
.config_set = config_set,
return devices;
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
static int config_list(uint32_t key, GVariant **data,
const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
{
.init = init,
.cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
return NULL;
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
static int dev_open(struct sr_dev_inst *sdi)
{
struct dev_context *devc;
.init = init,
.cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.dev_clear = dev_clear,
.config_get = config_get,
.config_set = config_set,
return scan(di, options, PPS_3203T_3S);
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
.init = init,
.cleanup = std_cleanup,
.scan = scan_3203,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.dev_clear = NULL,
.config_get = config_get,
.config_set = config_set,
return NULL;
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
static int dev_open(struct sr_dev_inst *sdi)
{
(void)sdi;
.init = init,
.cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
return devices;
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
static int dev_open(struct sr_dev_inst *sdi)
{
struct dev_context *devc = sdi->priv;
.init = init,
.cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
return devices;
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
static int dev_open(struct sr_dev_inst *sdi)
{
struct sr_dev_driver *di = sdi->driver;
.init = init,
.cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.dev_clear = NULL,
.config_get = config_get,
.config_set = config_set,
return devices;
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
.init = init,
.cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.dev_clear = NULL,
.config_get = NULL,
.config_set = config_set,
return devices;
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
.init = init,
.cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.dev_clear = NULL,
.config_get = config_get,
.config_set = config_set,
return devices;
}
-static GSList *dev_list(int idx)
-{
- return ((struct drv_context *)(center_devs[idx].di->context))->instances;
-}
-
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
#define HW_SCAN(X) \
static GSList *scan_##X(struct sr_dev_driver *d, GSList *options) { \
(void)d; return scan(options, X); }
-#define HW_DEV_LIST(X) \
-static GSList *dev_list_##X(const struct sr_dev_driver *d) { \
- (void)d; return dev_list(X); }
#define HW_DEV_ACQUISITION_START(X) \
static int dev_acquisition_start_##X(const struct sr_dev_inst *sdi \
) { return dev_acquisition_start(sdi, X); }
#define DRV(ID, ID_UPPER, NAME, LONGNAME) \
HW_INIT(ID_UPPER) \
HW_SCAN(ID_UPPER) \
-HW_DEV_LIST(ID_UPPER) \
HW_DEV_ACQUISITION_START(ID_UPPER) \
SR_PRIV struct sr_dev_driver ID##_driver_info = { \
.name = NAME, \
.init = init_##ID_UPPER, \
.cleanup = std_cleanup, \
.scan = scan_##ID_UPPER, \
- .dev_list = dev_list_##ID_UPPER, \
+ .dev_list = std_dev_list, \
.config_get = NULL, \
.config_set = config_set, \
.config_list = config_list, \
return devices;
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
static int dev_open(struct sr_dev_inst *sdi)
{
struct dev_context *devc;
.init = init,
.cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.dev_clear = dev_clear,
.config_get = config_get,
.config_set = config_set,
return devices;
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
.init = init,
.cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.dev_clear = NULL,
.config_get = NULL,
.config_set = config_set,
return devices;
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
.init = init,
.cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.dev_clear = NULL,
.config_get = NULL,
.config_set = config_set,
return devices;
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
static int dev_open(struct sr_dev_inst *sdi)
{
sdi->status = SR_ST_ACTIVE;
.init = init,
.cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.dev_clear = dev_clear,
.config_get = config_get,
.config_set = config_set,
drvc->instances = g_slist_append(drvc->instances, sdi);
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)di->context)->instances;
-}
-
#define LOG_PREFIX "deree-de5000"
SR_PRIV struct sr_dev_driver deree_de5000_driver_info;
.init = init,
.cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.dev_clear = dev_clear,
.config_get = es51919_serial_config_get,
.config_set = es51919_serial_config_set,
return devices;
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
.init = init,
.cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.dev_clear = NULL,
.config_get = NULL,
.config_set = config_set,
return scan_all(di, options);
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
static void clear_helper(void *priv)
{
struct dev_context *devc;
.init = init,
.cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.dev_clear = dev_clear,
.config_get = config_get,
.config_set = config_set,
return std_dev_clear(di, clear_dev_context);
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
static int dev_open(struct sr_dev_inst *sdi)
{
struct sr_dev_driver *di = sdi->driver;
.init = init,
.cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.dev_clear = dev_clear,
.config_get = config_get,
.config_set = config_set,
return NULL;
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
static int dev_close(struct sr_dev_inst *sdi)
{
struct dev_context *devc;
.init = init,
.cleanup = std_cleanup,
.scan = scan_1x_2x_rs232,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.dev_clear = NULL,
.config_get = config_get,
.config_set = config_set,
.init = init,
.cleanup = std_cleanup,
.scan = scan_2x_bd232,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.dev_clear = NULL,
.config_get = config_get,
.config_set = config_set,
return sr_scpi_scan(di->context, options, probe_device);
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
static int dev_open(struct sr_dev_inst *sdi)
{
int ret;
.init = init,
.cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
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->context))->instances;
-}
-
static void clear_helper(void *priv)
{
struct dev_context *devc;
.init = init,
.cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.dev_clear = dev_clear,
.config_get = config_get,
.config_set = config_set,
return devices;
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
static int dev_open(struct sr_dev_inst *sdi)
{
struct dev_context *devc;
.init = init,
.cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.dev_clear = dev_clear,
.config_get = config_get,
.config_set = config_set,
return devices;
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
static int dev_open(struct sr_dev_inst *sdi)
{
struct dev_context *devc;
.init = init,
.cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.dev_clear = dev_clear,
.config_get = config_get,
.config_set = config_set,
return sr_scpi_scan(di->context, options, probe_device);
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
/*
* We need to set the HP 3457A to a known state, and there are quite a number
* of knobs to tweak. Here's a brief explanation of what's going on. For more
.init = init,
.cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
return devices;
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
static void clear_private(void *priv)
{
struct dev_context *devc = priv;
.init = init,
.cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.dev_clear = dev_clear,
.config_get = config_get,
.config_set = config_set,
return devices;
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
static void clear_dev_context(void *priv)
{
struct dev_context *devc;
.init = init,
.cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.dev_clear = dev_clear,
.config_get = config_get,
.config_set = config_set,
return NULL;
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
static int dev_open(struct sr_dev_inst *sdi)
{
struct dev_context *devc;
.init = init,
.cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.dev_clear = dev_clear,
.config_get = config_get,
.config_set = config_set,
return devices;
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
static int dev_open(struct sr_dev_inst *sdi)
{
struct sr_dev_driver *di = sdi->driver;
.init = init,
.cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.dev_clear = NULL,
.config_get = config_get,
.config_set = config_set,
return devices;
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
.init = init, \
.cleanup = std_cleanup, \
.scan = scan, \
- .dev_list = dev_list, \
+ .dev_list = std_dev_list, \
.config_get = NULL, \
.config_set = config_set, \
.config_list = config_list, \
return NULL;
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
static int config_get(uint32_t key, GVariant **data,
const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
{
.init = init,
.cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
return devices;
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
static int dev_open(struct sr_dev_inst *sdi)
{
struct sr_dev_driver *di = sdi->driver;
.init = init,
.cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.dev_clear = NULL,
.config_get = config_get,
.config_set = config_set,
return devices;
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
static int open_device(struct sr_dev_inst *sdi)
{
struct drv_context *drvc;
.init = init,
.cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
return devices;
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
static int dev_open(struct sr_dev_inst *sdi)
{
int ret;
.init = init,
.cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.dev_clear = dev_clear,
.config_get = config_get,
.config_set = config_set,
return NULL;
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
.init = init,
.cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
return devices;
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
static int dev_open(struct sr_dev_inst *sdi)
{
struct sr_modbus_dev_inst *modbus = sdi->conn;
.init = init,
.cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
return devices;
}
-static GSList *dev_list(int idx)
-{
- return ((struct drv_context *)(mic_devs[idx].di->context))->instances;
-}
-
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
#define HW_SCAN(X) \
static GSList *scan_##X(struct sr_dev_driver *di, GSList *options) { \
(void)di; return scan(options, X); }
-#define HW_DEV_LIST(X) \
-static GSList *dev_list_##X(const struct sr_dev_driver *di) { \
- (void)di; return dev_list(X); }
#define HW_CONFIG_LIST(X) \
static int config_list_##X(uint32_t key, GVariant **data, \
const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { \
#define DRV(ID, ID_UPPER, NAME, LONGNAME) \
HW_INIT(ID_UPPER) \
HW_SCAN(ID_UPPER) \
-HW_DEV_LIST(ID_UPPER) \
HW_CONFIG_LIST(ID_UPPER) \
HW_DEV_ACQUISITION_START(ID_UPPER) \
SR_PRIV struct sr_dev_driver ID##_driver_info = { \
.init = init_##ID_UPPER, \
.cleanup = std_cleanup, \
.scan = scan_##ID_UPPER, \
- .dev_list = dev_list_##ID_UPPER, \
+ .dev_list = std_dev_list, \
.config_get = NULL, \
.config_set = config_set, \
.config_list = config_list_##ID_UPPER, \
return do_scan(LPS_301, di, options);
}
-static GSList *dev_list_lps301(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
static void dev_clear_private(struct dev_context *devc)
{
int ch_idx;
.init = init_lps301,
.cleanup = std_cleanup,
.scan = scan_lps301,
- .dev_list = dev_list_lps301,
+ .dev_list = std_dev_list,
.dev_clear = dev_clear_lps301,
.config_get = config_get,
.config_set = config_set,
return devices;
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
static int dev_close(struct sr_dev_inst *sdi)
{
struct dev_context *devc;
.init = init,
.cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.dev_clear = NULL,
.config_get = NULL,
.config_set = config_set,
.init = init,
.cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.dev_clear = NULL,
.config_get = NULL,
.config_set = config_set,
return devices;
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
.init = init,
.cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.dev_clear = NULL,
.config_get = config_get,
.config_set = config_set,
return NULL;
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
static void clear_helper(void *priv)
{
struct dev_context *devc;
.init = init,
.cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.dev_clear = dev_clear,
.config_get = config_get,
.config_set = config_set,
return sr_scpi_scan(di->context, options, probe_device);
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
static int dev_open(struct sr_dev_inst *sdi)
{
int ret;
.init = init,
.cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.dev_clear = dev_clear,
.config_get = config_get,
.config_set = config_set,
return devices;
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
static int logic16_dev_open(struct sr_dev_inst *sdi)
{
struct sr_dev_driver *di;
.init = init,
.cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.dev_clear = NULL,
.config_get = config_get,
.config_set = config_set,
return sr_scpi_scan(di->context, options, probe_device);
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
static int dev_open(struct sr_dev_inst *sdi)
{
struct dev_context *devc;
.init = init,
.cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.dev_clear = dev_clear,
.config_get = config_get,
.config_set = config_set,
return devices;
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
.init = init, \
.cleanup = std_cleanup, \
.scan = scan, \
- .dev_list = dev_list, \
+ .dev_list = std_dev_list, \
.config_get = NULL, \
.config_set = config_set, \
.config_list = config_list, \
return devices;
}
-/* Return the list of devices found during scan.
- */
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
/* Destroy the private device context.
*/
static void clear_dev_context(void *priv)
.init = init,
.cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.dev_clear = dev_clear,
.config_get = config_get,
.config_set = config_set,
return devices;
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
.init = init,
.cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.dev_clear = NULL,
.config_get = NULL,
.config_set = config_set,
return devices;
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
static int dev_open(struct sr_dev_inst *sdi)
{
struct sr_dev_driver *di = sdi->driver;
.init = init,
.cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
return devices;
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
.init = init,
.cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.dev_clear = NULL,
.config_get = NULL,
.config_set = config_set,
return devices;
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
static int dev_open(struct sr_dev_inst *sdi)
{
struct sr_dev_driver *di;
.init = init, \
.cleanup = std_cleanup, \
.scan = scan, \
- .dev_list = dev_list, \
+ .dev_list = std_dev_list, \
.config_get = NULL, \
.config_set = config_set, \
.config_list = config_list, \
return devices;
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
static int dev_open(struct sr_dev_inst *sdi)
{
struct sr_dev_driver *di = sdi->driver;
.init = init,
.cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.dev_clear = NULL,
.config_get = config_get,
.config_set = config_set,
return devices;
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
static int dev_open(struct sr_dev_inst *sdi)
{
struct sr_dev_driver *di = sdi->driver;
.init = init,
.cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.dev_clear = NULL,
.config_get = config_get,
.config_set = config_set,
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->context))->instances;
-}
-
static void clear_helper(void *priv)
{
struct dev_context *devc;
.init = init,
.cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.dev_clear = dev_clear,
.config_get = config_get,
.config_set = config_set,
return devices;
}
-static GSList *dev_list(const struct sr_dev_driver *di)
-{
- return ((struct drv_context *)(di->context))->instances;
-}
-
static int dev_open(struct sr_dev_inst *sdi)
{
struct sr_dev_driver *di = sdi->driver;
.init = init,
.cleanup = std_cleanup,
.scan = scan,
- .dev_list = dev_list,
+ .dev_list = std_dev_list,
.dev_clear = NULL,
.config_get = config_get,
.config_set = config_set,
const char *prefix);
SR_PRIV int std_dev_clear(const struct sr_dev_driver *driver,
std_dev_clear_callback clear_private);
+SR_PRIV GSList *std_dev_list(const struct sr_dev_driver *di);
SR_PRIV int std_serial_dev_close(struct sr_dev_inst *sdi);
/*--- resource.c ------------------------------------------------------------*/
return ret;
}
+
+/**
+ * Standard implementation for the driver dev_list() callback
+ *
+ * This function can be used as the dev_list callback by most drivers that use
+ * the standard helper functions. It returns the devices contained in the driver
+ * context instances list.
+ *
+ * @param di The driver instance to use.
+ *
+ * @return The list of devices/instances of this driver, or NULL upon errors
+ * or if the list is empty.
+ */
+SR_PRIV GSList *std_dev_list(const struct sr_dev_driver *di)
+{
+ struct drv_context *drvc = di->context;
+
+ return drvc->instances;
+}