Expose driver info to library users

This commit is contained in:
Daniel Drake 2007-10-08 17:05:58 +01:00
parent 711bb1151b
commit 2c06a4ebfa
2 changed files with 27 additions and 0 deletions

View file

@ -118,6 +118,11 @@ API_EXPORTED void fp_dscv_devs_free(struct fp_dscv_dev **devs)
g_free(devs); g_free(devs);
} }
API_EXPORTED const struct fp_driver *fp_dscv_dev_get_driver(struct fp_dscv_dev *dev)
{
return dev->drv;
}
API_EXPORTED struct fp_dev *fp_dev_open(struct fp_dscv_dev *ddev) API_EXPORTED struct fp_dev *fp_dev_open(struct fp_dscv_dev *ddev)
{ {
struct fp_dev *dev; struct fp_dev *dev;
@ -152,6 +157,21 @@ API_EXPORTED void fp_dev_close(struct fp_dev *dev)
g_free(dev); g_free(dev);
} }
API_EXPORTED const struct fp_driver *fp_dev_get_driver(struct fp_dev *dev)
{
return dev->drv;
}
API_EXPORTED const char *fp_driver_get_name(const struct fp_driver *drv)
{
return drv->name;
}
API_EXPORTED const char *fp_driver_get_full_name(const struct fp_driver *drv)
{
return drv->full_name;
}
API_EXPORTED int fp_init(void) API_EXPORTED int fp_init(void)
{ {
usb_init(); usb_init();

View file

@ -23,14 +23,21 @@
/* structs that applications are not allowed to peek into */ /* structs that applications are not allowed to peek into */
struct fp_dscv_dev; struct fp_dscv_dev;
struct fp_dev; struct fp_dev;
struct fp_driver;
/* Device discovery */ /* Device discovery */
struct fp_dscv_dev **fp_discover_devs(void); struct fp_dscv_dev **fp_discover_devs(void);
void fp_dscv_devs_free(struct fp_dscv_dev **devs); void fp_dscv_devs_free(struct fp_dscv_dev **devs);
const struct fp_driver *fp_dscv_dev_get_driver(struct fp_dscv_dev *dev);
/* Device handling */ /* Device handling */
struct fp_dev *fp_dev_open(struct fp_dscv_dev *ddev); struct fp_dev *fp_dev_open(struct fp_dscv_dev *ddev);
void fp_dev_close(struct fp_dev *dev); void fp_dev_close(struct fp_dev *dev);
const struct fp_driver *fp_dev_get_driver(struct fp_dev *dev);
/* Drivers */
const char *fp_driver_get_name(const struct fp_driver *drv);
const char *fp_driver_get_full_name(const struct fp_driver *drv);
int fp_init(void); int fp_init(void);