svn commit: r301964 - head/lib/libusb
Hans Petter Selasky
hselasky at FreeBSD.org
Thu Jun 16 12:14:21 UTC 2016
Author: hselasky
Date: Thu Jun 16 12:14:19 2016
New Revision: 301964
URL: https://svnweb.freebsd.org/changeset/base/301964
Log:
Add support for libusb_get_port_number() to the LibUSB v1.0 API.
Approved by: re (kostikbel)
Requested by: swills
MFC after: 1 week
Modified:
head/lib/libusb/libusb.3
head/lib/libusb/libusb.h
head/lib/libusb/libusb10.c
Modified: head/lib/libusb/libusb.3
==============================================================================
--- head/lib/libusb/libusb.3 Thu Jun 16 12:08:25 2016 (r301963)
+++ head/lib/libusb/libusb.3 Thu Jun 16 12:14:19 2016 (r301964)
@@ -26,7 +26,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd June 16, 2016
+.Dd June 17, 2016
.Dt LIBUSB 3
.Os
.Sh NAME
@@ -106,6 +106,12 @@ counter decremented once.
Returns the number of the bus contained by the device
.Fa dev .
.Pp
+.Ft uint8_t
+.Fn libusb_get_port_number "libusb_device *dev"
+Returns the port number which the device given by
+.Fa dev
+is attached to.
+.Pp
.Ft int
.Fn libusb_get_port_numbers "libusb_device *dev" "uint8_t *buf" "uint8_t bufsize"
Stores, in the buffer
Modified: head/lib/libusb/libusb.h
==============================================================================
--- head/lib/libusb/libusb.h Thu Jun 16 12:08:25 2016 (r301963)
+++ head/lib/libusb/libusb.h Thu Jun 16 12:14:19 2016 (r301964)
@@ -406,6 +406,7 @@ void libusb_exit(struct libusb_context *
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);
+uint8_t libusb_get_port_number(libusb_device * dev);
int libusb_get_port_numbers(libusb_device *dev, uint8_t *buf, uint8_t bufsize);
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);
Modified: head/lib/libusb/libusb10.c
==============================================================================
--- head/lib/libusb/libusb10.c Thu Jun 16 12:08:25 2016 (r301963)
+++ head/lib/libusb/libusb10.c Thu Jun 16 12:14:19 2016 (r301964)
@@ -308,6 +308,14 @@ libusb_get_bus_number(libusb_device *dev
return (libusb20_dev_get_bus_number(dev->os_priv));
}
+uint8_t
+libusb_get_port_number(libusb_device *dev)
+{
+ if (dev == NULL)
+ return (0); /* should not happen */
+ return (libusb20_dev_get_parent_port(dev->os_priv));
+}
+
int
libusb_get_port_numbers(libusb_device *dev, uint8_t *buf, uint8_t bufsize)
{
More information about the svn-src-all
mailing list