[Midnightbsd-cvs] src [10612] trunk/lib/libusb: sync with freebsd

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sat Jun 9 11:25:34 EDT 2018


Revision: 10612
          http://svnweb.midnightbsd.org/src/?rev=10612
Author:   laffer1
Date:     2018-06-09 11:25:34 -0400 (Sat, 09 Jun 2018)
Log Message:
-----------
sync with freebsd

Modified Paths:
--------------
    trunk/lib/libusb/Makefile
    trunk/lib/libusb/libusb.3
    trunk/lib/libusb/libusb.h
    trunk/lib/libusb/libusb01.c
    trunk/lib/libusb/libusb10.c
    trunk/lib/libusb/libusb10.h
    trunk/lib/libusb/libusb10_desc.c
    trunk/lib/libusb/libusb10_hotplug.c
    trunk/lib/libusb/libusb10_io.c
    trunk/lib/libusb/libusb20.3
    trunk/lib/libusb/libusb20.c
    trunk/lib/libusb/libusb20.h
    trunk/lib/libusb/libusb20_desc.c
    trunk/lib/libusb/libusb20_desc.h
    trunk/lib/libusb/libusb20_int.h
    trunk/lib/libusb/libusb20_ugen20.c
    trunk/lib/libusb/usb.h

Modified: trunk/lib/libusb/Makefile
===================================================================
--- trunk/lib/libusb/Makefile	2018-06-09 15:21:38 UTC (rev 10611)
+++ trunk/lib/libusb/Makefile	2018-06-09 15:25:34 UTC (rev 10612)
@@ -1,12 +1,12 @@
 # $MidnightBSD$
 #
-# $FreeBSD: stable/9/lib/libusb/Makefile 302276 2016-06-29 11:06:13Z hselasky $
+# $FreeBSD: stable/10/lib/libusb/Makefile 302275 2016-06-29 10:58:36Z hselasky $
 #
 # Makefile for the FreeBSD specific LibUSB 2.0
 #
 
 LIB=		usb
-SHLIB_MAJOR=	2
+SHLIB_MAJOR=	3
 SHLIB_MINOR=	0
 SRCS=		libusb20.c
 SRCS+=		libusb20_desc.c
@@ -16,11 +16,12 @@
 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
 
@@ -37,8 +38,34 @@
 
 .if defined(COMPAT_32BIT)
 CFLAGS+=	-DCOMPAT_32BIT
+.else
+FILES=		libusb-0.1.pc libusb-1.0.pc libusb-2.0.pc
+FILESDIR=	${LIBDATADIR}/pkgconfig
 .endif
 
+#
+# Cross platform support
+#
+# Examples:
+# make 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}\"
+CFLAGS+=	-DUSB_GLOBAL_INCLUDE_FILE=\"${LIBUSB_GLOBAL_INCLUDE_FILE}\"
+CFLAGS+=	-I ../../sys
+.endif
+
 .include <bsd.lib.mk>
 
 # LibUSB v1.0

Modified: trunk/lib/libusb/libusb.3
===================================================================
--- trunk/lib/libusb/libusb.3	2018-06-09 15:21:38 UTC (rev 10611)
+++ trunk/lib/libusb/libusb.3	2018-06-09 15:25:34 UTC (rev 10612)
@@ -25,7 +25,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $FreeBSD: stable/9/lib/libusb/libusb.3 302276 2016-06-29 11:06:13Z hselasky $
+.\" $FreeBSD: stable/10/lib/libusb/libusb.3 302275 2016-06-29 10:58:36Z hselasky $
 .\"
 .Dd June 23, 2016
 .Dt LIBUSB 3

Modified: trunk/lib/libusb/libusb.h
===================================================================
--- trunk/lib/libusb/libusb.h	2018-06-09 15:21:38 UTC (rev 10611)
+++ trunk/lib/libusb/libusb.h	2018-06-09 15:25:34 UTC (rev 10612)
@@ -1,5 +1,5 @@
 /* $MidnightBSD$ */
-/* $FreeBSD: stable/9/lib/libusb/libusb.h 302276 2016-06-29 11:06:13Z hselasky $ */
+/* $FreeBSD: stable/10/lib/libusb/libusb.h 302275 2016-06-29 10:58:36Z hselasky $ */
 /*-
  * Copyright (c) 2009 Sylvestre Gallon. All rights reserved.
  *
@@ -28,8 +28,11 @@
 #ifndef __LIBUSB_H__
 #define	__LIBUSB_H__
 
+#ifndef LIBUSB_GLOBAL_INCLUDE_FILE
+#include <stdint.h>
 #include <sys/time.h>
 #include <sys/types.h>
+#endif
 
 #define	LIBUSB_API_VERSION 0x01000102
 
@@ -215,6 +218,19 @@
 	LIBUSB_TRANSFER_FREE_TRANSFER = 1 << 2,
 };
 
+enum libusb_log_level {
+       LIBUSB_LOG_LEVEL_NONE = 0,
+       LIBUSB_LOG_LEVEL_ERROR,
+       LIBUSB_LOG_LEVEL_WARNING,
+       LIBUSB_LOG_LEVEL_INFO,
+       LIBUSB_LOG_LEVEL_DEBUG
+};
+
+/* XXX */
+/* libusb_set_debug should take parameters from libusb_log_level
+ * above according to
+ *   http://libusb.sourceforge.net/api-1.0/group__lib.html
+ */
 enum libusb_debug_level {
 	LIBUSB_DEBUG_NO=0,
 	LIBUSB_DEBUG_FUNCTION=1,
@@ -411,7 +427,7 @@
 typedef struct libusb_transfer {
 	libusb_device_handle *dev_handle;
 	uint8_t	flags;
-	uint32_t endpoint;
+	uint8_t endpoint;
 	uint8_t type;
 	uint32_t timeout;
 	enum libusb_transfer_status status;
@@ -420,7 +436,6 @@
 	libusb_transfer_cb_fn callback;
 	void   *user_data;
 	uint8_t *buffer;
-	void *os_priv;
 	int	num_iso_packets;
 	struct libusb_iso_packet_descriptor iso_packet_desc[0];
 }	libusb_transfer __aligned(sizeof(void *));

Modified: trunk/lib/libusb/libusb01.c
===================================================================
--- trunk/lib/libusb/libusb01.c	2018-06-09 15:21:38 UTC (rev 10611)
+++ trunk/lib/libusb/libusb01.c	2018-06-09 15:25:34 UTC (rev 10612)
@@ -1,5 +1,5 @@
 /* $MidnightBSD$ */
-/* $FreeBSD: stable/9/lib/libusb/libusb01.c 264637 2014-04-18 07:42:47Z hselasky $ */
+/* $FreeBSD: stable/10/lib/libusb/libusb01.c 264641 2014-04-18 07:50:25Z hselasky $ */
 /*-
  * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.
  *
@@ -29,11 +29,16 @@
  * This file contains the emulation layer for LibUSB v0.1 from sourceforge.
  */
 
-#include <sys/queue.h>
-
+#ifdef LIBUSB_GLOBAL_INCLUDE_FILE
+#include LIBUSB_GLOBAL_INCLUDE_FILE
+#else
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <sys/queue.h>
+#endif
 
 #include "libusb20.h"
 #include "libusb20_desc.h"

Modified: trunk/lib/libusb/libusb10.c
===================================================================
--- trunk/lib/libusb/libusb10.c	2018-06-09 15:21:38 UTC (rev 10611)
+++ trunk/lib/libusb/libusb10.c	2018-06-09 15:25:34 UTC (rev 10612)
@@ -1,5 +1,5 @@
 /* $MidnightBSD$ */
-/* $FreeBSD: stable/9/lib/libusb/libusb10.c 302276 2016-06-29 11:06:13Z hselasky $ */
+/* $FreeBSD: stable/10/lib/libusb/libusb10.c 302275 2016-06-29 10:58:36Z hselasky $ */
 /*-
  * Copyright (c) 2009 Sylvestre Gallon. All rights reserved.
  * Copyright (c) 2009 Hans Petter Selasky. All rights reserved.
@@ -26,10 +26,9 @@
  * SUCH DAMAGE.
  */
 
-#include <sys/fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/queue.h>
-
+#ifdef LIBUSB_GLOBAL_INCLUDE_FILE
+#include LIBUSB_GLOBAL_INCLUDE_FILE
+#else
 #include <assert.h>
 #include <errno.h>
 #include <poll.h>
@@ -36,7 +35,14 @@
 #include <pthread.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <unistd.h>
+#include <time.h>
+#include <sys/fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/queue.h>
+#include <sys/endian.h>
+#endif
 
 #define	libusb_device_handle libusb20_device
 
@@ -70,7 +76,7 @@
 	.micro = 0,
 	.nano = 2016,
 	.rc = "",
-	.describe = "http://www.midnightbsd.org"
+	.describe = "http://www.freebsd.org"
 };
 
 const struct libusb_version *
@@ -1405,7 +1411,8 @@
 	maxframe = libusb10_get_maxframe(pdev, uxfer);
 
 	/* make sure the transfer is opened */
-	err = libusb20_tr_open(pxfer0, buffsize, maxframe, endpoint);
+	err = libusb20_tr_open_stream(pxfer0, buffsize, maxframe,
+	    endpoint, sxfer->stream_id);
 	if (err && (err != LIBUSB20_ERROR_BUSY)) {
 		goto failure;
 	}
@@ -1417,7 +1424,7 @@
 
 	/* make sure our event loop spins the done handler */
 	dummy = 0;
-	write(dev->ctx->ctrl_pipe[1], &dummy, sizeof(dummy));
+	err = write(dev->ctx->ctrl_pipe[1], &dummy, sizeof(dummy));
 }
 
 /* The following function must be called unlocked */
@@ -1429,7 +1436,7 @@
 	struct libusb20_transfer *pxfer1;
 	struct libusb_super_transfer *sxfer;
 	struct libusb_device *dev;
-	uint32_t endpoint;
+	uint8_t endpoint;
 	int err;
 
 	if (uxfer == NULL)
@@ -1440,9 +1447,6 @@
 
 	endpoint = uxfer->endpoint;
 
-	if (endpoint > 255)
-		return (LIBUSB_ERROR_INVALID_PARAM);
-
 	dev = libusb_get_device(uxfer->dev_handle);
 
 	DPRINTF(dev->ctx, LIBUSB_DEBUG_FUNCTION, "libusb_submit_transfer enter");
@@ -1492,7 +1496,7 @@
 	struct libusb20_transfer *pxfer1;
 	struct libusb_super_transfer *sxfer;
 	struct libusb_device *dev;
-	uint32_t endpoint;
+	uint8_t endpoint;
 	int retval;
 
 	if (uxfer == NULL)
@@ -1504,9 +1508,6 @@
 
 	endpoint = uxfer->endpoint;
 
-	if (endpoint > 255)
-		return (LIBUSB_ERROR_INVALID_PARAM);
-
 	dev = libusb_get_device(uxfer->dev_handle);
 
 	DPRINTF(dev->ctx, LIBUSB_DEBUG_FUNCTION, "libusb_cancel_transfer enter");

Modified: trunk/lib/libusb/libusb10.h
===================================================================
--- trunk/lib/libusb/libusb10.h	2018-06-09 15:21:38 UTC (rev 10611)
+++ trunk/lib/libusb/libusb10.h	2018-06-09 15:25:34 UTC (rev 10612)
@@ -1,5 +1,5 @@
 /* $MidnightBSD$ */
-/* $FreeBSD: stable/9/lib/libusb/libusb10.h 302276 2016-06-29 11:06:13Z hselasky $ */
+/* $FreeBSD: stable/10/lib/libusb/libusb10.h 302275 2016-06-29 10:58:36Z hselasky $ */
 /*-
  * Copyright (c) 2009 Sylvestre Gallon. All rights reserved.
  *
@@ -28,7 +28,9 @@
 #ifndef __LIBUSB10_H__
 #define	__LIBUSB10_H__
 
+#ifndef LIBUSB_GLOBAL_INCLUDE_FILE
 #include <sys/queue.h>
+#endif
 
 #define	GET_CONTEXT(ctx) (((ctx) == NULL) ? usbi_default_context : (ctx))
 #define	UNEXPORTED __attribute__((__visibility__("hidden")))

Modified: trunk/lib/libusb/libusb10_desc.c
===================================================================
--- trunk/lib/libusb/libusb10_desc.c	2018-06-09 15:21:38 UTC (rev 10611)
+++ trunk/lib/libusb/libusb10_desc.c	2018-06-09 15:25:34 UTC (rev 10612)
@@ -1,5 +1,5 @@
 /* $MidnightBSD$ */
-/* $FreeBSD: stable/9/lib/libusb/libusb10_desc.c 302276 2016-06-29 11:06:13Z hselasky $ */
+/* $FreeBSD: stable/10/lib/libusb/libusb10_desc.c 302275 2016-06-29 10:58:36Z hselasky $ */
 /*-
  * Copyright (c) 2009 Sylvestre Gallon. All rights reserved.
  *
@@ -25,10 +25,15 @@
  * SUCH DAMAGE.
  */
 
-#include <sys/queue.h>
-
+#ifdef LIBUSB_GLOBAL_INCLUDE_FILE
+#include LIBUSB_GLOBAL_INCLUDE_FILE
+#else
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <sys/queue.h>
+#endif
 
 #define	libusb_device_handle libusb20_device
 

Modified: trunk/lib/libusb/libusb10_hotplug.c
===================================================================
--- trunk/lib/libusb/libusb10_hotplug.c	2018-06-09 15:21:38 UTC (rev 10611)
+++ trunk/lib/libusb/libusb10_hotplug.c	2018-06-09 15:25:34 UTC (rev 10612)
@@ -1,5 +1,5 @@
 /* $MidnightBSD$ */
-/* $FreeBSD: stable/9/lib/libusb/libusb10_hotplug.c 302276 2016-06-29 11:06:13Z hselasky $ */
+/* $FreeBSD: stable/10/lib/libusb/libusb10_hotplug.c 302275 2016-06-29 10:58:36Z hselasky $ */
 /*-
  * Copyright (c) 2016 Hans Petter Selasky. All rights reserved.
  *

Modified: trunk/lib/libusb/libusb10_io.c
===================================================================
--- trunk/lib/libusb/libusb10_io.c	2018-06-09 15:21:38 UTC (rev 10611)
+++ trunk/lib/libusb/libusb10_io.c	2018-06-09 15:25:34 UTC (rev 10612)
@@ -1,5 +1,5 @@
 /* $MidnightBSD$ */
-/* $FreeBSD: stable/9/lib/libusb/libusb10_io.c 302276 2016-06-29 11:06:13Z hselasky $ */
+/* $FreeBSD: stable/10/lib/libusb/libusb10_io.c 302275 2016-06-29 10:58:36Z hselasky $ */
 /*-
  * Copyright (c) 2009 Sylvestre Gallon. All rights reserved.
  *
@@ -25,15 +25,20 @@
  * SUCH DAMAGE.
  */
 
-#include <sys/queue.h>
-
+#ifdef LIBUSB_GLOBAL_INCLUDE_FILE
+#include LIBUSB_GLOBAL_INCLUDE_FILE
+#else
 #include <errno.h>
 #include <poll.h>
 #include <pthread.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <time.h>
 #include <unistd.h>
+#include <sys/queue.h>
+#include <sys/endian.h>
+#endif
 
 #define	libusb_device_handle libusb20_device
 
@@ -767,8 +772,9 @@
 libusb_alloc_streams(libusb_device_handle *dev, uint32_t num_streams,
     unsigned char *endpoints, int num_endpoints)
 {
-
-	return (LIBUSB_ERROR_NOT_SUPPORTED);
+	if (num_streams > 1)
+		return (LIBUSB_ERROR_INVALID_PARAM);
+	return (0);
 }
 
 int

Modified: trunk/lib/libusb/libusb20.3
===================================================================
--- trunk/lib/libusb/libusb20.3	2018-06-09 15:21:38 UTC (rev 10611)
+++ trunk/lib/libusb/libusb20.3	2018-06-09 15:25:34 UTC (rev 10612)
@@ -25,7 +25,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $FreeBSD$
+.\" $FreeBSD: stable/10/lib/libusb/libusb20.3 250582 2013-05-12 22:22:12Z joel $
 .\"
 .Dd May 3, 2013
 .Dt LIBUSB20 3
@@ -49,6 +49,7 @@
 .Fn libusb20_tr_close "struct libusb20_transfer *xfer"
 .Ft int
 .Fn libusb20_tr_open "struct libusb20_transfer *xfer" "uint32_t max_buf_size" "uint32_t max_frame_count" "uint8_t ep_no"
+.Fn libusb20_tr_open_stream "struct libusb20_transfer *xfer" "uint32_t max_buf_size" "uint32_t max_frame_count" "uint8_t ep_no" "uint16_t stream_id"
 .Ft struct libusb20_transfer*
 .Fn libusb20_tr_get_pointer "struct libusb20_device *pdev"  "uint16_t tr_index"
 .Ft uint16_t
@@ -289,6 +290,16 @@
 .
 .Pp
 .
+.Fn libusb20_tr_open_stream
+is identical to
+.Fn libusb20_tr_open
+except that a stream ID can be specified for BULK endpoints having
+such a feature.
+.Fn libusb20_tr_open
+can be used to open stream ID zero.
+.
+.Pp
+.
 .Fn libusb20_tr_get_pointer
 will return a pointer to the allocated USB transfer according to the
 .Fa pdev
@@ -406,7 +417,7 @@
 .
 .Fn libusb20_tr_set_flags
 is used to set various USB flags for the given USB transfer.
-.Bl -tag
+.Bl -tag -width "LIBUSB20_TRANSFER_SINGLE_SHORT_NOT_OK"
 .It LIBUSB20_TRANSFER_SINGLE_SHORT_NOT_OK
 Report a short frame as error.
 .It LIBUSB20_TRANSFER_MULTI_SHORT_NOT_OK
@@ -728,7 +739,7 @@
 sets the power mode of the USB device.
 .
 Valid power modes:
-.Bl -tag
+.Bl -tag -width "LIBUSB20_POWER_OFF"
 .It LIBUSB20_POWER_OFF
 .It LIBUSB20_POWER_ON
 .It LIBUSB20_POWER_SAVE
@@ -735,6 +746,7 @@
 .It LIBUSB20_POWER_SUSPEND
 .It LIBUSB20_POWER_RESUME
 .El
+.Pp
 .
 This function returns zero on success else a LIBUSB20_ERROR value is
 returned.
@@ -818,7 +830,7 @@
 returns the current operation mode of the USB entity.
 .
 Valid return values are:
-.Bl -tag
+.Bl -tag -width "LIBUSB20_MODE_DEVICE"
 .It LIBUSB20_MODE_HOST
 .It LIBUSB20_MODE_DEVICE
 .El
@@ -828,7 +840,7 @@
 .Fn libusb20_dev_get_speed
 returns the current speed of the given USB device.
 .
-.Bl -tag
+.Bl -tag -width "LIBUSB20_SPEED_VARIABLE"
 .It LIBUSB20_SPEED_UNKNOWN
 .It LIBUSB20_SPEED_LOW
 .It LIBUSB20_SPEED_FULL
@@ -1038,9 +1050,9 @@
 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 ,

Modified: trunk/lib/libusb/libusb20.c
===================================================================
--- trunk/lib/libusb/libusb20.c	2018-06-09 15:21:38 UTC (rev 10611)
+++ trunk/lib/libusb/libusb20.c	2018-06-09 15:25:34 UTC (rev 10612)
@@ -1,5 +1,5 @@
 /* $MidnightBSD$ */
-/* $FreeBSD: stable/9/lib/libusb/libusb20.c 305642 2016-09-09 06:31:25Z hselasky $ */
+/* $FreeBSD: stable/10/lib/libusb/libusb20.c 305641 2016-09-09 06:27:25Z hselasky $ */
 /*-
  * Copyright (c) 2008-2009 Hans Petter Selasky. All rights reserved.
  *
@@ -25,13 +25,17 @@
  * SUCH DAMAGE.
  */
 
-#include <sys/queue.h>
-
+#ifdef LIBUSB_GLOBAL_INCLUDE_FILE
+#include LIBUSB_GLOBAL_INCLUDE_FILE
+#else
 #include <ctype.h>
 #include <poll.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <time.h>
+#include <sys/queue.h>
+#endif
 
 #include "libusb20.h"
 #include "libusb20_desc.h"
@@ -158,6 +162,13 @@
 libusb20_tr_open(struct libusb20_transfer *xfer, uint32_t MaxBufSize,
     uint32_t MaxFrameCount, uint8_t ep_no)
 {
+	return (libusb20_tr_open_stream(xfer, MaxBufSize, MaxFrameCount, ep_no, 0));
+}
+
+int
+libusb20_tr_open_stream(struct libusb20_transfer *xfer, uint32_t MaxBufSize,
+    uint32_t MaxFrameCount, uint8_t ep_no, uint16_t stream_id)
+{
 	uint32_t size;
 	uint8_t pre_scale;
 	int error;
@@ -198,10 +209,10 @@
 
 	if (pre_scale) {
 		error = xfer->pdev->methods->tr_open(xfer, MaxBufSize,
-		    MaxFrameCount / 8, ep_no, 1);
+		    MaxFrameCount / 8, ep_no, stream_id, 1);
 	} else {
 		error = xfer->pdev->methods->tr_open(xfer, MaxBufSize,
-		    MaxFrameCount, ep_no, 0);
+		    MaxFrameCount, ep_no, stream_id, 0);
 	}
 
 	if (error) {
@@ -1209,27 +1220,13 @@
 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 *
@@ -1237,10 +1234,12 @@
 {
 	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);

Modified: trunk/lib/libusb/libusb20.h
===================================================================
--- trunk/lib/libusb/libusb20.h	2018-06-09 15:21:38 UTC (rev 10611)
+++ trunk/lib/libusb/libusb20.h	2018-06-09 15:25:34 UTC (rev 10612)
@@ -1,5 +1,5 @@
 /* $MidnightBSD$ */
-/* $FreeBSD$ */
+/* $FreeBSD: stable/10/lib/libusb/libusb20.h 250201 2013-05-03 07:44:58Z hselasky $ */
 /*-
  * Copyright (c) 2008-2009 Hans Petter Selasky. All rights reserved.
  * Copyright (c) 2007-2008 Daniel Drake.  All rights reserved.
@@ -30,13 +30,9 @@
 #ifndef _LIBUSB20_H_
 #define	_LIBUSB20_H_
 
-#include <sys/endian.h>
-#include <sys/time.h>
-#include <sys/types.h>
-
+#ifndef LIBUSB_GLOBAL_INCLUDE_FILE
 #include <stdint.h>
-#include <string.h>
-#include <time.h>
+#endif
 
 #ifdef __cplusplus
 extern	"C" {
@@ -203,6 +199,7 @@
 /* USB transfer operations */
 int	libusb20_tr_close(struct libusb20_transfer *xfer);
 int	libusb20_tr_open(struct libusb20_transfer *xfer, uint32_t max_buf_size, uint32_t max_frame_count, uint8_t ep_no);
+int	libusb20_tr_open_stream(struct libusb20_transfer *xfer, uint32_t max_buf_size, uint32_t max_frame_count, uint8_t ep_no, uint16_t stream_id);
 struct libusb20_transfer *libusb20_tr_get_pointer(struct libusb20_device *pdev, uint16_t tr_index);
 uint16_t libusb20_tr_get_time_complete(struct libusb20_transfer *xfer);
 uint32_t libusb20_tr_get_actual_frames(struct libusb20_transfer *xfer);

Modified: trunk/lib/libusb/libusb20_desc.c
===================================================================
--- trunk/lib/libusb/libusb20_desc.c	2018-06-09 15:21:38 UTC (rev 10611)
+++ trunk/lib/libusb/libusb20_desc.c	2018-06-09 15:25:34 UTC (rev 10612)
@@ -1,5 +1,5 @@
 /* $MidnightBSD$ */
-/* $FreeBSD: stable/9/lib/libusb/libusb20_desc.c 286334 2015-08-05 18:55:26Z pfg $ */
+/* $FreeBSD: stable/10/lib/libusb/libusb20_desc.c 286333 2015-08-05 18:52:40Z pfg $ */
 /*-
  * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.
  *
@@ -25,11 +25,15 @@
  * SUCH DAMAGE.
  */
 
-#include <sys/queue.h>
-
+#ifdef LIBUSB_GLOBAL_INCLUDE_FILE
+#include LIBUSB_GLOBAL_INCLUDE_FILE
+#else
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <time.h>
+#include <sys/queue.h>
+#endif
 
 #include "libusb20.h"
 #include "libusb20_desc.h"

Modified: trunk/lib/libusb/libusb20_desc.h
===================================================================
--- trunk/lib/libusb/libusb20_desc.h	2018-06-09 15:21:38 UTC (rev 10611)
+++ trunk/lib/libusb/libusb20_desc.h	2018-06-09 15:25:34 UTC (rev 10612)
@@ -1,5 +1,5 @@
 /* $MidnightBSD$ */
-/* $FreeBSD: stable/9/lib/libusb/libusb20_desc.h 277848 2015-01-28 19:53:00Z hselasky $ */
+/* $FreeBSD: stable/10/lib/libusb/libusb20_desc.h 277847 2015-01-28 19:49:53Z hselasky $ */
 /*-
  * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.
  * Copyright (c) 2007-2008 Daniel Drake.  All rights reserved.
@@ -46,6 +46,10 @@
 #ifndef _LIBUSB20_DESC_H_
 #define	_LIBUSB20_DESC_H_
 
+#ifndef LIBUSB_GLOBAL_INCLUDE_FILE
+#include <stdint.h>
+#endif
+
 #ifdef __cplusplus
 extern	"C" {
 #endif

Modified: trunk/lib/libusb/libusb20_int.h
===================================================================
--- trunk/lib/libusb/libusb20_int.h	2018-06-09 15:21:38 UTC (rev 10611)
+++ trunk/lib/libusb/libusb20_int.h	2018-06-09 15:25:34 UTC (rev 10612)
@@ -1,5 +1,5 @@
 /* $MidnightBSD$ */
-/* $FreeBSD: stable/9/lib/libusb/libusb20_int.h 302276 2016-06-29 11:06:13Z hselasky $ */
+/* $FreeBSD: stable/10/lib/libusb/libusb20_int.h 302275 2016-06-29 10:58:36Z hselasky $ */
 /*-
  * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.
  *
@@ -113,7 +113,7 @@
 typedef int (libusb20_check_connected_t)(struct libusb20_device *pdev);
 
 /* USB transfer specific */
-typedef int (libusb20_tr_open_t)(struct libusb20_transfer *xfer, uint32_t MaxBufSize, uint32_t MaxFrameCount, uint8_t ep_no, uint8_t pre_scale);
+typedef int (libusb20_tr_open_t)(struct libusb20_transfer *xfer, uint32_t MaxBufSize, uint32_t MaxFrameCount, uint8_t ep_no, uint16_t stream_id, uint8_t pre_scale);
 typedef int (libusb20_tr_close_t)(struct libusb20_transfer *xfer);
 typedef int (libusb20_tr_clear_stall_sync_t)(struct libusb20_transfer *xfer);
 typedef void (libusb20_tr_submit_t)(struct libusb20_transfer *xfer);

Modified: trunk/lib/libusb/libusb20_ugen20.c
===================================================================
--- trunk/lib/libusb/libusb20_ugen20.c	2018-06-09 15:21:38 UTC (rev 10611)
+++ trunk/lib/libusb/libusb20_ugen20.c	2018-06-09 15:25:34 UTC (rev 10612)
@@ -1,5 +1,5 @@
 /* $MidnightBSD$ */
-/* $FreeBSD: stable/9/lib/libusb/libusb20_ugen20.c 310282 2016-12-19 18:31:22Z trasz $ */
+/* $FreeBSD: stable/10/lib/libusb/libusb20_ugen20.c 310280 2016-12-19 18:26:26Z trasz $ */
 /*-
  * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.
  *
@@ -25,9 +25,9 @@
  * SUCH DAMAGE.
  */
 
-#include <sys/queue.h>
-#include <sys/types.h>
-
+#ifdef LIBUSB_GLOBAL_INCLUDE_FILE
+#include LIBUSB_GLOBAL_INCLUDE_FILE
+#else
 #include <errno.h>
 #include <fcntl.h>
 #include <stdio.h>
@@ -34,14 +34,22 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <time.h>
+#include <sys/queue.h>
+#include <sys/types.h>
+#endif
 
+#include <dev/usb/usb.h>
+#include <dev/usb/usbdi.h>
+#include <dev/usb/usb_ioctl.h>
+
 #include "libusb20.h"
 #include "libusb20_desc.h"
 #include "libusb20_int.h"
 
-#include <dev/usb/usb.h>
-#include <dev/usb/usbdi.h>
-#include <dev/usb/usb_ioctl.h>
+#ifndef	IOUSB
+#define IOUSB(a) a
+#endif
 
 static libusb20_init_backend_t ugen20_init_backend;
 static libusb20_open_device_t ugen20_open_device;
@@ -142,7 +150,7 @@
 	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;
 	}
@@ -149,7 +157,7 @@
 	/* 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;
 	}
@@ -164,7 +172,7 @@
 		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;
 	}
@@ -238,7 +246,7 @@
 		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;
@@ -310,7 +318,7 @@
 	/* 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 */
 		}
 	}
@@ -350,7 +358,7 @@
 	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;
 	}
@@ -384,7 +392,7 @@
 		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;
 	}
@@ -427,7 +435,7 @@
 
 	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);
@@ -465,7 +473,7 @@
 	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);
 	}
@@ -485,7 +493,7 @@
 	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);
@@ -504,7 +512,7 @@
 {
 	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;
@@ -520,7 +528,7 @@
 	/* 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));
@@ -540,7 +548,7 @@
 	/* 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));
@@ -554,7 +562,7 @@
 	/* 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));
@@ -566,7 +574,7 @@
 	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;
 	}
@@ -603,7 +611,7 @@
 	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);
@@ -614,7 +622,7 @@
 {
 	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) {
@@ -646,7 +654,7 @@
 {
 	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)
@@ -662,7 +670,7 @@
 {
 	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;
@@ -675,7 +683,7 @@
 {
 	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 */
@@ -687,10 +695,10 @@
 {
 	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 */
+	return (0);			/* kernel driver is detached */
 }
 
 static int
@@ -710,7 +718,7 @@
 	    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) {
@@ -717,7 +725,7 @@
 		/* get actual length */
 		*pactlen = req.ucr_actlen;
 	}
-	return (0);			/* kernel driver is active */
+	return (0);			/* request was successful */
 }
 
 static int
@@ -729,7 +737,7 @@
 
 	while (1) {
 
-		if (ioctl(pdev->file, USB_FS_COMPLETE, &temp)) {
+	  if (ioctl(pdev->file, IOUSB(USB_FS_COMPLETE), &temp)) {
 			if (errno == EBUSY) {
 				break;
 			} else {
@@ -772,9 +780,13 @@
 
 static int
 ugen20_tr_open(struct libusb20_transfer *xfer, uint32_t MaxBufSize,
-    uint32_t MaxFrameCount, uint8_t ep_no, uint8_t pre_scale)
+    uint32_t MaxFrameCount, uint8_t ep_no, uint16_t stream_id,
+    uint8_t pre_scale)
 {
-	struct usb_fs_open temp;
+	union {
+		struct usb_fs_open fs_open;
+		struct usb_fs_open_stream fs_open_stream;
+	} temp;
 	struct usb_fs_endpoint *fsep;
 
 	if (pre_scale)
@@ -785,20 +797,26 @@
 	fsep = xfer->pdev->privBeData;
 	fsep += xfer->trIndex;
 
-	temp.max_bufsize = MaxBufSize;
-	temp.max_frames = MaxFrameCount;
-	temp.ep_index = xfer->trIndex;
-	temp.ep_no = ep_no;
+	temp.fs_open.max_bufsize = MaxBufSize;
+	temp.fs_open.max_frames = MaxFrameCount;
+	temp.fs_open.ep_index = xfer->trIndex;
+	temp.fs_open.ep_no = ep_no;
 
-	if (ioctl(xfer->pdev->file, USB_FS_OPEN, &temp)) {
-		return (LIBUSB20_ERROR_INVALID_PARAM);
+	if (stream_id != 0) {
+		temp.fs_open_stream.stream_id = stream_id;
+
+		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, IOUSB(USB_FS_OPEN), &temp.fs_open))
+			return (LIBUSB20_ERROR_INVALID_PARAM);
 	}
 	/* maximums might have changed - update */
-	xfer->maxFrames = temp.max_frames;
+	xfer->maxFrames = temp.fs_open.max_frames;
 
 	/* "max_bufsize" should be multiple of "max_packet_length" */
-	xfer->maxTotalLength = temp.max_bufsize;
-	xfer->maxPacketLen = temp.max_packet_length;
+	xfer->maxTotalLength = temp.fs_open.max_bufsize;
+	xfer->maxPacketLen = temp.fs_open.max_packet_length;
 
 	/* setup buffer and length lists using zero copy */
 	fsep->ppBuffer = libusb20_pass_ptr(xfer->ppBuffer);
@@ -816,7 +834,7 @@
 
 	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 */
@@ -833,7 +851,7 @@
 
 	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 */
@@ -872,7 +890,7 @@
 
 	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 */
@@ -887,7 +905,7 @@
 
 	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;
@@ -926,7 +944,7 @@
 	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);
@@ -936,7 +954,7 @@
 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);
@@ -953,7 +971,7 @@
 
 	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) {
@@ -980,7 +998,7 @@
 
 	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) {
@@ -1007,7 +1025,7 @@
 	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);
@@ -1031,7 +1049,7 @@
 	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);
@@ -1043,11 +1061,11 @@
 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));
 }

Modified: trunk/lib/libusb/usb.h
===================================================================
--- trunk/lib/libusb/usb.h	2018-06-09 15:21:38 UTC (rev 10611)
+++ trunk/lib/libusb/usb.h	2018-06-09 15:25:34 UTC (rev 10612)
@@ -1,5 +1,5 @@
 /* $MidnightBSD$ */
-/* $FreeBSD$ */
+/* $FreeBSD: stable/10/lib/libusb/usb.h 248236 2013-03-13 12:23:14Z hselasky $ */
 /*-
  * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.
  *
@@ -28,11 +28,12 @@
 #ifndef _LIBUSB20_COMPAT_01_H_
 #define	_LIBUSB20_COMPAT_01_H_
 
+#ifndef LIBUSB_GLOBAL_INCLUDE_FILE
+#include <stdint.h>
 #include <sys/param.h>
 #include <sys/endian.h>
+#endif
 
-#include <stdint.h>
-
 /* USB interface class codes */
 
 #define	USB_CLASS_PER_INTERFACE         0



More information about the Midnightbsd-cvs mailing list