From c77a24c24a844f32150345c9967c026a5a50da4c Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky Date: Fri, 3 May 2013 07:44:58 +0000 Subject: Add new USB API to get the port path of a USB device. MFC after: 2 weeks Requested by: emaste @ --- lib/libusb/Makefile | 1 + lib/libusb/libusb20.3 | 18 +++++++++++++++++- lib/libusb/libusb20.c | 7 +++++++ lib/libusb/libusb20.h | 1 + lib/libusb/libusb20_int.h | 2 ++ lib/libusb/libusb20_ugen20.c | 17 +++++++++++++++++ 6 files changed, 45 insertions(+), 1 deletion(-) (limited to 'lib/libusb') diff --git a/lib/libusb/Makefile b/lib/libusb/Makefile index 66dd7959caf4..ce50593734d9 100644 --- a/lib/libusb/Makefile +++ b/lib/libusb/Makefile @@ -203,6 +203,7 @@ MLINKS += libusb20.3 libusb20_dev_reset.3 MLINKS += libusb20.3 libusb20_dev_check_connected.3 MLINKS += libusb20.3 libusb20_dev_set_power_mode.3 MLINKS += libusb20.3 libusb20_dev_get_power_mode.3 +MLINKS += libusb20.3 libusb20_dev_get_port_path.3 MLINKS += libusb20.3 libusb20_dev_get_power_usage.3 MLINKS += libusb20.3 libusb20_dev_set_alt_index.3 MLINKS += libusb20.3 libusb20_dev_get_device_desc.3 diff --git a/lib/libusb/libusb20.3 b/lib/libusb/libusb20.3 index 8d286f13723f..e367bf36a874 100644 --- a/lib/libusb/libusb20.3 +++ b/lib/libusb/libusb20.3 @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 14, 2013 +.Dd May 3, 2013 .Dt LIBUSB20 3 .Os .Sh NAME @@ -114,6 +114,8 @@ USB access library (libusb -lusb) .Ft const char * .Fn libusb20_dev_get_backend_name "struct libusb20_device *" .Ft int +.Fn libusb20_dev_get_port_path "struct libusb20_device *pdev" "uint8_t *buf" "uint8_t bufsize" +.Ft int .Fn libusb20_dev_get_info "struct libusb20_device *pdev" "struct usb_device_info *pinfo" .Ft int .Fn libusb20_dev_get_iface_desc "struct libusb20_device *pdev" "uint8_t iface_index" "char *buf" "uint8_t len" @@ -552,6 +554,20 @@ returns a zero terminated string describing the backend used. . .Pp . +.Fn libusb20_dev_get_port_path +retrieves the list of USB port numbers which the datastream for a given USB device follows. +The first port number is the Root HUB port number. +Then children port numbers follow. +The Root HUB device itself has a port path length of zero. +Valid port numbers start at one and range until and including 255. +Typically there should not be more than 16 levels, due to electrical and protocol limitations. +This functions returns the number of actual port levels upon success +else a LIBUSB20_ERROR value is returned which are always negative. +If the actual number of port levels is greater than the maximum +specified, a LIBUSB20_ERROR value is returned. +. +.Pp +. .Fn libusb20_dev_get_info retrieves the BSD specific usb_device_info structure into the memory location given by .Fa pinfo . diff --git a/lib/libusb/libusb20.c b/lib/libusb/libusb20.c index 644eda4f5498..ed332a6a93c1 100644 --- a/lib/libusb/libusb20.c +++ b/lib/libusb/libusb20.c @@ -75,6 +75,7 @@ dummy_callback(struct libusb20_transfer *xfer) #define dummy_check_connected (void *)dummy_int #define dummy_set_power_mode (void *)dummy_int #define dummy_get_power_mode (void *)dummy_int +#define dummy_get_port_path (void *)dummy_int #define dummy_get_power_usage (void *)dummy_int #define dummy_kernel_driver_active (void *)dummy_int #define dummy_detach_kernel_driver (void *)dummy_int @@ -722,6 +723,12 @@ libusb20_dev_get_power_mode(struct libusb20_device *pdev) return (power_mode); } +int +libusb20_dev_get_port_path(struct libusb20_device *pdev, uint8_t *buf, uint8_t bufsize) +{ + return (pdev->methods->get_port_path(pdev, buf, bufsize)); +} + uint16_t libusb20_dev_get_power_usage(struct libusb20_device *pdev) { diff --git a/lib/libusb/libusb20.h b/lib/libusb/libusb20.h index 4a57b49710f6..6d1613e3e649 100644 --- a/lib/libusb/libusb20.h +++ b/lib/libusb/libusb20.h @@ -251,6 +251,7 @@ int libusb20_dev_reset(struct libusb20_device *pdev); int libusb20_dev_check_connected(struct libusb20_device *pdev); int libusb20_dev_set_power_mode(struct libusb20_device *pdev, uint8_t power_mode); uint8_t libusb20_dev_get_power_mode(struct libusb20_device *pdev); +int libusb20_dev_get_port_path(struct libusb20_device *pdev, uint8_t *buf, uint8_t bufsize); uint16_t libusb20_dev_get_power_usage(struct libusb20_device *pdev); int libusb20_dev_set_alt_index(struct libusb20_device *pdev, uint8_t iface_index, uint8_t alt_index); int libusb20_dev_get_info(struct libusb20_device *pdev, struct usb_device_info *pinfo); diff --git a/lib/libusb/libusb20_int.h b/lib/libusb/libusb20_int.h index 6705c630c868..27adf008dea5 100644 --- a/lib/libusb/libusb20_int.h +++ b/lib/libusb/libusb20_int.h @@ -105,6 +105,7 @@ typedef int (libusb20_process_t)(struct libusb20_device *pdev); typedef int (libusb20_reset_device_t)(struct libusb20_device *pdev); typedef int (libusb20_set_power_mode_t)(struct libusb20_device *pdev, uint8_t power_mode); typedef int (libusb20_get_power_mode_t)(struct libusb20_device *pdev, uint8_t *power_mode); +typedef int (libusb20_get_port_path_t)(struct libusb20_device *pdev, uint8_t *buf, uint8_t bufsize); typedef int (libusb20_get_power_usage_t)(struct libusb20_device *pdev, uint16_t *power_usage); typedef int (libusb20_set_alt_index_t)(struct libusb20_device *pdev, uint8_t iface_index, uint8_t alt_index); typedef int (libusb20_set_config_index_t)(struct libusb20_device *pdev, uint8_t index); @@ -128,6 +129,7 @@ typedef void (libusb20_tr_cancel_async_t)(struct libusb20_transfer *xfer); m(n, check_connected) \ m(n, set_power_mode) \ m(n, get_power_mode) \ + m(n, get_port_path) \ m(n, get_power_usage) \ m(n, set_alt_index) \ m(n, set_config_index) \ diff --git a/lib/libusb/libusb20_ugen20.c b/lib/libusb/libusb20_ugen20.c index 0846eb4b7d52..a4c973e10725 100644 --- a/lib/libusb/libusb20_ugen20.c +++ b/lib/libusb/libusb20_ugen20.c @@ -73,6 +73,7 @@ static libusb20_reset_device_t ugen20_reset_device; static libusb20_check_connected_t ugen20_check_connected; static libusb20_set_power_mode_t ugen20_set_power_mode; static libusb20_get_power_mode_t ugen20_get_power_mode; +static libusb20_get_port_path_t ugen20_get_port_path; static libusb20_get_power_usage_t ugen20_get_power_usage; static libusb20_kernel_driver_active_t ugen20_kernel_driver_active; static libusb20_detach_kernel_driver_t ugen20_detach_kernel_driver; @@ -643,6 +644,22 @@ ugen20_get_power_mode(struct libusb20_device *pdev, uint8_t *power_mode) return (0); /* success */ } +static int +ugen20_get_port_path(struct libusb20_device *pdev, uint8_t *buf, uint8_t bufsize) +{ + struct usb_device_port_path udpp; + + if (ioctl(pdev->file_ctrl, USB_GET_DEV_PORT_PATH, &udpp)) + return (LIBUSB20_ERROR_OTHER); + + if (udpp.udp_port_level > bufsize) + return (LIBUSB20_ERROR_OVERFLOW); + + memcpy(buf, udpp.udp_port_no, udpp.udp_port_level); + + return (udpp.udp_port_level); /* success */ +} + static int ugen20_get_power_usage(struct libusb20_device *pdev, uint16_t *power_usage) { -- cgit v1.3 From 22a962c9fe4e347a1a55c9c7ae445aa382887ad3 Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Tue, 7 May 2013 20:35:47 +0000 Subject: Constify libusb_get_pollfds return The correct return type, per our libusb(3) man page and the libusb.org and libusbx projects (whose interface we intend to follow for our libusb), is const struct libusb_pollfd **. Unfortunately the doxygen-generated libusbx API documentation[1] omits[2] the const for some reason. [1] http://libusbx.sourceforge.net/api-1.0/group__poll.html#gab1a72869a926552b27a6c667695df3a2 [2] http://sourceforge.net/mailarchive/forum.php?thread_name=497D10BE.8090007%40n-dimensional.de&forum_name=libusb-devel Reviewed by: hselasky@ --- lib/libusb/libusb.h | 2 +- lib/libusb/libusb10_io.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/libusb') diff --git a/lib/libusb/libusb.h b/lib/libusb/libusb.h index 225b539e907a..52ad914377bc 100644 --- a/lib/libusb/libusb.h +++ b/lib/libusb/libusb.h @@ -441,7 +441,7 @@ int libusb_handle_events(libusb_context * ctx); int libusb_handle_events_locked(libusb_context * ctx, struct timeval *tv); int libusb_get_next_timeout(libusb_context * ctx, struct timeval *tv); void libusb_set_pollfd_notifiers(libusb_context * ctx, libusb_pollfd_added_cb added_cb, libusb_pollfd_removed_cb removed_cb, void *user_data); -struct libusb_pollfd **libusb_get_pollfds(libusb_context * ctx); +const struct libusb_pollfd **libusb_get_pollfds(libusb_context * ctx); /* Synchronous device I/O */ diff --git a/lib/libusb/libusb10_io.c b/lib/libusb/libusb10_io.c index 489ceb76caed..9aa31c484224 100644 --- a/lib/libusb/libusb10_io.c +++ b/lib/libusb/libusb10_io.c @@ -397,7 +397,7 @@ libusb_set_pollfd_notifiers(libusb_context *ctx, ctx->fd_cb_user_data = user_data; } -struct libusb_pollfd ** +const struct libusb_pollfd ** libusb_get_pollfds(libusb_context *ctx) { struct libusb_super_pollfd *pollfd; @@ -423,7 +423,7 @@ libusb_get_pollfds(libusb_context *ctx) done: CTX_UNLOCK(ctx); - return (ret); + return ((const struct libusb_pollfd **)ret); } -- cgit v1.3 From 5906bf4984400c498b0b3d8f572ec8d18c5b13c7 Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Wed, 8 May 2013 00:55:29 +0000 Subject: 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@ --- lib/libusb/libusb.3 | 11 ++++++++++- lib/libusb/libusb.h | 1 + lib/libusb/libusb10.c | 7 +++++++ 3 files changed, 18 insertions(+), 1 deletion(-) (limited to 'lib/libusb') diff --git a/lib/libusb/libusb.3 b/lib/libusb/libusb.3 index ffc761b72202..28dff946d5a8 100644 --- a/lib/libusb/libusb.3 +++ b/lib/libusb/libusb.3 @@ -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 diff --git a/lib/libusb/libusb.h b/lib/libusb/libusb.h index 52ad914377bc..220a8daf7c90 100644 --- a/lib/libusb/libusb.h +++ b/lib/libusb/libusb.h @@ -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); diff --git a/lib/libusb/libusb10.c b/lib/libusb/libusb10.c index 021229669119..802bc8a878f8 100644 --- a/lib/libusb/libusb10.c +++ b/lib/libusb/libusb10.c @@ -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) { -- cgit v1.3 From 2710751bc309af25c6dea1171781678258e83840 Mon Sep 17 00:00:00 2001 From: Joel Dahl Date: Sun, 12 May 2013 22:22:12 +0000 Subject: mdoc sweep. --- bin/ed/ed.1 | 4 ++-- lib/libradius/radius.conf.5 | 4 +++- lib/libtacplus/libtacplus.3 | 4 +++- lib/libtacplus/tacplus.conf.5 | 4 +++- lib/libusb/libusb20.3 | 6 +++--- libexec/bootpd/bootptab.5 | 2 +- sbin/iscontrol/iscsi.conf.5 | 4 +++- share/man/man5/freebsd-update.conf.5 | 2 +- share/man/man5/mailer.conf.5 | 4 +++- share/man/man5/portsnap.conf.5 | 2 +- usr.bin/usbhidctl/usbhidctl.1 | 4 +++- usr.sbin/bootparamd/bootparamd/bootparamd.8 | 2 +- usr.sbin/freebsd-update/freebsd-update.8 | 4 ++-- usr.sbin/portsnap/portsnap/portsnap.8 | 6 +++--- usr.sbin/wake/wake.8 | 2 +- 15 files changed, 33 insertions(+), 21 deletions(-) (limited to 'lib/libusb') diff --git a/bin/ed/ed.1 b/bin/ed/ed.1 index dbfb3dda37f1..8342645997c9 100644 --- a/bin/ed/ed.1 +++ b/bin/ed/ed.1 @@ -914,9 +914,9 @@ that line. .El .Sh FILES .Bl -tag -width /tmp/ed.* -compact -.It /tmp/ed.* +.It Pa /tmp/ed.* buffer file -.It ed.hup +.It Pa ed.hup the file to which .Nm attempts to write the buffer if the terminal hangs up diff --git a/lib/libradius/radius.conf.5 b/lib/libradius/radius.conf.5 index 6f89c3ae2df3..1673a4890ec9 100644 --- a/lib/libradius/radius.conf.5 +++ b/lib/libradius/radius.conf.5 @@ -162,7 +162,9 @@ But an alternate pathname may be specified in the call to Since the file contains sensitive information in the form of the shared secrets, it should not be readable except by root. .Sh FILES -.Pa /etc/radius.conf +.Bl -tag -width Pa +.It Pa /etc/radius.conf +.El .Sh EXAMPLES .Bd -literal # A simple entry using all the defaults: diff --git a/lib/libtacplus/libtacplus.3 b/lib/libtacplus/libtacplus.3 index 40ec6a26246d..688e618c63ee 100644 --- a/lib/libtacplus/libtacplus.3 +++ b/lib/libtacplus/libtacplus.3 @@ -513,7 +513,9 @@ without recording an error message. .Fn tac_open .El .Sh FILES -.Pa /etc/tacplus.conf +.Bl -tag -width Pa +.It Pa /etc/tacplus.conf +.El .Sh SEE ALSO .Xr tacplus.conf 5 .Rs diff --git a/lib/libtacplus/tacplus.conf.5 b/lib/libtacplus/tacplus.conf.5 index e68982d3d627..ecabaf6f61ec 100644 --- a/lib/libtacplus/tacplus.conf.5 +++ b/lib/libtacplus/tacplus.conf.5 @@ -111,7 +111,9 @@ An alternate pathname may be specified in the call to Since the file contains sensitive information in the form of the shared secrets, it should not be readable except by root. .Sh FILES -.Pa /etc/tacplus.conf +.Bl -tag -width Pa +.It Pa /etc/tacplus.conf +.El .Sh EXAMPLES .Bd -literal # A simple entry using all the defaults: diff --git a/lib/libusb/libusb20.3 b/lib/libusb/libusb20.3 index e367bf36a874..f6004a534fdb 100644 --- a/lib/libusb/libusb20.3 +++ b/lib/libusb/libusb20.3 @@ -1049,9 +1049,9 @@ argument. This function does not return NULL. . .Sh FILES -. -. -/dev/usb +.Bl -tag -width Pa +.It Pa /dev/usb +.El .Sh SEE ALSO .Xr usb 4 , .Xr libusb 3 , diff --git a/libexec/bootpd/bootptab.5 b/libexec/bootpd/bootptab.5 index bfc535c0e0e0..0ba2b69206c4 100644 --- a/libexec/bootpd/bootptab.5 +++ b/libexec/bootpd/bootptab.5 @@ -421,7 +421,7 @@ mtoliver:ht=1:ha=00DD00FE1600:tc=.default: .Ed .Sh FILES .Bl -tag -width /etc/bootptab -compact -.It /etc/bootptab +.It Pa /etc/bootptab .El .Sh "SEE ALSO" .Xr bootpd 8 , diff --git a/sbin/iscontrol/iscsi.conf.5 b/sbin/iscontrol/iscsi.conf.5 index 1e2c7f027a26..e6a776da0e63 100644 --- a/sbin/iscontrol/iscsi.conf.5 +++ b/sbin/iscontrol/iscsi.conf.5 @@ -173,7 +173,9 @@ same as the none counterpart, but to authenticate the target. .El .Sh FILES -.Pa /etc/iscsi.conf +.Bl -tag -width indent +.It Pa /etc/iscsi.conf +.El .Sh EXAMPLES .Bd -literal # diff --git a/share/man/man5/freebsd-update.conf.5 b/share/man/man5/freebsd-update.conf.5 index 653b0559f201..f9f7a562fa42 100644 --- a/share/man/man5/freebsd-update.conf.5 +++ b/share/man/man5/freebsd-update.conf.5 @@ -221,7 +221,7 @@ kernel. .El .Sh FILES .Bl -tag -width "/etc/freebsd-update.conf" -.It /etc/freebsd-update.conf +.It Pa /etc/freebsd-update.conf Default location of the .Cm freebsd-update configuration file. diff --git a/share/man/man5/mailer.conf.5 b/share/man/man5/mailer.conf.5 index 2fb8236b52f7..3f48eda1a952 100644 --- a/share/man/man5/mailer.conf.5 +++ b/share/man/man5/mailer.conf.5 @@ -83,7 +83,9 @@ The file may also contain comment lines, denoted by a .Ql # mark in the first column of any line. .Sh FILES -/etc/mail/mailer.conf +.Bl -tag -width Pa +.It Pa /etc/mail/mailer.conf +.El .Sh EXAMPLES This example shows how to set up .Nm diff --git a/share/man/man5/portsnap.conf.5 b/share/man/man5/portsnap.conf.5 index 90225b293820..07685b2b0ef0 100644 --- a/share/man/man5/portsnap.conf.5 +++ b/share/man/man5/portsnap.conf.5 @@ -135,7 +135,7 @@ supported and may cause unexpected results. Any lines not of the above forms will be ignored. .Sh FILES .Bl -tag -width "/etc/portsnap.conf" -.It /etc/portsnap.conf +.It Pa /etc/portsnap.conf Default location of the portsnap configuration file. .El .Sh SEE ALSO diff --git a/usr.bin/usbhidctl/usbhidctl.1 b/usr.bin/usbhidctl/usbhidctl.1 index bb7d95863344..6ee9785c4694 100644 --- a/usr.bin/usbhidctl/usbhidctl.1 +++ b/usr.bin/usbhidctl/usbhidctl.1 @@ -136,8 +136,10 @@ supports isolating each item by appending a .Sq Cm \&# . character and a decimal item instance number, starting at zero. .Sh FILES -.Pa /usr/share/misc/usb_hid_usages +.Bl -tag -width 30n +.It Pa /usr/share/misc/usb_hid_usages The default HID usage table. +.El .Sh SEE ALSO .Xr usbhid 3 , .Xr uhid 4 , diff --git a/usr.sbin/bootparamd/bootparamd/bootparamd.8 b/usr.sbin/bootparamd/bootparamd/bootparamd.8 index 3b49822954d5..4d97cb52c37a 100644 --- a/usr.sbin/bootparamd/bootparamd/bootparamd.8 +++ b/usr.sbin/bootparamd/bootparamd/bootparamd.8 @@ -48,7 +48,7 @@ The file to use as boot parameter file instead of .El .Sh FILES .Bl -tag -width /etc/bootparams -compact -.It /etc/bootparams +.It Pa /etc/bootparams default boot parameter file .El .Sh EXAMPLES diff --git a/usr.sbin/freebsd-update/freebsd-update.8 b/usr.sbin/freebsd-update/freebsd-update.8 index 472a5f72abad..f372587eee8b 100644 --- a/usr.sbin/freebsd-update/freebsd-update.8 +++ b/usr.sbin/freebsd-update/freebsd-update.8 @@ -162,11 +162,11 @@ purposes, make sure you boot from a secure disk (e.g., a CD). .El .Sh FILES .Bl -tag -width "/etc/freebsd-update.conf" -.It /etc/freebsd-update.conf +.It Pa /etc/freebsd-update.conf Default location of the .Nm configuration file. -.It /var/db/freebsd-update/ +.It Pa /var/db/freebsd-update/ Default location where .Nm stores temporary files and downloaded updates. diff --git a/usr.sbin/portsnap/portsnap/portsnap.8 b/usr.sbin/portsnap/portsnap/portsnap.8 index da94efc4dcfb..afe5c3e6042e 100644 --- a/usr.sbin/portsnap/portsnap/portsnap.8 +++ b/usr.sbin/portsnap/portsnap/portsnap.8 @@ -247,11 +247,11 @@ may be published, but only in aggregate and after anonymizing the individual systems. .Sh FILES .Bl -tag -width "/etc/portsnap.conf" -.It /etc/portsnap.conf +.It Pa /etc/portsnap.conf Default location of the portsnap configuration file. -.It /var/db/portsnap +.It Pa /var/db/portsnap Default location where compressed snapshots are stored. -.It /usr/ports +.It Pa /usr/ports Default location where the ports tree is extracted. .El .Sh SEE ALSO diff --git a/usr.sbin/wake/wake.8 b/usr.sbin/wake/wake.8 index ce30abfc43d1..53249073b6fa 100644 --- a/usr.sbin/wake/wake.8 +++ b/usr.sbin/wake/wake.8 @@ -56,7 +56,7 @@ Link layer addresses can be determined and set using .Xr ifconfig 8 . .Sh FILES .Bl -tag -width "/etc/ethers" -compact -.It /etc/ethers +.It Pa /etc/ethers Ethernet host name data base. .El .Sh SEE ALSO -- cgit v1.3 From a9205626a7e2f89486e637d6187ff99c17efeb10 Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Fri, 7 Jun 2013 13:45:58 +0000 Subject: Add libusb_get_port_numbers libusbx deprecated libusb_get_port_path and replaced it with libusb_get_port_numbers. The latter omits an extra parameter which was unused in the FreeBSD implementation anyway. --- lib/libusb/libusb.3 | 8 ++++++-- lib/libusb/libusb.h | 1 + lib/libusb/libusb10.c | 6 ++++++ 3 files changed, 13 insertions(+), 2 deletions(-) (limited to 'lib/libusb') diff --git a/lib/libusb/libusb.3 b/lib/libusb/libusb.3 index 28dff946d5a8..b50981cf5d5c 100644 --- a/lib/libusb/libusb.3 +++ b/lib/libusb/libusb.3 @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 7, 2013 +.Dd June 7, 2013 .Dt LIBUSB 3 .Os .Sh NAME @@ -103,7 +103,7 @@ 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" +.Fn libusb_get_port_numbers "libusb_device *dev" "uint8_t *buf" "uint8_t bufsize" Stores, in the buffer .Fa buf of size @@ -111,6 +111,10 @@ of size the list of all port numbers from root for the device .Fa dev . .Pp +.Ft int +.Fn libusb_get_port_path "libusb_context *ctx" "libusb_device *dev" "uint8_t *buf" "uint8_t bufsize" +Deprecated function equivalent to libusb_get_port_numbers. +.Pp .Ft uint8_t .Fn libusb_get_device_address "libusb_device *dev" Returns the device_address contained by the device diff --git a/lib/libusb/libusb.h b/lib/libusb/libusb.h index 220a8daf7c90..b14990eda50d 100644 --- a/lib/libusb/libusb.h +++ b/lib/libusb/libusb.h @@ -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_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); enum libusb_speed libusb_get_device_speed(libusb_device * dev); diff --git a/lib/libusb/libusb10.c b/lib/libusb/libusb10.c index 802bc8a878f8..79a570ed543f 100644 --- a/lib/libusb/libusb10.c +++ b/lib/libusb/libusb10.c @@ -290,6 +290,12 @@ libusb_get_bus_number(libusb_device *dev) return (libusb20_dev_get_bus_number(dev->os_priv)); } +int +libusb_get_port_numbers(libusb_device *dev, uint8_t *buf, uint8_t bufsize) +{ + return (libusb20_dev_get_port_path(dev->os_priv, buf, bufsize)); +} + int libusb_get_port_path(libusb_context *ctx, libusb_device *dev, uint8_t *buf, uint8_t bufsize) -- cgit v1.3 From 99cd1f32af556ea58a3d7b6b4ebbd2d52c0d3af0 Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky Date: Sun, 14 Jul 2013 10:22:00 +0000 Subject: Add some missing definitions to build a working FreeBSD's libusb under Linux. --- lib/libusb/Makefile | 15 ++++++-- lib/libusb/libusb20.c | 20 +++-------- lib/libusb/libusb20_ugen20.c | 78 +++++++++++++++++++++------------------- lib/libusb/libusb_global_linux.h | 9 +++++ 4 files changed, 67 insertions(+), 55 deletions(-) (limited to 'lib/libusb') diff --git a/lib/libusb/Makefile b/lib/libusb/Makefile index ce50593734d9..d0698e3c2ce5 100644 --- a/lib/libusb/Makefile +++ b/lib/libusb/Makefile @@ -15,11 +15,12 @@ INCS+= libusb20_desc.h MAN= libusb.3 libusb20.3 MKLINT= no NOGCCERROR= +PTHREAD_LIBS?= -lpthread WARNS?= 2 DPADD= ${LIBPTHREAD} -LDADD= -lpthread +LDADD= ${PTHREAD_LIBS} MLINKS+= libusb.3 usb.3 @@ -42,7 +43,17 @@ CFLAGS+= -DCOMPAT_32BIT # # Examples: # make LIBUSB_GLOBAL_INCLUDE_FILE=libusb_global_linux.h -# make COMPAT_32BIT=YES LIBUSB_GLOBAL_INCLUDE_FILE=libusb_global_linux.h +# make COMPAT_32BIT=YES \ +# LIBUSB_GLOBAL_INCLUDE_FILE=libusb_global_linux.h \ +# DEBUG_FLAGS="-g" +# +# From Ubuntu 10.04: +# freebsd-make LIBUSB_GLOBAL_INCLUDE_FILE=libusb_global_linux.h \ +# PTHREAD_LIBS="-lpthread -lrt" +# freebsd-make COMPAT32_BIT=YES \ +# LIBUSB_GLOBAL_INCLUDE_FILE=libusb_global_linux.h \ +# PTHREAD_LIBS="-lpthread -lrt" +# # .if defined(LIBUSB_GLOBAL_INCLUDE_FILE) CFLAGS+= -DLIBUSB_GLOBAL_INCLUDE_FILE=\"${LIBUSB_GLOBAL_INCLUDE_FILE}\" diff --git a/lib/libusb/libusb20.c b/lib/libusb/libusb20.c index ed332a6a93c1..1de3a265125a 100644 --- a/lib/libusb/libusb20.c +++ b/lib/libusb/libusb20.c @@ -1202,27 +1202,13 @@ libusb20_be_alloc(const struct libusb20_backend_methods *methods) struct libusb20_backend * libusb20_be_alloc_linux(void) { - struct libusb20_backend *pbe; - -#ifdef __linux__ - pbe = libusb20_be_alloc(&libusb20_linux_backend); -#else - pbe = NULL; -#endif - return (pbe); + return (NULL); } struct libusb20_backend * libusb20_be_alloc_ugen20(void) { - struct libusb20_backend *pbe; - -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) - pbe = libusb20_be_alloc(&libusb20_ugen20_backend); -#else - pbe = NULL; -#endif - return (pbe); + return (libusb20_be_alloc(&libusb20_ugen20_backend)); } struct libusb20_backend * @@ -1230,10 +1216,12 @@ libusb20_be_alloc_default(void) { struct libusb20_backend *pbe; +#ifdef __linux__ pbe = libusb20_be_alloc_linux(); if (pbe) { return (pbe); } +#endif pbe = libusb20_be_alloc_ugen20(); if (pbe) { return (pbe); diff --git a/lib/libusb/libusb20_ugen20.c b/lib/libusb/libusb20_ugen20.c index a4c973e10725..341bfb6d71ad 100644 --- a/lib/libusb/libusb20_ugen20.c +++ b/lib/libusb/libusb20_ugen20.c @@ -46,6 +46,10 @@ #include "libusb20_desc.h" #include "libusb20_int.h" +#ifndef IOUSB +#define IOUSB(a) a +#endif + static libusb20_init_backend_t ugen20_init_backend; static libusb20_open_device_t ugen20_open_device; static libusb20_close_device_t ugen20_close_device; @@ -145,14 +149,14 @@ ugen20_enumerate(struct libusb20_device *pdev, const char *id) if (f < 0) { return (LIBUSB20_ERROR_OTHER); } - if (ioctl(f, USB_GET_PLUGTIME, &plugtime)) { + if (ioctl(f, IOUSB(USB_GET_PLUGTIME), &plugtime)) { error = LIBUSB20_ERROR_OTHER; goto done; } /* store when the device was plugged */ pdev->session_data.plugtime = plugtime; - if (ioctl(f, USB_GET_DEVICE_DESC, &ddesc)) { + if (ioctl(f, IOUSB(USB_GET_DEVICE_DESC), &ddesc)) { error = LIBUSB20_ERROR_OTHER; goto done; } @@ -167,7 +171,7 @@ ugen20_enumerate(struct libusb20_device *pdev, const char *id) error = LIBUSB20_ERROR_OTHER; goto done; } - if (ioctl(f, USB_GET_DEVICEINFO, &devinfo)) { + if (ioctl(f, IOUSB(USB_GET_DEVICEINFO), &devinfo)) { error = LIBUSB20_ERROR_OTHER; goto done; } @@ -241,7 +245,7 @@ repeat: st->urd.urd_maxlen = sizeof(st->buf); st->nparsed = 0; - if (ioctl(st->f, USB_READ_DIR, &st->urd)) { + if (ioctl(st->f, IOUSB(USB_READ_DIR), &st->urd)) { return (EINVAL); } st->ptr = st->buf; @@ -313,7 +317,7 @@ ugen20_tr_release(struct libusb20_device *pdev) /* release all pending USB transfers */ if (pdev->privBeData != NULL) { memset(&fs_uninit, 0, sizeof(fs_uninit)); - if (ioctl(pdev->file, USB_FS_UNINIT, &fs_uninit)) { + if (ioctl(pdev->file, IOUSB(USB_FS_UNINIT), &fs_uninit)) { /* ignore any errors of this kind */ } } @@ -353,7 +357,7 @@ ugen20_tr_renew(struct libusb20_device *pdev) fs_init.pEndpoints = libusb20_pass_ptr(pdev->privBeData); fs_init.ep_index_max = nMaxTransfer; - if (ioctl(pdev->file, USB_FS_INIT, &fs_init)) { + if (ioctl(pdev->file, IOUSB(USB_FS_INIT), &fs_init)) { error = LIBUSB20_ERROR_OTHER; goto done; } @@ -387,7 +391,7 @@ ugen20_open_device(struct libusb20_device *pdev, uint16_t nMaxTransfer) close(g); return (LIBUSB20_ERROR_NO_DEVICE); } - if (ioctl(f, USB_GET_PLUGTIME, &plugtime)) { + if (ioctl(f, IOUSB(USB_GET_PLUGTIME), &plugtime)) { error = LIBUSB20_ERROR_OTHER; goto done; } @@ -430,7 +434,7 @@ ugen20_close_device(struct libusb20_device *pdev) if (pdev->privBeData) { memset(&fs_uninit, 0, sizeof(fs_uninit)); - if (ioctl(pdev->file, USB_FS_UNINIT, &fs_uninit)) { + if (ioctl(pdev->file, IOUSB(USB_FS_UNINIT), &fs_uninit)) { /* ignore this error */ } free(pdev->privBeData); @@ -468,7 +472,7 @@ ugen20_get_config_desc_full(struct libusb20_device *pdev, gen_desc.ugd_maxlen = sizeof(cdesc); gen_desc.ugd_config_index = cfg_index; - error = ioctl(pdev->file_ctrl, USB_GET_FULL_DESC, &gen_desc); + error = ioctl(pdev->file_ctrl, IOUSB(USB_GET_FULL_DESC), &gen_desc); if (error) { return (LIBUSB20_ERROR_OTHER); } @@ -488,7 +492,7 @@ ugen20_get_config_desc_full(struct libusb20_device *pdev, gen_desc.ugd_data = libusb20_pass_ptr(ptr); gen_desc.ugd_maxlen = len; - error = ioctl(pdev->file_ctrl, USB_GET_FULL_DESC, &gen_desc); + error = ioctl(pdev->file_ctrl, IOUSB(USB_GET_FULL_DESC), &gen_desc); if (error) { free(ptr); return (LIBUSB20_ERROR_OTHER); @@ -507,7 +511,7 @@ ugen20_get_config_index(struct libusb20_device *pdev, uint8_t *pindex) { int temp; - if (ioctl(pdev->file_ctrl, USB_GET_CONFIG, &temp)) { + if (ioctl(pdev->file_ctrl, IOUSB(USB_GET_CONFIG), &temp)) { return (LIBUSB20_ERROR_OTHER); } *pindex = temp; @@ -523,7 +527,7 @@ ugen20_set_config_index(struct libusb20_device *pdev, uint8_t cfg_index) /* release all active USB transfers */ ugen20_tr_release(pdev); - if (ioctl(pdev->file_ctrl, USB_SET_CONFIG, &temp)) { + if (ioctl(pdev->file_ctrl, IOUSB(USB_SET_CONFIG), &temp)) { return (LIBUSB20_ERROR_OTHER); } return (ugen20_tr_renew(pdev)); @@ -543,7 +547,7 @@ ugen20_set_alt_index(struct libusb20_device *pdev, /* release all active USB transfers */ ugen20_tr_release(pdev); - if (ioctl(pdev->file_ctrl, USB_SET_ALTINTERFACE, &alt_iface)) { + if (ioctl(pdev->file_ctrl, IOUSB(USB_SET_ALTINTERFACE), &alt_iface)) { return (LIBUSB20_ERROR_OTHER); } return (ugen20_tr_renew(pdev)); @@ -557,7 +561,7 @@ ugen20_reset_device(struct libusb20_device *pdev) /* release all active USB transfers */ ugen20_tr_release(pdev); - if (ioctl(pdev->file_ctrl, USB_DEVICEENUMERATE, &temp)) { + if (ioctl(pdev->file_ctrl, IOUSB(USB_DEVICEENUMERATE), &temp)) { return (LIBUSB20_ERROR_OTHER); } return (ugen20_tr_renew(pdev)); @@ -569,7 +573,7 @@ ugen20_check_connected(struct libusb20_device *pdev) uint32_t plugtime; int error = 0; - if (ioctl(pdev->file_ctrl, USB_GET_PLUGTIME, &plugtime)) { + if (ioctl(pdev->file_ctrl, IOUSB(USB_GET_PLUGTIME), &plugtime)) { error = LIBUSB20_ERROR_NO_DEVICE; goto done; } @@ -606,7 +610,7 @@ ugen20_set_power_mode(struct libusb20_device *pdev, uint8_t power_mode) default: return (LIBUSB20_ERROR_INVALID_PARAM); } - if (ioctl(pdev->file_ctrl, USB_SET_POWER_MODE, &temp)) { + if (ioctl(pdev->file_ctrl, IOUSB(USB_SET_POWER_MODE), &temp)) { return (LIBUSB20_ERROR_OTHER); } return (0); @@ -617,7 +621,7 @@ ugen20_get_power_mode(struct libusb20_device *pdev, uint8_t *power_mode) { int temp; - if (ioctl(pdev->file_ctrl, USB_GET_POWER_MODE, &temp)) { + if (ioctl(pdev->file_ctrl, IOUSB(USB_GET_POWER_MODE), &temp)) { return (LIBUSB20_ERROR_OTHER); } switch (temp) { @@ -649,7 +653,7 @@ ugen20_get_port_path(struct libusb20_device *pdev, uint8_t *buf, uint8_t bufsize { struct usb_device_port_path udpp; - if (ioctl(pdev->file_ctrl, USB_GET_DEV_PORT_PATH, &udpp)) + if (ioctl(pdev->file_ctrl, IOUSB(USB_GET_DEV_PORT_PATH), &udpp)) return (LIBUSB20_ERROR_OTHER); if (udpp.udp_port_level > bufsize) @@ -665,7 +669,7 @@ ugen20_get_power_usage(struct libusb20_device *pdev, uint16_t *power_usage) { int temp; - if (ioctl(pdev->file_ctrl, USB_GET_POWER_USAGE, &temp)) { + if (ioctl(pdev->file_ctrl, IOUSB(USB_GET_POWER_USAGE), &temp)) { return (LIBUSB20_ERROR_OTHER); } *power_usage = temp; @@ -678,7 +682,7 @@ ugen20_kernel_driver_active(struct libusb20_device *pdev, { int temp = iface_index; - if (ioctl(pdev->file_ctrl, USB_IFACE_DRIVER_ACTIVE, &temp)) { + if (ioctl(pdev->file_ctrl, IOUSB(USB_IFACE_DRIVER_ACTIVE), &temp)) { return (LIBUSB20_ERROR_OTHER); } return (0); /* kernel driver is active */ @@ -690,7 +694,7 @@ ugen20_detach_kernel_driver(struct libusb20_device *pdev, { int temp = iface_index; - if (ioctl(pdev->file_ctrl, USB_IFACE_DRIVER_DETACH, &temp)) { + if (ioctl(pdev->file_ctrl, IOUSB(USB_IFACE_DRIVER_DETACH), &temp)) { return (LIBUSB20_ERROR_OTHER); } return (0); /* kernel driver is active */ @@ -713,7 +717,7 @@ ugen20_do_request_sync(struct libusb20_device *pdev, sizeof(req.ucr_request), setup)) { /* ignore */ } - if (ioctl(pdev->file_ctrl, USB_DO_REQUEST, &req)) { + if (ioctl(pdev->file_ctrl, IOUSB(USB_DO_REQUEST), &req)) { return (LIBUSB20_ERROR_OTHER); } if (pactlen) { @@ -732,7 +736,7 @@ ugen20_process(struct libusb20_device *pdev) while (1) { - if (ioctl(pdev->file, USB_FS_COMPLETE, &temp)) { + if (ioctl(pdev->file, IOUSB(USB_FS_COMPLETE), &temp)) { if (errno == EBUSY) { break; } else { @@ -800,10 +804,10 @@ ugen20_tr_open(struct libusb20_transfer *xfer, uint32_t MaxBufSize, if (stream_id != 0) { temp.fs_open_stream.stream_id = stream_id; - if (ioctl(xfer->pdev->file, USB_FS_OPEN_STREAM, &temp.fs_open_stream)) + if (ioctl(xfer->pdev->file, IOUSB(USB_FS_OPEN_STREAM), &temp.fs_open_stream)) return (LIBUSB20_ERROR_INVALID_PARAM); } else { - if (ioctl(xfer->pdev->file, USB_FS_OPEN, &temp.fs_open)) + if (ioctl(xfer->pdev->file, IOUSB(USB_FS_OPEN), &temp.fs_open)) return (LIBUSB20_ERROR_INVALID_PARAM); } /* maximums might have changed - update */ @@ -829,7 +833,7 @@ ugen20_tr_close(struct libusb20_transfer *xfer) temp.ep_index = xfer->trIndex; - if (ioctl(xfer->pdev->file, USB_FS_CLOSE, &temp)) { + if (ioctl(xfer->pdev->file, IOUSB(USB_FS_CLOSE), &temp)) { return (LIBUSB20_ERROR_INVALID_PARAM); } return (0); /* success */ @@ -846,7 +850,7 @@ ugen20_tr_clear_stall_sync(struct libusb20_transfer *xfer) temp.ep_index = xfer->trIndex; - if (ioctl(xfer->pdev->file, USB_FS_CLEAR_STALL_SYNC, &temp)) { + if (ioctl(xfer->pdev->file, IOUSB(USB_FS_CLEAR_STALL_SYNC), &temp)) { return (LIBUSB20_ERROR_INVALID_PARAM); } return (0); /* success */ @@ -885,7 +889,7 @@ ugen20_tr_submit(struct libusb20_transfer *xfer) temp.ep_index = xfer->trIndex; - if (ioctl(xfer->pdev->file, USB_FS_START, &temp)) { + if (ioctl(xfer->pdev->file, IOUSB(USB_FS_START), &temp)) { /* ignore any errors - should never happen */ } return; /* success */ @@ -900,7 +904,7 @@ ugen20_tr_cancel_async(struct libusb20_transfer *xfer) temp.ep_index = xfer->trIndex; - if (ioctl(xfer->pdev->file, USB_FS_STOP, &temp)) { + if (ioctl(xfer->pdev->file, IOUSB(USB_FS_STOP), &temp)) { /* ignore any errors - should never happen */ } return; @@ -939,7 +943,7 @@ ugen20_dev_get_iface_desc(struct libusb20_device *pdev, ugd.ugd_maxlen = len; ugd.ugd_iface_index = iface_index; - if (ioctl(pdev->file, USB_GET_IFACE_DRIVER, &ugd)) { + if (ioctl(pdev->file, IOUSB(USB_GET_IFACE_DRIVER), &ugd)) { return (LIBUSB20_ERROR_INVALID_PARAM); } return (0); @@ -949,7 +953,7 @@ static int ugen20_dev_get_info(struct libusb20_device *pdev, struct usb_device_info *pinfo) { - if (ioctl(pdev->file, USB_GET_DEVICEINFO, pinfo)) { + if (ioctl(pdev->file, IOUSB(USB_GET_DEVICEINFO), pinfo)) { return (LIBUSB20_ERROR_INVALID_PARAM); } return (0); @@ -966,7 +970,7 @@ ugen20_root_get_dev_quirk(struct libusb20_backend *pbe, q.index = quirk_index; - error = ugen20_be_ioctl(USB_DEV_QUIRK_GET, &q); + error = ugen20_be_ioctl(IOUSB(USB_DEV_QUIRK_GET), &q); if (error) { if (errno == EINVAL) { @@ -993,7 +997,7 @@ ugen20_root_get_quirk_name(struct libusb20_backend *pbe, uint16_t quirk_index, q.index = quirk_index; - error = ugen20_be_ioctl(USB_QUIRK_NAME_GET, &q); + error = ugen20_be_ioctl(IOUSB(USB_QUIRK_NAME_GET), &q); if (error) { if (errno == EINVAL) { @@ -1020,7 +1024,7 @@ ugen20_root_add_dev_quirk(struct libusb20_backend *pbe, q.bcdDeviceHigh = pq->bcdDeviceHigh; strlcpy(q.quirkname, pq->quirkname, sizeof(q.quirkname)); - error = ugen20_be_ioctl(USB_DEV_QUIRK_ADD, &q); + error = ugen20_be_ioctl(IOUSB(USB_DEV_QUIRK_ADD), &q); if (error) { if (errno == ENOMEM) { return (LIBUSB20_ERROR_NO_MEM); @@ -1044,7 +1048,7 @@ ugen20_root_remove_dev_quirk(struct libusb20_backend *pbe, q.bcdDeviceHigh = pq->bcdDeviceHigh; strlcpy(q.quirkname, pq->quirkname, sizeof(q.quirkname)); - error = ugen20_be_ioctl(USB_DEV_QUIRK_REMOVE, &q); + error = ugen20_be_ioctl(IOUSB(USB_DEV_QUIRK_REMOVE), &q); if (error) { if (errno == EINVAL) { return (LIBUSB20_ERROR_NOT_FOUND); @@ -1056,11 +1060,11 @@ ugen20_root_remove_dev_quirk(struct libusb20_backend *pbe, static int ugen20_root_set_template(struct libusb20_backend *pbe, int temp) { - return (ugen20_be_ioctl(USB_SET_TEMPLATE, &temp)); + return (ugen20_be_ioctl(IOUSB(USB_SET_TEMPLATE), &temp)); } static int ugen20_root_get_template(struct libusb20_backend *pbe, int *ptemp) { - return (ugen20_be_ioctl(USB_GET_TEMPLATE, ptemp)); + return (ugen20_be_ioctl(IOUSB(USB_GET_TEMPLATE), ptemp)); } diff --git a/lib/libusb/libusb_global_linux.h b/lib/libusb/libusb_global_linux.h index cbdd2c6b818d..13d344a92ea0 100644 --- a/lib/libusb/libusb_global_linux.h +++ b/lib/libusb/libusb_global_linux.h @@ -29,7 +29,9 @@ #define _XOPEN_SOURCE #define _BSD_SOURCE +#ifdef __linux__ #define _POSIX_SOURCE +#endif #define _POSIX_C_SOURCE 200809 #include @@ -39,10 +41,13 @@ #include #include #include +#ifdef __linux__ #include +#endif #include #include #include +#include #include #include #include @@ -51,6 +56,10 @@ #include #include +#include + +#define IOUSB(a) FBSD_L##a + #ifndef __aligned #define __aligned(x) __attribute__((__aligned__(x))) #endif -- cgit v1.3 From 041d3f3f09b8cb01771ddbf2c2b9ed7bd95a519a Mon Sep 17 00:00:00 2001 From: Rui Paulo Date: Thu, 25 Jul 2013 03:54:08 +0000 Subject: Add pkgconf files for libusb. Reviewed by: hselasky --- etc/mtree/BSD.usr.dist | 2 ++ lib/libusb/Makefile | 8 ++++++++ lib/libusb/libusb-0.1.pc | 11 +++++++++++ lib/libusb/libusb-1.0.pc | 11 +++++++++++ lib/libusb/libusb-2.0.pc | 11 +++++++++++ 5 files changed, 43 insertions(+) create mode 100644 lib/libusb/libusb-0.1.pc create mode 100644 lib/libusb/libusb-1.0.pc create mode 100644 lib/libusb/libusb-2.0.pc (limited to 'lib/libusb') diff --git a/etc/mtree/BSD.usr.dist b/etc/mtree/BSD.usr.dist index 98e89b90bcf4..339ae550c55d 100644 --- a/etc/mtree/BSD.usr.dist +++ b/etc/mtree/BSD.usr.dist @@ -38,6 +38,8 @@ .. lint .. + pkgconfig + .. .. libexec bsdinstall diff --git a/lib/libusb/Makefile b/lib/libusb/Makefile index d0698e3c2ce5..99bdfc2b9fc9 100644 --- a/lib/libusb/Makefile +++ b/lib/libusb/Makefile @@ -38,6 +38,14 @@ SRCS+= libusb10_io.c CFLAGS+= -DCOMPAT_32BIT .endif +beforeinstall: + ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ + ${.CURDIR}/libusb-0.1.pc ${DESTDIR}${LIBDATADIR}/pkgconfig + ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ + ${.CURDIR}/libusb-1.0.pc ${DESTDIR}${LIBDATADIR}/pkgconfig + ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ + ${.CURDIR}/libusb-2.0.pc ${DESTDIR}${LIBDATADIR}/pkgconfig + # # Cross platform support # diff --git a/lib/libusb/libusb-0.1.pc b/lib/libusb/libusb-0.1.pc new file mode 100644 index 000000000000..afd7a9960798 --- /dev/null +++ b/lib/libusb/libusb-0.1.pc @@ -0,0 +1,11 @@ +# $FreeBSD$ +prefix=/usr +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: libusb-0.1 +Description: Library that abstracts ways to access USB devices (v0.1) +Version: 0.1.0 +Libs: -L${libdir} -lusb +Cflags: -I${includedir} diff --git a/lib/libusb/libusb-1.0.pc b/lib/libusb/libusb-1.0.pc new file mode 100644 index 000000000000..bed98de3f99c --- /dev/null +++ b/lib/libusb/libusb-1.0.pc @@ -0,0 +1,11 @@ +# $FreeBSD$ +prefix=/usr +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: libusb-1.0 +Description: Library that abstracts ways to access USB devices (v1.0) +Version: 1.0.9 +Libs: -L${libdir} -lusb +Cflags: -I${includedir} diff --git a/lib/libusb/libusb-2.0.pc b/lib/libusb/libusb-2.0.pc new file mode 100644 index 000000000000..34eabb88ab17 --- /dev/null +++ b/lib/libusb/libusb-2.0.pc @@ -0,0 +1,11 @@ +# $FreeBSD$ +prefix=/usr +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: libusb-2.0 +Description: Library that abstracts ways to access USB devices (v2.0) +Version: 2.0.0 +Libs: -L${libdir} -lusb +Cflags: -I${includedir} -- cgit v1.3 From 5122043efe165f5cbb16f56da5c3d41138e81907 Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky Date: Thu, 5 Sep 2013 12:21:11 +0000 Subject: Correct two comments. --- lib/libusb/libusb20_ugen20.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/libusb') diff --git a/lib/libusb/libusb20_ugen20.c b/lib/libusb/libusb20_ugen20.c index 341bfb6d71ad..e40bc07e61e0 100644 --- a/lib/libusb/libusb20_ugen20.c +++ b/lib/libusb/libusb20_ugen20.c @@ -697,7 +697,7 @@ ugen20_detach_kernel_driver(struct libusb20_device *pdev, if (ioctl(pdev->file_ctrl, IOUSB(USB_IFACE_DRIVER_DETACH), &temp)) { return (LIBUSB20_ERROR_OTHER); } - return (0); /* kernel driver is active */ + return (0); /* kernel driver is detached */ } static int @@ -724,7 +724,7 @@ ugen20_do_request_sync(struct libusb20_device *pdev, /* get actual length */ *pactlen = req.ucr_actlen; } - return (0); /* kernel driver is active */ + return (0); /* request was successful */ } static int -- cgit v1.3