Add libusb_get_port_path wrapper

This follows the libusbx API reference at
http://libusbx.sourceforge.net/api-1.0/group__dev.html

Reviewed by: hselasky@
This commit is contained in:
Ed Maste 2013-05-08 00:55:29 +00:00
parent be4147dd7c
commit 5906bf4984
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=250342
3 changed files with 18 additions and 1 deletions

View File

@ -26,7 +26,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd May 7, 2012
.Dd May 7, 2013
.Dt LIBUSB 3
.Os
.Sh NAME
@ -102,6 +102,15 @@ counter decremented once.
Returns the number of the bus contained by the device
.Fa dev .
.Pp
.Ft int
.Fn libusb_get_port_path "libusb_context *ctx" "libusb_device *dev" "uint8_t *buf" "uint8_t bufsize"
Stores, in the buffer
.Fa buf
of size
.Fa bufsize ,
the list of all port numbers from root for the device
.Fa dev .
.Pp
.Ft uint8_t
.Fn libusb_get_device_address "libusb_device *dev"
Returns the device_address contained by the device

View File

@ -369,6 +369,7 @@ void libusb_exit(struct libusb_context *ctx);
ssize_t libusb_get_device_list(libusb_context * ctx, libusb_device *** list);
void libusb_free_device_list(libusb_device ** list, int unref_devices);
uint8_t libusb_get_bus_number(libusb_device * dev);
int libusb_get_port_path(libusb_context *ctx, libusb_device *dev, uint8_t *buf, uint8_t bufsize);
uint8_t libusb_get_device_address(libusb_device * dev);
enum libusb_speed libusb_get_device_speed(libusb_device * dev);
int libusb_clear_halt(libusb_device_handle *devh, uint8_t endpoint);

View File

@ -290,6 +290,13 @@ libusb_get_bus_number(libusb_device *dev)
return (libusb20_dev_get_bus_number(dev->os_priv));
}
int
libusb_get_port_path(libusb_context *ctx, libusb_device *dev, uint8_t *buf,
uint8_t bufsize)
{
return (libusb20_dev_get_port_path(dev->os_priv, buf, bufsize));
}
uint8_t
libusb_get_device_address(libusb_device *dev)
{