Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Jun 2011 08:55:00 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r223419 - stable/8/lib/libusb
Message-ID:  <201106220855.p5M8t0LD040500@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Wed Jun 22 08:55:00 2011
New Revision: 223419
URL: http://svn.freebsd.org/changeset/base/223419

Log:
  MFC r210823, r211397, r210933, r219101, r213852, r213849 and r208020:
  - Add support for LibUSB in 32-bit compatibility mode.
  - Some manpage related fixes.

Modified:
  stable/8/lib/libusb/Makefile
  stable/8/lib/libusb/libusb.3
  stable/8/lib/libusb/libusb10_desc.c
  stable/8/lib/libusb/libusb10_io.c
  stable/8/lib/libusb/libusb20.3
  stable/8/lib/libusb/libusb20.c
  stable/8/lib/libusb/libusb20_int.h
  stable/8/lib/libusb/libusb20_ugen20.c
Directory Properties:
  stable/8/lib/libusb/   (props changed)
  stable/8/lib/libusb/usb.h   (props changed)

Modified: stable/8/lib/libusb/Makefile
==============================================================================
--- stable/8/lib/libusb/Makefile	Wed Jun 22 08:52:16 2011	(r223418)
+++ stable/8/lib/libusb/Makefile	Wed Jun 22 08:55:00 2011	(r223419)
@@ -28,5 +28,180 @@ SRCS+=		libusb10.c
 SRCS+=		libusb10_desc.c
 SRCS+=		libusb10_io.c
 
+.if defined(COMPAT_32BIT)
+CFLAGS+=	-DCOMPAT_32BIT
+.endif
+
 .include <bsd.lib.mk>
 
+# LibUSB v1.0
+MLINKS += libusb.3 libusb_init.3
+MLINKS += libusb.3 libusb_exit.3
+MLINKS += libusb.3 libusb_strerror.3
+MLINKS += libusb.3 libusb_set_debug.3
+MLINKS += libusb.3 libusb_get_device_list.3
+MLINKS += libusb.3 libusb_free_device_list.3
+MLINKS += libusb.3 libusb_get_bus_number.3
+MLINKS += libusb.3 libusb_get_device_address.3
+MLINKS += libusb.3 libusb_get_max_packet_size.3
+MLINKS += libusb.3 libusb_ref_device.3
+MLINKS += libusb.3 libusb_unref_device.3
+MLINKS += libusb.3 libusb_open.3
+MLINKS += libusb.3 libusb_open_device_with_vid_pid.3
+MLINKS += libusb.3 libusb_close.3
+MLINKS += libusb.3 libusb_get_device.3
+MLINKS += libusb.3 libusb_get_configuration.3
+MLINKS += libusb.3 libusb_set_configuration.3
+MLINKS += libusb.3 libusb_claim_interface.3
+MLINKS += libusb.3 libusb_release_interface.3
+MLINKS += libusb.3 libusb_set_interface_alt_setting.3
+MLINKS += libusb.3 libusb_clear_halt.3
+MLINKS += libusb.3 libusb_reset_device.3
+MLINKS += libusb.3 libusb_check_connected.3
+MLINKS += libusb.3 libusb_kernel_driver_active.3
+MLINKS += libusb.3 libusb_get_driver.3
+MLINKS += libusb.3 libusb_get_driver_np.3
+MLINKS += libusb.3 libusb_detach_kernel_driver.3
+MLINKS += libusb.3 libusb_detach_kernel_driver_np.3
+MLINKS += libusb.3 libusb_attach_kernel_driver.3
+MLINKS += libusb.3 libusb_get_device_descriptor.3
+MLINKS += libusb.3 libsub_get_active_config_descriptor.3
+MLINKS += libusb.3 libusb_get_config_descriptor.3
+MLINKS += libusb.3 libusb_get_config_descriptor_by_value.3
+MLINKS += libusb.3 libusb_free_config_descriptor.3
+MLINKS += libusb.3 libusb_get_string_descriptor_ascii.3
+MLINKS += libusb.3 libusb_alloc_transfer.3
+MLINKS += libusb.3 libusb_free_transfer.3
+MLINKS += libusb.3 libusb_submit_transfer.3
+MLINKS += libusb.3 libusb_cancel_transfer.3
+MLINKS += libusb.3 libusb_control_transfer.3
+MLINKS += libusb.3 libusb_bulk_transfer.3
+MLINKS += libusb.3 libusb_interrupt_transfer.3
+MLINKS += libusb.3 libusb_try_lock_events.3
+MLINKS += libusb.3 libusb_lock_events.3
+MLINKS += libusb.3 libusb_unlock_events.3
+MLINKS += libusb.3 libusb_event_handling_ok.3
+MLINKS += libusb.3 libusb_event_handler_active.3
+MLINKS += libusb.3 libusb_lock_event_waiters.3
+MLINKS += libusb.3 libusb_unlock_event_waiters.3
+MLINKS += libusb.3 libusb_wait_for_event.3
+MLINKS += libusb.3 libusb_handle_events_timeout.3
+MLINKS += libusb.3 libusb_handle_events.3
+MLINKS += libusb.3 libusb_handle_events_locked.3
+MLINKS += libusb.3 libusb_get_next_timeout.3
+MLINKS += libusb.3 libusb_set_pollfd_notifiers.3
+MLINKS += libusb.3 libusb_get_pollfds.3
+
+# LibUSB v0.1
+MLINKS += libusb.3 usb_open.3
+MLINKS += libusb.3 usb_close.3
+MLINKS += libusb.3 usb_get_string.3
+MLINKS += libusb.3 usb_get_string_simple.3
+MLINKS += libusb.3 usb_get_descriptor_by_endpoint.3
+MLINKS += libusb.3 usb_get_descriptor.3
+MLINKS += libusb.3 usb_parse_descriptor.3
+MLINKS += libusb.3 usb_parse_configuration.3
+MLINKS += libusb.3 usb_destroy_configuration.3
+MLINKS += libusb.3 usb_fetch_and_parse_descriptors.3
+MLINKS += libusb.3 usb_bulk_write.3
+MLINKS += libusb.3 usb_bulk_read.3
+MLINKS += libusb.3 usb_interrupt_write.3
+MLINKS += libusb.3 usb_interrupt_read.3
+MLINKS += libusb.3 usb_control_msg.3
+MLINKS += libusb.3 usb_set_configuration.3
+MLINKS += libusb.3 usb_claim_interface.3
+MLINKS += libusb.3 usb_release_interface.3
+MLINKS += libusb.3 usb_set_altinterface.3
+MLINKS += libusb.3 usb_resetep.3
+MLINKS += libusb.3 usb_clear_halt.3
+MLINKS += libusb.3 usb_reset.3
+MLINKS += libusb.3 usb_strerror.3
+MLINKS += libusb.3 usb_init.3
+MLINKS += libusb.3 usb_set_debug.3
+MLINKS += libusb.3 usb_find_busses.3
+MLINKS += libusb.3 usb_find_devices.3
+MLINKS += libusb.3 usb_device.3
+MLINKS += libusb.3 usb_get_busses.3
+MLINKS += libusb.3 usb_check_connected.3
+
+# LibUSB v2.0
+MLINKS += libusb20.3 libusb20_tr_close.3
+MLINKS += libusb20.3 libusb20_tr_open.3
+MLINKS += libusb20.3 libusb20_tr_get_pointer.3
+MLINKS += libusb20.3 libusb20_tr_get_time_complete.3
+MLINKS += libusb20.3 libusb20_tr_get_actual_frames.3
+MLINKS += libusb20.3 libusb20_tr_get_actual_length.3
+MLINKS += libusb20.3 libusb20_tr_get_max_frames.3
+MLINKS += libusb20.3 libusb20_tr_get_max_packet_length.3
+MLINKS += libusb20.3 libusb20_tr_get_max_total_length.3
+MLINKS += libusb20.3 libusb20_tr_get_status.3
+MLINKS += libusb20.3 libusb20_tr_pending.3
+MLINKS += libusb20.3 libusb20_tr_callback_wrapper.3
+MLINKS += libusb20.3 libusb20_tr_clear_stall_sync.3
+MLINKS += libusb20.3 libusb20_tr_drain.3
+MLINKS += libusb20.3 libusb20_tr_set_buffer.3
+MLINKS += libusb20.3 libusb20_tr_set_callback.3
+MLINKS += libusb20.3 libusb20_tr_set_flags.3
+MLINKS += libusb20.3 libusb20_tr_get_length.3
+MLINKS += libusb20.3 libusb20_tr_set_length.3
+MLINKS += libusb20.3 libusb20_tr_set_priv_sc0.3
+MLINKS += libusb20.3 libusb20_tr_set_priv_sc1.3
+MLINKS += libusb20.3 libusb20_tr_set_timeout.3
+MLINKS += libusb20.3 libusb20_tr_set_total_frames.3
+MLINKS += libusb20.3 libusb20_tr_setup_bulk.3
+MLINKS += libusb20.3 libusb20_tr_setup_control.3
+MLINKS += libusb20.3 libusb20_tr_setup_intr.3
+MLINKS += libusb20.3 libusb20_tr_setup_isoc.3
+MLINKS += libusb20.3 libusb20_tr_bulk_intr_sync.3
+MLINKS += libusb20.3 libusb20_tr_start.3
+MLINKS += libusb20.3 libusb20_tr_stop.3
+MLINKS += libusb20.3 libusb20_tr_submit.3
+MLINKS += libusb20.3 libusb20_tr_get_priv_sc0.3
+MLINKS += libusb20.3 libusb20_tr_get_priv_sc1.3
+MLINKS += libusb20.3 libusb20_dev_get_backend_name.3
+MLINKS += libusb20.3 libusb20_dev_get_info.3
+MLINKS += libusb20.3 libusb20_dev_get_iface_desc.3
+MLINKS += libusb20.3 libusb20_dev_get_desc.3
+MLINKS += libusb20.3 libusb20_dev_close.3
+MLINKS += libusb20.3 libusb20_dev_detach_kernel_driver.3
+MLINKS += libusb20.3 libusb20_dev_set_config_index.3
+MLINKS += libusb20.3 libusb20_dev_get_debug.3
+MLINKS += libusb20.3 libusb20_dev_get_fd.3
+MLINKS += libusb20.3 libusb20_dev_kernel_driver_active.3
+MLINKS += libusb20.3 libusb20_dev_open.3
+MLINKS += libusb20.3 libusb20_dev_process.3
+MLINKS += libusb20.3 libusb20_dev_request_sync.3
+MLINKS += libusb20.3 libusb20_dev_req_string_sync.3
+MLINKS += libusb20.3 libusb20_dev_req_string_simple_sync.3
+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_set_alt_index.3
+MLINKS += libusb20.3 libusb20_dev_get_device_desc.3
+MLINKS += libusb20.3 libusb20_dev_alloc_config.3
+MLINKS += libusb20.3 libusb20_dev_alloc.3
+MLINKS += libusb20.3 libusb20_dev_get_address.3
+MLINKS += libusb20.3 libusb20_dev_get_bus_number.3
+MLINKS += libusb20.3 libusb20_dev_get_mode.3
+MLINKS += libusb20.3 libusb20_dev_get_speed.3
+MLINKS += libusb20.3 libusb20_dev_get_config_index.3
+MLINKS += libusb20.3 libusb20_dev_free.3
+MLINKS += libusb20.3 libusb20_dev_set_debug.3
+MLINKS += libusb20.3 libusb20_dev_wait_process.3
+MLINKS += libusb20.3 libusb20_be_get_template.3
+MLINKS += libusb20.3 libusb20_be_set_template.3
+MLINKS += libusb20.3 libusb20_be_get_dev_quirk.3
+MLINKS += libusb20.3 libusb20_be_get_quirk_name.3
+MLINKS += libusb20.3 libusb20_be_add_dev_quirk.3
+MLINKS += libusb20.3 libusb20_be_remove_dev_quirk.3
+MLINKS += libusb20.3 libusb20_be_alloc_default.3
+MLINKS += libusb20.3 libusb20_be_device_foreach.3
+MLINKS += libusb20.3 libusb20_be_dequeue_device.3
+MLINKS += libusb20.3 libusb20_be_enqueue_device.3
+MLINKS += libusb20.3 libusb20_be_free.3
+MLINKS += libusb20.3 libusb20_me_get_1.3
+MLINKS += libusb20.3 libusb20_me_get_2.3
+MLINKS += libusb20.3 libusb20_me_encode.3
+MLINKS += libusb20.3 libusb20_me_decode.3
+MLINKS += libusb20.3 libusb20_desc_foreach.3

Modified: stable/8/lib/libusb/libusb.3
==============================================================================
--- stable/8/lib/libusb/libusb.3	Wed Jun 22 08:52:16 2011	(r223418)
+++ stable/8/lib/libusb/libusb.3	Wed Jun 22 08:55:00 2011	(r223419)
@@ -153,7 +153,7 @@ disconnected and a LIBUSB_ERROR code on 
 .
 .Ft libusb_device_handle *
 .Fn libusb_open_device_with_vid_pid "libusb_context *ctx" "uint16_t vid" "uint16_t pid"
-Conveniance function to open a device with is 
+Convenience function to open a device with is 
 .Fa vid 
 and 
 .Fa pid.
@@ -209,7 +209,7 @@ been disconnected and a LIBUSB_ERROR cod
 .Fn libusb_release_interface "libusb_device_handle *devh" "int interface_number"
 This function release an interface. All the claimed interface must be released
 before closing a device. Returns 0 on success, LIBUSB_ERROR_NOT_FOUND if the 
-interafce was not claimed, LIBUSB_ERROR_NO_DEVICE if the device has been 
+interface was not claimed, LIBUSB_ERROR_NO_DEVICE if the device has been 
 disconnected and LIBUSB_ERROR on failure.
 .
 .Pp
@@ -383,7 +383,7 @@ LIBUSB_ERROR code on failure.
 Perform a USB control transfer. Returns the actual number of bytes
 transferred on success in the range from and including zero until and
 including
-.Xa wLength .
+.Fa wLength .
 On error a libusb error code is returned, for example
 LIBUSB_ERROR_TIMEOUT if the transfer timeout, LIBUSB_ERROR_PIPE if the
 control request was not supported, LIBUSB_ERROR_NO_DEVICE if the
@@ -393,7 +393,10 @@ The libusb error codes are always negati
 .Pp
 .Ft int
 .Fn libusb_bulk_transfer "struct libusb_device_handle *devh" "unsigned char endpoint" "unsigned char *data" "int length" "int *transferred" "unsigned int timeout"
-Perform an USB bulk transfer. Returns 0 on success, LIBUSB_ERROR_TIMEOUT 
+Perform an USB bulk transfer.
+A timeout value of zero means no timeout.
+The timeout value is given in milliseconds.
+Returns 0 on success, LIBUSB_ERROR_TIMEOUT 
 if the transfer timeout, LIBUSB_ERROR_PIPE if the control request was not 
 supported, LIBUSB_ERROR_OVERFLOW if the device offered more data, 
 LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and 
@@ -402,7 +405,10 @@ LIBUSB_ERROR code on other failure.
 .Pp
 .Ft int
 .Fn libusb_interrupt_transfer "struct libusb_device_handle *devh" "unsigned char endpoint" "unsigned char *data" "int length" "int *transferred" "unsigned int timeout"
-Perform an USB Interrupt transfer. Returns 0 on success, LIBUSB_ERROR_TIMEOUT 
+Perform an USB Interrupt transfer.
+A timeout value of zero means no timeout.
+The timeout value is given in milliseconds.
+Returns 0 on success, LIBUSB_ERROR_TIMEOUT 
 if the transfer timeout, LIBUSB_ERROR_PIPE if the control request was not 
 supported, LIBUSB_ERROR_OVERFLOW if the device offered more data, 
 LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and 

Modified: stable/8/lib/libusb/libusb10_desc.c
==============================================================================
--- stable/8/lib/libusb/libusb10_desc.c	Wed Jun 22 08:52:16 2011	(r223418)
+++ stable/8/lib/libusb/libusb10_desc.c	Wed Jun 22 08:55:00 2011	(r223419)
@@ -26,11 +26,11 @@
 
 #include <sys/queue.h>
 
-#define	libusb_device_handle libusb20_device
-
 #include <stdio.h>
 #include <stdlib.h>
 
+#define	libusb_device_handle libusb20_device
+
 #include "libusb20.h"
 #include "libusb20_desc.h"
 #include "libusb20_int.h"

Modified: stable/8/lib/libusb/libusb10_io.c
==============================================================================
--- stable/8/lib/libusb/libusb10_io.c	Wed Jun 22 08:52:16 2011	(r223418)
+++ stable/8/lib/libusb/libusb10_io.c	Wed Jun 22 08:55:00 2011	(r223419)
@@ -141,7 +141,7 @@ libusb10_handle_events_sub(struct libusb
 		err = LIBUSB_ERROR_IO;
 
 	if (err < 1) {
-		for (i = 0; i != nfds; i++) {
+		for (i = 0; i != (int)nfds; i++) {
 			if (ppdev[i] != NULL) {
 				CTX_UNLOCK(ctx);
 				libusb_unref_device(libusb_get_device(ppdev[i]));
@@ -150,7 +150,7 @@ libusb10_handle_events_sub(struct libusb
 		}
 		goto do_done;
 	}
-	for (i = 0; i != nfds; i++) {
+	for (i = 0; i != (int)nfds; i++) {
 		if (ppdev[i] != NULL) {
 			dev = libusb_get_device(ppdev[i]);
 

Modified: stable/8/lib/libusb/libusb20.3
==============================================================================
--- stable/8/lib/libusb/libusb20.3	Wed Jun 22 08:52:16 2011	(r223418)
+++ stable/8/lib/libusb/libusb20.3	Wed Jun 22 08:55:00 2011	(r223419)
@@ -534,7 +534,7 @@ returns a zero terminated string describ
 .Pp
 .
 .Fn libusb20_dev_get_info
-retrives the BSD specific usb_device_info structure into the memory location given by 
+retrieves the BSD specific usb_device_info structure into the memory location given by 
 .Fa pinfo .
 The USB device given by
 .Fa pdev

Modified: stable/8/lib/libusb/libusb20.c
==============================================================================
--- stable/8/lib/libusb/libusb20.c	Wed Jun 22 08:52:16 2011	(r223418)
+++ stable/8/lib/libusb/libusb20.c	Wed Jun 22 08:55:00 2011	(r223419)
@@ -326,7 +326,7 @@ libusb20_tr_clear_stall_sync(struct libu
 void
 libusb20_tr_set_buffer(struct libusb20_transfer *xfer, void *buffer, uint16_t frIndex)
 {
-	xfer->ppBuffer[frIndex] = buffer;
+	xfer->ppBuffer[frIndex] = libusb20_pass_ptr(buffer);
 	return;
 }
 
@@ -392,7 +392,7 @@ libusb20_tr_set_total_frames(struct libu
 void
 libusb20_tr_setup_bulk(struct libusb20_transfer *xfer, void *pBuf, uint32_t length, uint32_t timeout)
 {
-	xfer->ppBuffer[0] = pBuf;
+	xfer->ppBuffer[0] = libusb20_pass_ptr(pBuf);
 	xfer->pLength[0] = length;
 	xfer->timeout = timeout;
 	xfer->nFrames = 1;
@@ -404,7 +404,7 @@ libusb20_tr_setup_control(struct libusb2
 {
 	uint16_t len;
 
-	xfer->ppBuffer[0] = psetup;
+	xfer->ppBuffer[0] = libusb20_pass_ptr(psetup);
 	xfer->pLength[0] = 8;		/* fixed */
 	xfer->timeout = timeout;
 
@@ -412,7 +412,7 @@ libusb20_tr_setup_control(struct libusb2
 
 	if (len != 0) {
 		xfer->nFrames = 2;
-		xfer->ppBuffer[1] = pBuf;
+		xfer->ppBuffer[1] = libusb20_pass_ptr(pBuf);
 		xfer->pLength[1] = len;
 	} else {
 		xfer->nFrames = 1;
@@ -423,7 +423,7 @@ libusb20_tr_setup_control(struct libusb2
 void
 libusb20_tr_setup_intr(struct libusb20_transfer *xfer, void *pBuf, uint32_t length, uint32_t timeout)
 {
-	xfer->ppBuffer[0] = pBuf;
+	xfer->ppBuffer[0] = libusb20_pass_ptr(pBuf);
 	xfer->pLength[0] = length;
 	xfer->timeout = timeout;
 	xfer->nFrames = 1;
@@ -437,7 +437,7 @@ libusb20_tr_setup_isoc(struct libusb20_t
 		/* should not happen */
 		return;
 	}
-	xfer->ppBuffer[frIndex] = pBuf;
+	xfer->ppBuffer[frIndex] = libusb20_pass_ptr(pBuf);
 	xfer->pLength[frIndex] = length;
 	return;
 }
@@ -1173,7 +1173,7 @@ libusb20_be_alloc_ugen20(void)
 {
 	struct libusb20_backend *pbe;
 
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
 	pbe = libusb20_be_alloc(&libusb20_ugen20_backend);
 #else
 	pbe = NULL;

Modified: stable/8/lib/libusb/libusb20_int.h
==============================================================================
--- stable/8/lib/libusb/libusb20_int.h	Wed Jun 22 08:52:16 2011	(r223418)
+++ stable/8/lib/libusb/libusb20_int.h	Wed Jun 22 08:55:00 2011	(r223419)
@@ -31,6 +31,12 @@
 #ifndef _LIBUSB20_INT_H_
 #define	_LIBUSB20_INT_H_
 
+#ifdef COMPAT_32BIT
+#define	libusb20_pass_ptr(ptr)	((uint64_t)(uintptr_t)(ptr))
+#else
+#define	libusb20_pass_ptr(ptr)	(ptr)
+#endif
+
 struct libusb20_device;
 struct libusb20_backend;
 struct libusb20_transfer;
@@ -146,7 +152,11 @@ struct libusb20_transfer {
 	/*
 	 * Pointer to a list of buffer pointers:
 	 */
+#ifdef COMPAT_32BIT
+	uint64_t *ppBuffer;
+#else
 	void  **ppBuffer;
+#endif
 	/*
 	 * Pointer to frame lengths, which are updated to actual length
 	 * after the USB transfer completes:

Modified: stable/8/lib/libusb/libusb20_ugen20.c
==============================================================================
--- stable/8/lib/libusb/libusb20_ugen20.c	Wed Jun 22 08:52:16 2011	(r223418)
+++ stable/8/lib/libusb/libusb20_ugen20.c	Wed Jun 22 08:55:00 2011	(r223419)
@@ -226,7 +226,7 @@ ugen20_readdir(struct ugen20_urd_state *
 repeat:
 	if (st->ptr == NULL) {
 		st->urd.urd_startentry += st->nparsed;
-		st->urd.urd_data = st->buf;
+		st->urd.urd_data = libusb20_pass_ptr(st->buf);
 		st->urd.urd_maxlen = sizeof(st->buf);
 		st->nparsed = 0;
 
@@ -339,7 +339,7 @@ ugen20_tr_renew(struct libusb20_device *
 
 	memset(&fs_init, 0, sizeof(fs_init));
 
-	fs_init.pEndpoints = pdev->privBeData;
+	fs_init.pEndpoints = libusb20_pass_ptr(pdev->privBeData);
 	fs_init.ep_index_max = nMaxTransfer;
 
 	if (ioctl(pdev->file, USB_FS_INIT, &fs_init)) {
@@ -453,7 +453,7 @@ ugen20_get_config_desc_full(struct libus
 	memset(&cdesc, 0, sizeof(cdesc));
 	memset(&gen_desc, 0, sizeof(gen_desc));
 
-	gen_desc.ugd_data = &cdesc;
+	gen_desc.ugd_data = libusb20_pass_ptr(&cdesc);
 	gen_desc.ugd_maxlen = sizeof(cdesc);
 	gen_desc.ugd_config_index = cfg_index;
 
@@ -474,7 +474,7 @@ ugen20_get_config_desc_full(struct libus
 	/* make sure memory is initialised */
 	memset(ptr, 0, len);
 
-	gen_desc.ugd_data = ptr;
+	gen_desc.ugd_data = libusb20_pass_ptr(ptr);
 	gen_desc.ugd_maxlen = len;
 
 	error = ioctl(pdev->file_ctrl, USB_GET_FULL_DESC, &gen_desc);
@@ -666,7 +666,7 @@ ugen20_do_request_sync(struct libusb20_d
 
 	memset(&req, 0, sizeof(req));
 
-	req.ucr_data = data;
+	req.ucr_data = libusb20_pass_ptr(data);
 	if (!(flags & LIBUSB20_TRANSFER_SINGLE_SHORT_NOT_OK)) {
 		req.ucr_flags |= USB_SHORT_XFER_OK;
 	}
@@ -764,9 +764,9 @@ ugen20_tr_open(struct libusb20_transfer 
 	xfer->maxTotalLength = temp.max_bufsize;
 	xfer->maxPacketLen = temp.max_packet_length;
 
-	/* setup buffer and length lists */
-	fsep->ppBuffer = xfer->ppBuffer;/* zero copy */
-	fsep->pLength = xfer->pLength;	/* zero copy */
+	/* setup buffer and length lists using zero copy */
+	fsep->ppBuffer = libusb20_pass_ptr(xfer->ppBuffer);
+	fsep->pLength = libusb20_pass_ptr(xfer->pLength);
 
 	return (0);			/* success */
 }
@@ -886,7 +886,7 @@ ugen20_dev_get_iface_desc(struct libusb2
 
 	memset(&ugd, 0, sizeof(ugd));
 
-	ugd.ugd_data = buf;
+	ugd.ugd_data = libusb20_pass_ptr(buf);
 	ugd.ugd_maxlen = len;
 	ugd.ugd_iface_index = iface_index;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201106220855.p5M8t0LD040500>