sr: rename more functions to sr_thing_action format

Also improved the interface to find capabilities in a hardware plugin.
This commit is contained in:
Bert Vermeulen 2012-02-14 00:23:51 +01:00
parent d3683c42e7
commit da1466d677
14 changed files with 63 additions and 62 deletions

View File

@ -28,7 +28,7 @@
*/ */
SR_API int sr_init(void) SR_API int sr_init(void)
{ {
return load_hwplugins(); return sr_hwplugins_load();
} }
/** /**

View File

@ -416,7 +416,7 @@ SR_API gboolean sr_dev_has_hwcap(const struct sr_device *device, int hwcap)
* @return SR_OK upon success, SR_ERR_ARG upon invalid arguments, or SR_ERR * @return SR_OK upon success, SR_ERR_ARG upon invalid arguments, or SR_ERR
* upon other errors. * upon other errors.
*/ */
int sr_dev_get_info(const struct sr_device *device, int id, SR_API int sr_dev_info_get(const struct sr_device *device, int id,
const void **data) const void **data)
{ {
if ((device == NULL) || (device->plugin == NULL)) if ((device == NULL) || (device->plugin == NULL))

View File

@ -97,7 +97,7 @@ static int hw_opendev(int device_index)
struct alsa *alsa; struct alsa *alsa;
int err; int err;
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) if (!(sdi = sr_dev_inst_get(device_instances, device_index)))
return SR_ERR; return SR_ERR;
alsa = sdi->priv; alsa = sdi->priv;
@ -131,7 +131,7 @@ static int hw_closedev(int device_index)
struct sr_device_instance *sdi; struct sr_device_instance *sdi;
struct alsa *alsa; struct alsa *alsa;
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) { if (!(sdi = sr_dev_inst_get(device_instances, device_index))) {
sr_err("alsa: %s: sdi was NULL", __func__); sr_err("alsa: %s: sdi was NULL", __func__);
return SR_ERR; /* TODO: SR_ERR_ARG? */ return SR_ERR; /* TODO: SR_ERR_ARG? */
} }
@ -154,7 +154,7 @@ static int hw_cleanup(void)
{ {
struct sr_device_instance *sdi; struct sr_device_instance *sdi;
if (!(sdi = sr_get_dev_inst(device_instances, 0))) { if (!(sdi = sr_dev_inst_get(device_instances, 0))) {
sr_err("alsa: %s: sdi was NULL", __func__); sr_err("alsa: %s: sdi was NULL", __func__);
return SR_ERR_BUG; return SR_ERR_BUG;
} }
@ -171,7 +171,7 @@ static void *hw_get_device_info(int device_index, int device_info_id)
struct alsa *alsa; struct alsa *alsa;
void *info = NULL; void *info = NULL;
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) if (!(sdi = sr_dev_inst_get(device_instances, device_index)))
return NULL; return NULL;
alsa = sdi->priv; alsa = sdi->priv;
@ -214,7 +214,7 @@ static int hw_set_configuration(int device_index, int capability, void *value)
struct sr_device_instance *sdi; struct sr_device_instance *sdi;
struct alsa *alsa; struct alsa *alsa;
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) if (!(sdi = sr_dev_inst_get(device_instances, device_index)))
return SR_ERR; return SR_ERR;
alsa = sdi->priv; alsa = sdi->priv;
@ -300,7 +300,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
int count; int count;
int err; int err;
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) if (!(sdi = sr_dev_inst_get(device_instances, device_index)))
return SR_ERR; return SR_ERR;
alsa = sdi->priv; alsa = sdi->priv;

View File

@ -559,7 +559,7 @@ static int hw_opendev(int device_index)
struct sigma *sigma; struct sigma *sigma;
int ret; int ret;
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) if (!(sdi = sr_dev_inst_get(device_instances, device_index)))
return SR_ERR; return SR_ERR;
sigma = sdi->priv; sigma = sdi->priv;
@ -702,7 +702,7 @@ static int hw_closedev(int device_index)
struct sr_device_instance *sdi; struct sr_device_instance *sdi;
struct sigma *sigma; struct sigma *sigma;
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) { if (!(sdi = sr_dev_inst_get(device_instances, device_index))) {
sr_err("sigma: %s: sdi was NULL", __func__); sr_err("sigma: %s: sdi was NULL", __func__);
return SR_ERR; /* TODO: SR_ERR_ARG? */ return SR_ERR; /* TODO: SR_ERR_ARG? */
} }
@ -750,7 +750,7 @@ static void *hw_get_device_info(int device_index, int device_info_id)
struct sigma *sigma; struct sigma *sigma;
void *info = NULL; void *info = NULL;
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) { if (!(sdi = sr_dev_inst_get(device_instances, device_index))) {
sr_err("It's NULL.\n"); sr_err("It's NULL.\n");
return NULL; return NULL;
} }
@ -785,7 +785,7 @@ static int hw_get_status(int device_index)
{ {
struct sr_device_instance *sdi; struct sr_device_instance *sdi;
sdi = sr_get_dev_inst(device_instances, device_index); sdi = sr_dev_inst_get(device_instances, device_index);
if (sdi) if (sdi)
return sdi->status; return sdi->status;
else else
@ -803,7 +803,7 @@ static int hw_set_configuration(int device_index, int capability, void *value)
struct sigma *sigma; struct sigma *sigma;
int ret; int ret;
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) if (!(sdi = sr_dev_inst_get(device_instances, device_index)))
return SR_ERR; return SR_ERR;
sigma = sdi->priv; sigma = sdi->priv;
@ -1267,7 +1267,7 @@ static int hw_start_acquisition(int device_index, gpointer session_data)
/* Avoid compiler warnings. */ /* Avoid compiler warnings. */
(void)session_data; (void)session_data;
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) if (!(sdi = sr_dev_inst_get(device_instances, device_index)))
return SR_ERR; return SR_ERR;
sigma = sdi->priv; sigma = sdi->priv;
@ -1378,7 +1378,7 @@ static int hw_stop_acquisition(int device_index, gpointer session_data)
/* Avoid compiler warnings. */ /* Avoid compiler warnings. */
(void)session_data; (void)session_data;
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) { if (!(sdi = sr_dev_inst_get(device_instances, device_index))) {
sr_err("asix: %s: sdi was NULL", __func__); sr_err("asix: %s: sdi was NULL", __func__);
return SR_ERR_BUG; return SR_ERR_BUG;
} }

View File

@ -564,7 +564,7 @@ static int hw_opendev(int device_index)
struct sr_device_instance *sdi; struct sr_device_instance *sdi;
struct la8 *la8; struct la8 *la8;
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) { if (!(sdi = sr_dev_inst_get(device_instances, device_index))) {
sr_err("la8: %s: sdi was NULL", __func__); sr_err("la8: %s: sdi was NULL", __func__);
return SR_ERR; /* TODO: SR_ERR_ARG? */ return SR_ERR; /* TODO: SR_ERR_ARG? */
} }
@ -651,7 +651,7 @@ static int hw_closedev(int device_index)
struct sr_device_instance *sdi; struct sr_device_instance *sdi;
struct la8 *la8; struct la8 *la8;
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) { if (!(sdi = sr_dev_inst_get(device_instances, device_index))) {
sr_err("la8: %s: sdi was NULL", __func__); sr_err("la8: %s: sdi was NULL", __func__);
return SR_ERR; /* TODO: SR_ERR_ARG? */ return SR_ERR; /* TODO: SR_ERR_ARG? */
} }
@ -722,7 +722,7 @@ static void *hw_get_device_info(int device_index, int device_info_id)
sr_spew("la8: entering %s", __func__); sr_spew("la8: entering %s", __func__);
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) { if (!(sdi = sr_dev_inst_get(device_instances, device_index))) {
sr_err("la8: %s: sdi was NULL", __func__); sr_err("la8: %s: sdi was NULL", __func__);
return NULL; return NULL;
} }
@ -766,7 +766,7 @@ static int hw_get_status(int device_index)
{ {
struct sr_device_instance *sdi; struct sr_device_instance *sdi;
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) { if (!(sdi = sr_dev_inst_get(device_instances, device_index))) {
sr_err("la8: %s: sdi was NULL, device not found", __func__); sr_err("la8: %s: sdi was NULL, device not found", __func__);
return SR_ST_NOT_FOUND; return SR_ST_NOT_FOUND;
} }
@ -790,7 +790,7 @@ static int hw_set_configuration(int device_index, int capability, void *value)
sr_spew("la8: entering %s", __func__); sr_spew("la8: entering %s", __func__);
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) { if (!(sdi = sr_dev_inst_get(device_instances, device_index))) {
sr_err("la8: %s: sdi was NULL", __func__); sr_err("la8: %s: sdi was NULL", __func__);
return SR_ERR; /* TODO: SR_ERR_ARG? */ return SR_ERR; /* TODO: SR_ERR_ARG? */
} }
@ -1044,7 +1044,7 @@ static int hw_start_acquisition(int device_index, gpointer session_data)
sr_spew("la8: entering %s", __func__); sr_spew("la8: entering %s", __func__);
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) { if (!(sdi = sr_dev_inst_get(device_instances, device_index))) {
sr_err("la8: %s: sdi was NULL", __func__); sr_err("la8: %s: sdi was NULL", __func__);
return SR_ERR; /* TODO: SR_ERR_ARG? */ return SR_ERR; /* TODO: SR_ERR_ARG? */
} }
@ -1116,7 +1116,7 @@ static int hw_stop_acquisition(int device_index, gpointer session_data)
sr_dbg("la8: stopping acquisition"); sr_dbg("la8: stopping acquisition");
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) { if (!(sdi = sr_dev_inst_get(device_instances, device_index))) {
sr_err("la8: %s: sdi was NULL", __func__); sr_err("la8: %s: sdi was NULL", __func__);
return SR_ERR_BUG; return SR_ERR_BUG;
} }

View File

@ -185,7 +185,7 @@ static void *hw_get_device_info(int device_index, int device_info_id)
struct sr_device_instance *sdi; struct sr_device_instance *sdi;
void *info = NULL; void *info = NULL;
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) { if (!(sdi = sr_dev_inst_get(device_instances, device_index))) {
sr_err("demo: %s: sdi was NULL", __func__); sr_err("demo: %s: sdi was NULL", __func__);
return NULL; return NULL;
} }

View File

@ -550,7 +550,7 @@ static int hw_opendev(int device_index)
struct mso *mso; struct mso *mso;
int ret = SR_ERR; int ret = SR_ERR;
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) if (!(sdi = sr_dev_inst_get(device_instances, device_index)))
return ret; return ret;
mso = sdi->priv; mso = sdi->priv;
@ -590,7 +590,7 @@ static int hw_closedev(int device_index)
{ {
struct sr_device_instance *sdi; struct sr_device_instance *sdi;
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) { if (!(sdi = sr_dev_inst_get(device_instances, device_index))) {
sr_err("mso19: %s: sdi was NULL", __func__); sr_err("mso19: %s: sdi was NULL", __func__);
return SR_ERR; /* TODO: SR_ERR_ARG? */ return SR_ERR; /* TODO: SR_ERR_ARG? */
} }
@ -612,7 +612,7 @@ static void *hw_get_device_info(int device_index, int device_info_id)
struct mso *mso; struct mso *mso;
void *info = NULL; void *info = NULL;
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) if (!(sdi = sr_dev_inst_get(device_instances, device_index)))
return NULL; return NULL;
mso = sdi->priv; mso = sdi->priv;
@ -643,7 +643,7 @@ static int hw_get_status(int device_index)
{ {
struct sr_device_instance *sdi; struct sr_device_instance *sdi;
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) if (!(sdi = sr_dev_inst_get(device_instances, device_index)))
return SR_ST_NOT_FOUND; return SR_ST_NOT_FOUND;
return sdi->status; return sdi->status;
@ -658,7 +658,7 @@ static int hw_set_configuration(int device_index, int capability, void *value)
{ {
struct sr_device_instance *sdi; struct sr_device_instance *sdi;
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) if (!(sdi = sr_dev_inst_get(device_instances, device_index)))
return SR_ERR; return SR_ERR;
switch (capability) { switch (capability) {
@ -755,7 +755,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
struct sr_datafeed_header header; struct sr_datafeed_header header;
int ret = SR_ERR; int ret = SR_ERR;
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) if (!(sdi = sr_dev_inst_get(device_instances, device_index)))
return ret; return ret;
mso = sdi->priv; mso = sdi->priv;

View File

@ -485,7 +485,7 @@ static int hw_opendev(int device_index)
struct sr_device_instance *sdi; struct sr_device_instance *sdi;
struct ols_device *ols; struct ols_device *ols;
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) if (!(sdi = sr_dev_inst_get(device_instances, device_index)))
return SR_ERR; return SR_ERR;
ols = sdi->priv; ols = sdi->priv;
@ -504,7 +504,7 @@ static int hw_closedev(int device_index)
struct sr_device_instance *sdi; struct sr_device_instance *sdi;
struct ols_device *ols; struct ols_device *ols;
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) { if (!(sdi = sr_dev_inst_get(device_instances, device_index))) {
sr_err("ols: %s: sdi was NULL", __func__); sr_err("ols: %s: sdi was NULL", __func__);
return SR_ERR; /* TODO: SR_ERR_ARG? */ return SR_ERR; /* TODO: SR_ERR_ARG? */
} }
@ -561,7 +561,7 @@ static void *hw_get_device_info(int device_index, int device_info_id)
struct ols_device *ols; struct ols_device *ols;
void *info; void *info;
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) if (!(sdi = sr_dev_inst_get(device_instances, device_index)))
return NULL; return NULL;
ols = sdi->priv; ols = sdi->priv;
@ -594,7 +594,7 @@ static int hw_get_status(int device_index)
{ {
struct sr_device_instance *sdi; struct sr_device_instance *sdi;
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) if (!(sdi = sr_dev_inst_get(device_instances, device_index)))
return SR_ST_NOT_FOUND; return SR_ST_NOT_FOUND;
return sdi->status; return sdi->status;
@ -645,7 +645,7 @@ static int hw_set_configuration(int device_index, int capability, void *value)
int ret; int ret;
uint64_t *tmp_u64; uint64_t *tmp_u64;
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) if (!(sdi = sr_dev_inst_get(device_instances, device_index)))
return SR_ERR; return SR_ERR;
ols = sdi->priv; ols = sdi->priv;
@ -885,7 +885,7 @@ static int hw_start_acquisition(int device_index, gpointer session_data)
int num_channels; int num_channels;
int i; int i;
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) if (!(sdi = sr_dev_inst_get(device_instances, device_index)))
return SR_ERR; return SR_ERR;
ols = sdi->priv; ols = sdi->priv;

View File

@ -173,7 +173,7 @@ static int sl_open_device(int device_index)
struct fx2_device *fx2; struct fx2_device *fx2;
int err, skip, i; int err, skip, i;
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) if (!(sdi = sr_dev_inst_get(device_instances, device_index)))
return SR_ERR; return SR_ERR;
fx2 = sdi->priv; fx2 = sdi->priv;
@ -397,7 +397,7 @@ static int hw_opendev(int device_index)
struct fx2_device *fx2; struct fx2_device *fx2;
int timediff, err; int timediff, err;
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) if (!(sdi = sr_dev_inst_get(device_instances, device_index)))
return SR_ERR; return SR_ERR;
fx2 = sdi->priv; fx2 = sdi->priv;
@ -449,7 +449,7 @@ static int hw_closedev(int device_index)
{ {
struct sr_device_instance *sdi; struct sr_device_instance *sdi;
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) { if (!(sdi = sr_dev_inst_get(device_instances, device_index))) {
sr_err("logic: %s: sdi was NULL", __func__); sr_err("logic: %s: sdi was NULL", __func__);
return SR_ERR; /* TODO: SR_ERR_ARG? */ return SR_ERR; /* TODO: SR_ERR_ARG? */
} }
@ -503,7 +503,7 @@ static void *hw_get_device_info(int device_index, int device_info_id)
struct fx2_device *fx2; struct fx2_device *fx2;
void *info = NULL; void *info = NULL;
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) if (!(sdi = sr_dev_inst_get(device_instances, device_index)))
return NULL; return NULL;
fx2 = sdi->priv; fx2 = sdi->priv;
@ -535,7 +535,7 @@ static int hw_get_status(int device_index)
{ {
struct sr_device_instance *sdi; struct sr_device_instance *sdi;
sdi = sr_get_dev_inst(device_instances, device_index); sdi = sr_dev_inst_get(device_instances, device_index);
if (sdi) if (sdi)
return sdi->status; return sdi->status;
else else
@ -632,7 +632,7 @@ static int hw_set_configuration(int device_index, int capability, void *value)
int ret; int ret;
uint64_t *tmp_u64; uint64_t *tmp_u64;
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) if (!(sdi = sr_dev_inst_get(device_instances, device_index)))
return SR_ERR; return SR_ERR;
fx2 = sdi->priv; fx2 = sdi->priv;
@ -815,7 +815,7 @@ static int hw_start_acquisition(int device_index, gpointer session_data)
int size, i; int size, i;
unsigned char *buf; unsigned char *buf;
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) if (!(sdi = sr_dev_inst_get(device_instances, device_index)))
return SR_ERR; return SR_ERR;
fx2 = sdi->priv; fx2 = sdi->priv;
fx2->session_data = session_data; fx2->session_data = session_data;

View File

@ -245,7 +245,7 @@ static struct sr_device_instance *zp_open_device(int device_index)
struct libusb_device_descriptor des; struct libusb_device_descriptor des;
int err, i; int err, i;
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) if (!(sdi = sr_dev_inst_get(device_instances, device_index)))
return NULL; return NULL;
libusb_get_device_list(usb_context, &devlist); libusb_get_device_list(usb_context, &devlist);
@ -474,7 +474,7 @@ static int hw_closedev(int device_index)
{ {
struct sr_device_instance *sdi; struct sr_device_instance *sdi;
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) { if (!(sdi = sr_dev_inst_get(device_instances, device_index))) {
sr_err("zp: %s: sdi was NULL", __func__); sr_err("zp: %s: sdi was NULL", __func__);
return SR_ERR; /* TODO: SR_ERR_ARG? */ return SR_ERR; /* TODO: SR_ERR_ARG? */
} }
@ -514,7 +514,7 @@ static void *hw_get_device_info(int device_index, int device_info_id)
struct zp *zp; struct zp *zp;
void *info; void *info;
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) { if (!(sdi = sr_dev_inst_get(device_instances, device_index))) {
sr_err("zp: %s: sdi was NULL", __func__); sr_err("zp: %s: sdi was NULL", __func__);
return NULL; return NULL;
} }
@ -557,7 +557,7 @@ static int hw_get_status(int device_index)
{ {
struct sr_device_instance *sdi; struct sr_device_instance *sdi;
sdi = sr_get_dev_inst(device_instances, device_index); sdi = sr_dev_inst_get(device_instances, device_index);
if (sdi) if (sdi)
return sdi->status; return sdi->status;
else else
@ -604,7 +604,7 @@ static int hw_set_configuration(int device_index, int capability, void *value)
uint64_t *tmp_u64; uint64_t *tmp_u64;
struct zp *zp; struct zp *zp;
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) { if (!(sdi = sr_dev_inst_get(device_instances, device_index))) {
sr_err("zp: %s: sdi was NULL", __func__); sr_err("zp: %s: sdi was NULL", __func__);
return SR_ERR; return SR_ERR;
} }
@ -641,7 +641,7 @@ static int hw_start_acquisition(int device_index, gpointer session_data)
unsigned char *buf; unsigned char *buf;
struct zp *zp; struct zp *zp;
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) { if (!(sdi = sr_dev_inst_get(device_instances, device_index))) {
sr_err("zp: %s: sdi was NULL", __func__); sr_err("zp: %s: sdi was NULL", __func__);
return SR_ERR; return SR_ERR;
} }
@ -711,7 +711,7 @@ static int hw_stop_acquisition(int device_index, gpointer session_device_id)
packet.type = SR_DF_END; packet.type = SR_DF_END;
sr_session_bus(session_device_id, &packet); sr_session_bus(session_device_id, &packet);
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) { if (!(sdi = sr_dev_inst_get(device_instances, device_index))) {
sr_err("zp: %s: sdi was NULL", __func__); sr_err("zp: %s: sdi was NULL", __func__);
return SR_ERR_BUG; return SR_ERR_BUG;
} }

View File

@ -68,7 +68,7 @@ extern struct sr_device_plugin alsa_plugin_info;
#endif #endif
/* TODO: No linked list needed, this can be a simple array. */ /* TODO: No linked list needed, this can be a simple array. */
SR_PRIV int load_hwplugins(void) SR_PRIV int sr_hwplugins_load(void)
{ {
#ifdef HAVE_LA_DEMO #ifdef HAVE_LA_DEMO
plugins = g_slist_append(plugins, (gpointer *)&demo_plugin_info); plugins = g_slist_append(plugins, (gpointer *)&demo_plugin_info);
@ -187,7 +187,7 @@ SR_PRIV struct sr_device_instance *sr_dev_inst_new(int index, int status,
return sdi; return sdi;
} }
SR_PRIV struct sr_device_instance *sr_get_dev_inst( SR_PRIV struct sr_device_instance *sr_dev_inst_get(
GSList *device_instances, int device_index) GSList *device_instances, int device_index)
{ {
struct sr_device_instance *sdi; struct sr_device_instance *sdi;
@ -264,7 +264,7 @@ SR_PRIV void sr_serial_dev_inst_free(
} }
/** /**
* Find out if a list of hardware plugin capabilities has a specific cap. * Find out if a hardware plugin has a specific capability.
* *
* @param capabilities A NULL-terminated integer array of capabilities, as * @param capabilities A NULL-terminated integer array of capabilities, as
* returned by a plugin's get_capabilities() function. * returned by a plugin's get_capabilities() function.
@ -272,10 +272,11 @@ SR_PRIV void sr_serial_dev_inst_free(
* *
* @return TRUE if found, FALSE otherwise. * @return TRUE if found, FALSE otherwise.
*/ */
SR_API gboolean sr_has_hwcap(int *capabilities, int hwcap) SR_API gboolean sr_hwplugin_has_hwcap(struct sr_device_plugin *plugin, int hwcap)
{ {
int i; int *capabilities, i;
capabilities = plugin->get_capabilities();
for (i = 0; capabilities[i]; i++) { for (i = 0; capabilities[i]; i++) {
if (capabilities[i] == hwcap) if (capabilities[i] == hwcap)
return TRUE; return TRUE;
@ -285,14 +286,14 @@ SR_API gboolean sr_has_hwcap(int *capabilities, int hwcap)
} }
/** /**
* Find a hardware plugin capability option parameter structure. * Find a hardware plugin capability option.
* *
* @param hwcap The capability to find * @param hwcap The capability to find
* *
* @return A struct with information about the parameter, or NULL * @return A struct with information about the parameter, or NULL
* if not found. * if not found.
*/ */
SR_API struct sr_hwcap_option *sr_find_hwcap_option(int hwcap) SR_API struct sr_hwcap_option *sr_hwplugins_hwcap_get(int hwcap)
{ {
int i; int i;

View File

@ -59,7 +59,7 @@ static struct session_vdevice *get_vdevice_by_index(int device_index)
/* TODO: Sanity checks on device_index. */ /* TODO: Sanity checks on device_index. */
if (!(sdi = sr_get_dev_inst(device_instances, device_index))) { if (!(sdi = sr_dev_inst_get(device_instances, device_index))) {
sr_err("session driver: %s: device instance with device " sr_err("session driver: %s: device instance with device "
"index %d was not found", __func__, device_index); "index %d was not found", __func__, device_index);
return NULL; return NULL;

View File

@ -77,7 +77,7 @@ SR_PRIV int sr_err(const char *format, ...);
/*--- hwplugin.c ------------------------------------------------------------*/ /*--- hwplugin.c ------------------------------------------------------------*/
SR_PRIV int load_hwplugins(void); SR_PRIV int sr_hwplugins_load(void);
SR_PRIV void sr_hwplugins_cleanup(void); SR_PRIV void sr_hwplugins_cleanup(void);
/*--- session.c -------------------------------------------------------------*/ /*--- session.c -------------------------------------------------------------*/
@ -88,7 +88,7 @@ SR_PRIV int sr_session_bus(struct sr_device *device,
/* Generic device instances */ /* Generic device instances */
SR_PRIV struct sr_device_instance *sr_dev_inst_new(int index, SR_PRIV struct sr_device_instance *sr_dev_inst_new(int index,
int status, const char *vendor, const char *model, const char *version); int status, const char *vendor, const char *model, const char *version);
SR_PRIV struct sr_device_instance *sr_get_dev_inst( SR_PRIV struct sr_device_instance *sr_dev_inst_get(
GSList *device_instances, int device_index); GSList *device_instances, int device_index);
SR_PRIV void sr_dev_inst_free(struct sr_device_instance *sdi); SR_PRIV void sr_dev_inst_free(struct sr_device_instance *sdi);

View File

@ -60,7 +60,7 @@ SR_API int sr_dev_trigger_clear(struct sr_device *device);
SR_API int sr_dev_trigger_set(struct sr_device *device, int probenum, SR_API int sr_dev_trigger_set(struct sr_device *device, int probenum,
const char *trigger); const char *trigger);
SR_API gboolean sr_dev_has_hwcap(const struct sr_device *device, int hwcap); SR_API gboolean sr_dev_has_hwcap(const struct sr_device *device, int hwcap);
SR_API int sr_dev_get_info(const struct sr_device *device, int id, SR_API int sr_dev_info_get(const struct sr_device *device, int id,
const void **data); const void **data);
/*--- filter.c --------------------------------------------------------------*/ /*--- filter.c --------------------------------------------------------------*/
@ -74,8 +74,8 @@ SR_API int sr_filter_probes(int in_unitsize, int out_unitsize,
SR_API GSList *sr_hwplugins_list(void); SR_API GSList *sr_hwplugins_list(void);
SR_API int sr_hwplugin_init(struct sr_device_plugin *plugin); SR_API int sr_hwplugin_init(struct sr_device_plugin *plugin);
SR_API gboolean sr_has_hwcap(int *capabilities, int hwcap); SR_API gboolean sr_hwplugin_has_hwcap(struct sr_device_plugin *plugin, int hwcap);
SR_API struct sr_hwcap_option *sr_find_hwcap_option(int hwcap); SR_API struct sr_hwcap_option *sr_hwplugins_hwcap_get(int hwcap);
/*--- session.c -------------------------------------------------------------*/ /*--- session.c -------------------------------------------------------------*/