sr: new sr_info_get() API call, wrapper for driver info_get()

This will replace sr_dev_info_get(), the wrapper for driver dev_info_get()
This commit is contained in:
Bert Vermeulen 2012-07-12 22:41:57 +02:00
parent f92f4eab23
commit df12380181
2 changed files with 28 additions and 0 deletions

View File

@ -177,6 +177,32 @@ SR_PRIV void sr_hw_cleanup_all(void)
}
}
/**
* Returns information about the given driver or device instance.
*
* @param driver The sr_dev_driver struct to query.
* @param id The type of information, in the form of an SR_HWCAP_* option.
* @param data Pointer where the value. will be stored. Must not be NULL.
* @param sdi Pointer to the struct sr_dev_inst to be checked. Must not be NULL.
*
* @return SR_OK upon success or SR_ERR in case of error. Note SR_ERR_ARG
* may be returned by the driver indicating it doesn't know that id,
* but this is not to be flagged as an error by the caller; merely
* as an indication that it's not applicable.
*/
SR_API int sr_info_get(struct sr_dev_driver *driver, int id,
const void **data, const struct sr_dev_inst *sdi)
{
int ret;
if (driver == NULL || data == NULL)
return SR_ERR;
ret = driver->info_get(id, data, sdi);
return ret;
}
SR_PRIV struct sr_dev_inst *sr_dev_inst_new(int index, int status,
const char *vendor, const char *model, const char *version)
{

View File

@ -77,6 +77,8 @@ SR_API GSList *sr_driver_scan(struct sr_dev_driver *driver, GSList *options);
SR_API gboolean sr_driver_hwcap_exists(struct sr_dev_driver *driver, int hwcap);
SR_API const struct sr_hwcap_option *sr_drvopt_get(int hwopt);
SR_API const struct sr_hwcap_option *sr_hw_hwcap_get(int hwcap);
SR_API int sr_info_get(struct sr_dev_driver *driver, int id,
const void **data, const struct sr_dev_inst *sdi);
/*--- session.c -------------------------------------------------------------*/