From owner-svn-src-head@FreeBSD.ORG Wed Nov 19 08:56:36 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B35A3106568E; Wed, 19 Nov 2008 08:56:36 +0000 (UTC) (envelope-from alfred@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9C56A8FC0A; Wed, 19 Nov 2008 08:56:36 +0000 (UTC) (envelope-from alfred@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAJ8uaoT012034; Wed, 19 Nov 2008 08:56:36 GMT (envelope-from alfred@svn.freebsd.org) Received: (from alfred@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAJ8uaC1012028; Wed, 19 Nov 2008 08:56:36 GMT (envelope-from alfred@svn.freebsd.org) Message-Id: <200811190856.mAJ8uaC1012028@svn.freebsd.org> From: Alfred Perlstein Date: Wed, 19 Nov 2008 08:56:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185087 - in head: etc/mtree include lib lib/libusb20 share/man/man7 share/mk sys/dev/usb sys/dev/usb2/bluetooth sys/dev/usb2/controller sys/dev/usb2/core sys/dev/usb2/image sys/dev/usb... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Nov 2008 08:56:36 -0000 Author: alfred Date: Wed Nov 19 08:56:35 2008 New Revision: 185087 URL: http://svn.freebsd.org/changeset/base/185087 Log: src/sys/dev/usb2/controller/uss820dci_pccard.c src/sys/dev/usb2/core/usbdevs src/sys/dev/usb2/include/urio2_ioctl.h src/sys/dev/usb2/storage/ustorage2_fs.h These files are not used any more. src/usr.sbin/Makefile src/etc/mtree/BSD.include.dist src/include/Makefile src/lib/Makefile src/share/man/man7/hier.7 src/share/mk/bsd.libnames.mk src/etc/mtree/BSD.include.dist Make "usbconfig" and "libusb20" a part of the default build. src/sys/dev/usb/rio500_usb.h src/sys/dev/usb2/storage/urio2.c Use common include file. src/sys/dev/usb2/bluetooth/ng_ubt2.c Make USB bluetooth depend on "ng_hci" module. src/sys/dev/usb2/controller/ehci2.c src/sys/dev/usb2/controller/ehci2.h Patches for Marvell EHCI. src/sys/dev/usb2/core/usb2_busdma.c Bugfix for 64-bit platforms. Need to unload the previously loaded DMA map and some cleanup regarding some corner cases. src/sys/dev/usb2/core/usb2_core.h src/sys/dev/usb2/core/usb2_dev.c src/sys/dev/usb2/core/usb2_dev.h Bugfix for libusb filesystem interface. New feature: Add support for filtering device data at the expense of the userland process. Add some more comments. Some minor code styling. Remove unused function, usb2_fifo_get_data_next(). Fix an issue about "fifo_index" being used instead of "ep_index". src/sys/dev/usb2/core/usb2_device.c src/sys/dev/usb2/core/usb2_generic.c Bugfix for Linux USB compat layer. Do not free non-generic FIFOs when doing an alternate setting. Cleanup USB IOCTL and USB reference handling. Fix a corner case where USB-FS was left initialised after setting a new configuration or alternate setting. src/sys/dev/usb2/core/usb2_hub.c Improvement: Check all USB HUB ports by default at least one time. src/sys/dev/usb2/core/usb2_request.c Bugfix: Make sure destination ASCII string is properly zero terminated in all cases. Improvement: Skip invalid characters instead of replacing with a dot. src/sys/dev/usb2/core/usb2_util.c src/sys/dev/usb2/image/uscanner2.c Spelling. src/sys/dev/usb2/include/Makefile Share "usbdevs" with the old USB stack. src/sys/dev/usb2/include/usb2_devid.h src/sys/dev/usb2/include/usb2_devtable.h Regenerate files. Alfred: Please fix the RCS tag at the top. src/sys/dev/usb2/include/usb2_ioctl.h Fix compilation of "kdump". src/sys/dev/usb2/serial/ubsa2.c src/sys/dev/usb2/serial/ugensa2.c Remove device ID's which will end up in a new 3G driver. src/sys/dev/usb2/sound/uaudio2.c Correct a debug printout. src/sys/dev/usb2/storage/umass2.c Sync with old USB stack. src/lib/libusb20/libusb20.3 Add more documentation. src/lib/libusb20/libusb20.c Various bugfixes and improvements. src/usr.sbin/usbconfig/dump.c src/usr.sbin/usbconfig/usbconfig.c New commands for dumping strings and doing custom USB requests from the command line. Remove keyword requirements from generated files: "head/sys/dev/usb2/include/usb2_devid.h" "head/sys/dev/usb2/include/usb2_devtable.h" Deleted: head/sys/dev/usb2/controller/uss820dci_pccard.c head/sys/dev/usb2/core/usbdevs head/sys/dev/usb2/include/urio2_ioctl.h Modified: head/etc/mtree/BSD.include.dist head/include/Makefile head/lib/Makefile head/lib/libusb20/libusb20.3 head/lib/libusb20/libusb20.c head/lib/libusb20/libusb20.h head/lib/libusb20/libusb20_compat01.c head/lib/libusb20/libusb20_compat01.h head/lib/libusb20/libusb20_desc.c head/lib/libusb20/libusb20_desc.h head/lib/libusb20/libusb20_ugen20.c head/share/man/man7/hier.7 head/share/mk/bsd.libnames.mk head/sys/dev/usb/rio500_usb.h head/sys/dev/usb2/bluetooth/ng_ubt2.c head/sys/dev/usb2/controller/ehci2.c head/sys/dev/usb2/controller/ehci2.h head/sys/dev/usb2/core/usb2_busdma.c head/sys/dev/usb2/core/usb2_core.h head/sys/dev/usb2/core/usb2_dev.c head/sys/dev/usb2/core/usb2_dev.h head/sys/dev/usb2/core/usb2_device.c head/sys/dev/usb2/core/usb2_generic.c head/sys/dev/usb2/core/usb2_generic.h head/sys/dev/usb2/core/usb2_hub.c head/sys/dev/usb2/core/usb2_request.c head/sys/dev/usb2/core/usb2_util.c head/sys/dev/usb2/image/uscanner2.c head/sys/dev/usb2/include/Makefile head/sys/dev/usb2/include/usb2_devid.h (contents, props changed) head/sys/dev/usb2/include/usb2_devtable.h (contents, props changed) head/sys/dev/usb2/include/usb2_ioctl.h head/sys/dev/usb2/serial/ubsa2.c head/sys/dev/usb2/serial/ugensa2.c head/sys/dev/usb2/sound/uaudio2.c head/sys/dev/usb2/storage/umass2.c head/sys/dev/usb2/storage/urio2.c head/usr.sbin/Makefile head/usr.sbin/usbconfig/dump.c head/usr.sbin/usbconfig/usbconfig.c Modified: head/etc/mtree/BSD.include.dist ============================================================================== --- head/etc/mtree/BSD.include.dist Wed Nov 19 06:58:52 2008 (r185086) +++ head/etc/mtree/BSD.include.dist Wed Nov 19 08:56:35 2008 (r185087) @@ -120,6 +120,10 @@ .. usb .. + usb2 + include + .. + .. utopia .. vkbd Modified: head/include/Makefile ============================================================================== --- head/include/Makefile Wed Nov 19 06:58:52 2008 (r185086) +++ head/include/Makefile Wed Nov 19 08:56:35 2008 (r185087) @@ -54,7 +54,7 @@ LSUBDIRS= cam/scsi \ security/mac_mls security/mac_partition \ ufs/ffs ufs/ufs -LSUBSUBDIRS= dev/mpt/mpilib +LSUBSUBDIRS= dev/mpt/mpilib dev/usb2/include .if ${MACHINE_ARCH} == "powerpc" _dev_powermac_nvram= dev/powermac_nvram Modified: head/lib/Makefile ============================================================================== --- head/lib/Makefile Wed Nov 19 06:58:52 2008 (r185086) +++ head/lib/Makefile Wed Nov 19 08:56:35 2008 (r185087) @@ -38,7 +38,8 @@ SUBDIR= ${_csu} libc libbsm libcom_err l ${_libpmc} libproc librt ${_libsdp} ${_libsm} ${_libsmb} \ ${_libsmdb} \ ${_libsmutil} libstand ${_libtelnet} ${_libthr} libthread_db libufs \ - libugidfw ${_libusbhid} ${_libvgl} libwrap liby libz ${_bind} + libugidfw ${_libusbhid} ${_libusb20} ${_libvgl} libwrap liby libz \ + ${_bind} .if exists(${.CURDIR}/csu/${MACHINE_ARCH}-elf) _csu=csu/${MACHINE_ARCH}-elf @@ -136,6 +137,7 @@ _libtelnet= libtelnet .if ${MK_USB} != "no" _libusbhid= libusbhid +_libusb20= libusb20 .endif .include Modified: head/lib/libusb20/libusb20.3 ============================================================================== --- head/lib/libusb20/libusb20.3 Wed Nov 19 06:58:52 2008 (r185086) +++ head/lib/libusb20/libusb20.3 Wed Nov 19 08:56:35 2008 (r185087) @@ -60,9 +60,9 @@ USB through the USB file system interfac . .Pp . -.Fn libusb20_tr_close +.Fn libusb20_tr_close pxfer This function will release all kernel resources associated with an USB -.Fa xfer . +.Fa pxfer . . This function returns zero upon success. . @@ -70,13 +70,13 @@ Non-zero return values indicate a LIBUSB . .Pp . -.Fn libusb20_tr_open +.Fn libusb20_tr_open pxfer max_buf_size max_frame_count ep_no This function will allocate kernel resources like -.Fa MaxBufSize +.Fa max_buf_size and -.Fa MaxFrameCount +.Fa max_frame_count associated with an USB -.Fa xfer +.Fa pxfer and bind the transfer to the specified .Fa ep_no . . @@ -86,7 +86,7 @@ Non-zero return values indicate a LIBUSB . .Pp . -.Fn libusb20_tr_get_pointer +.Fn libusb20_tr_get_pointer pdev tr_index This function will return a pointer to the allocated USB transfer according to the .Fa pdev and @@ -97,32 +97,32 @@ This function returns NULL in case of fa . .Pp . -.Fn libusb20_tr_get_time_complete +.Fn libusb20_tr_get_time_complete pxfer This function will return the completion time of an USB transfer in millisecond units. This function is most useful for isochronous USB transfers when doing echo cancelling. . .Pp . -.Fn libusb20_tr_get_actual_frames +.Fn libusb20_tr_get_actual_frames pxfer This function will return the actual number of USB frames after an USB transfer completed. A value of zero means that no data was transferred. . .Pp . -.Fn libusb20_tr_get_actual_length +.Fn libusb20_tr_get_actual_length pxfer This function will return the sum of the actual length for all transferred USB frames for the given USB transfer. . .Pp . -.Fn libusb20_tr_get_max_frames +.Fn libusb20_tr_get_max_frames pxfer This function will return the maximum number of USB frames that were allocated when an USB transfer was setup for the given USB transfer. . .Pp . -.Fn libusb20_tr_get_max_packet_length +.Fn libusb20_tr_get_max_packet_length pxfer This function will return the maximum packet length in bytes associated with the given USB transfer. . @@ -132,20 +132,20 @@ packets are avoided for proxy buffers. . .Pp . -.Fn libusb20_tr_get_max_total_length +.Fn libusb20_tr_get_max_total_length pxfer This function will return the maximum value for the length sum of all USB frames associated with an USB transfer. . .Pp . -.Fn libusb20_tr_get_status +.Fn libusb20_tr_get_status pxfer This function will return the status of an USB transfer. . Status values are defined by a set of LIBUSB20_TRANSFER_XXX enums. . .Pp . -.Fn libusb20_tr_pending +.Fn libusb20_tr_pending pxfer This function will return non-zero if the given USB transfer is pending for completion. . @@ -153,12 +153,12 @@ Else this function returns zero. . .Pp . -.Fn libusb20_tr_callback_wrapper +.Fn libusb20_tr_callback_wrapper pxfer This is an internal function used to wrap asynchronous USB callbacks. . .Pp . -.Fn libusb20_tr_clear_stall_sync +.Fn libusb20_tr_clear_stall_sync pxfer This is an internal function used to synchronously clear the stall on the given USB transfer. . @@ -171,13 +171,13 @@ been called. . .Pp . -.Fn libusb20_tr_drain +.Fn libusb20_tr_drain pxfer This function will stop the given USB transfer and will not return until the USB transfer has been stopped in hardware. . .Pp . -.Fn libusb20_tr_set_buffer +.Fn libusb20_tr_set_buffer pxfer pbuf fr_index This function is used to set the .Fa buffer pointer for the given USB transfer and @@ -188,7 +188,7 @@ Typically the frame index is zero. . .Pp . -.Fn libusb20_tr_set_callback +.Fn libusb20_tr_set_callback pxfer pcallback This function is used to set the USB callback for asynchronous USB transfers. . @@ -196,7 +196,7 @@ The callback type is defined by libusb20 . .Pp . -.Fn libusb20_tr_set_flags +.Fn libusb20_tr_set_flags pxfer flags This function is used to set various USB flags for the given USB transfer. .Bl -tag .It LIBUSB20_TRANSFER_SINGLE_SHORT_NOT_OK @@ -211,22 +211,22 @@ Will do a clear-stall before starting th . .Pp . -.Fn libusb20_tr_set_length +.Fn libusb20_tr_set_length pxfer length fr_index This function sets the length of a given USB transfer and frame index. . .Pp . -.Fn libusb20_tr_set_priv_sc0 +.Fn libusb20_tr_set_priv_sc0 pxfer psc0 This function sets private driver pointer number zero. . .Pp . -.Fn libusb20_tr_set_priv_sc1 +.Fn libusb20_tr_set_priv_sc1 pxfer psc1 This function sets private driver pointer number one. . .Pp . -.Fn libusb20_tr_set_timeout +.Fn libusb20_tr_set_timeout pxfer timeout This function sets the timeout for the given USB transfer. . A timeout value of zero means no timeout. @@ -235,35 +235,35 @@ The timeout is given in milliseconds. . .Pp . -.Fn libusb20_tr_set_total_frames +.Fn libusb20_tr_set_total_frames pxfer nframes This function sets the total number of frames that should be executed when the USB transfer is submitted. . The total number of USB frames must be less than the maximum number of USB frames associated with the given USB transfer. . .Pp . -.Fn libusb20_tr_setup_bulk +.Fn libusb20_tr_setup_bulk pxfer pbuf length timeout This function is a helper function for setting up a single frame USB BULK transfer. . .Pp . -.Fn libusb20_tr_setup_control +.Fn libusb20_tr_setup_control pxfer psetup pbuf timeout This function is a helper function for setting up a single or dual frame USB CONTROL transfer depending on the control transfer length. . .Pp . -.Fn libusb20_tr_setup_intr +.Fn libusb20_tr_setup_intr pxfer pbuf length timeout This function is a helper function for setting up a single frame USB INTERRUPT transfer. . .Pp . -.Fn libusb20_tr_setup_isoc +.Fn libusb20_tr_setup_isoc pxfer pbuf length fr_index This function is a helper function for setting up a multi frame USB ISOCHRONOUS transfer. . .Pp . -.Fn libusb20_tr_start +.Fn libusb20_tr_start pxfer This function will get the USB transfer started, if not already started. . @@ -273,7 +273,7 @@ This function is non-blocking. . .Pp . -.Fn libusb20_tr_stop +.Fn libusb20_tr_stop pxfer This function will get the USB transfer stopped, if not already stopped. . This function is non-blocking, which means that the actual stop can @@ -281,20 +281,20 @@ happen after the return of this function . .Pp . -.Fn libusb20_tr_submit +.Fn libusb20_tr_submit pxfer This function will get the USB transfer queued in hardware. . . .Pp . -.Fn libusb20_tr_get_priv_sc0 +.Fn libusb20_tr_get_priv_sc0 pxfer This function returns private driver pointer number zero associated with an USB transfer. . . .Pp . -.Fn libusb20_tr_get_priv_sc1 +.Fn libusb20_tr_get_priv_sc1 pxfer This function returns private driver pointer number one associated with an USB transfer. . @@ -303,17 +303,17 @@ with an USB transfer. . .Pp . -.Fn libusb20_dev_get_backend_name +.Fn libusb20_dev_get_backend_name pdev This function returns a zero terminated string describing the backend used. . .Pp . -.Fn libusb20_dev_get_desc +.Fn libusb20_dev_get_desc pdev This function returns a zero terminated string describing the given USB device. . .Pp . -.Fn libusb20_dev_claim_interface +.Fn libusb20_dev_claim_interface pdev iface_index This function will try to claim the given USB interface given by .Fa iface_index . This function returns zero on success else a LIBUSB20_ERROR value is @@ -321,7 +321,7 @@ returned. . .Pp . -.Fn libusb20_dev_close +.Fn libusb20_dev_close pdev This function will close the given USB device. . This function returns zero on success else a LIBUSB20_ERROR value is @@ -329,7 +329,7 @@ returned. . .Pp . -.Fn libusb20_dev_detach_kernel_driver +.Fn libusb20_dev_detach_kernel_driver pdev iface_index This function will try to detach the kernel driver for the USB interface given by .Fa iface_index . . @@ -338,7 +338,7 @@ returned. . .Pp . -.Fn libusb20_dev_set_config_index +.Fn libusb20_dev_set_config_index pdev config_index This function will try to set the configuration index on an USB device. . @@ -350,12 +350,12 @@ This function returns zero on success el . .Pp . -.Fn libusb20_dev_get_debug +.Fn libusb20_dev_get_debug pdev This function returns the debug level of an USB device. . .Pp . -.Fn libusb20_dev_get_fd +.Fn libusb20_dev_get_fd pdev This function returns the file descriptor of the given USB device. . A negative value is returned when no file descriptor is present. @@ -364,7 +364,7 @@ The file descriptor can be used for poll . .Pp . -.Fn libusb20_dev_kernel_driver_active +.Fn libusb20_dev_kernel_driver_active pdev iface_index This function returns a non-zero value if a kernel driver is active on the given USB interface. . @@ -372,7 +372,7 @@ Else zero is returned. . .Pp . -.Fn libusb20_dev_open +.Fn libusb20_dev_open pdev transfer_max This function opens an USB device so that setting up USB transfers becomes possible. . @@ -387,7 +387,7 @@ opened. . .Pp . -.Fn libusb20_dev_process +.Fn libusb20_dev_process pdev This function is called to sync kernel USB transfers with userland USB transfers. . @@ -397,7 +397,7 @@ detached. . .Pp . -.Fn libusb20_dev_release_interface +.Fn libusb20_dev_release_interface pdev iface_index This function will try to release a claimed USB interface for the specified USB device. . This function returns zero on success else a LIBUSB20_ERROR value is @@ -405,7 +405,7 @@ returned. . .Pp . -.Fn libusb20_dev_request_sync +.Fn libusb20_dev_request_sync pdev psetup pdata pactlen timeout flags This function will perform a synchronous control request on the given USB device. . @@ -428,7 +428,7 @@ returned. . .Pp . -.Fn libusb20_dev_req_string_sync +.Fn libusb20_dev_req_string_sync pdev index lang_id pbuf len This function will synchronously request an USB string by language ID and string index into the given buffer limited by a maximum length. . @@ -437,7 +437,7 @@ returned. . .Pp . -.Fn libusb20_dev_req_string_simple_sync +.Fn libusb20_dev_req_string_simple_sync pdev index pbuf len This function will synchronously request an USB string using the default language ID and convert the string into ASCII before storing the string into the given buffer limited by a maximum length which @@ -449,7 +449,7 @@ returned. . .Pp . -.Fn libusb20_dev_reset +.Fn libusb20_dev_reset pdev This function will try to BUS reset the given USB device and restore the last set USB configuration. . @@ -458,7 +458,7 @@ returned. . .Pp . -.Fn libusb20_dev_set_power_mode +.Fn libusb20_dev_set_power_mode pdev power_mode This function sets the power mode of the USB device. . Valid power modes: @@ -475,13 +475,13 @@ returned. . .Pp . -.Fn libusb20_dev_get_power_mode +.Fn libusb20_dev_get_power_mode pdev This function returns the currently selected power mode for the given USB device. . .Pp . -.Fn libusb20_dev_set_alt_index +.Fn libusb20_dev_set_alt_index pdev iface_index alt_index This function will try to set the given alternate index for the given USB interface index. . @@ -490,7 +490,7 @@ returned. . .Pp . -.Fn libusb20_dev_set_owner +.Fn libusb20_dev_set_owner pdev uid gid This function will set the ownership of the given USB device. . This function returns zero on success else a LIBUSB20_ERROR value is @@ -498,7 +498,7 @@ returned. . .Pp . -.Fn libusb20_dev_set_perm +.Fn libusb20_dev_set_perm pdev mode This function will set the permissions of the given USB device. . This function returns zero on success else a LIBUSB20_ERROR value is @@ -506,7 +506,7 @@ returned. . .Pp . -.Fn libusb20_dev_set_iface_owner +.Fn libusb20_dev_set_iface_owner pdev iface_index uid gid This function will set the ownership of the given USB interface. . This function returns zero on success else a LIBUSB20_ERROR value is @@ -514,7 +514,7 @@ returned. . .Pp . -.Fn libusb20_dev_set_iface_perm +.Fn libusb20_dev_set_iface_perm pdev iface_index mode This function will set the permissions of the given USB interface. . This function returns zero on success else a LIBUSB20_ERROR value is @@ -522,7 +522,7 @@ returned. . .Pp . -.Fn libusb20_dev_get_owner +.Fn libusb20_dev_get_owner pdev puid pgid This function will retrieve the current USB device ownership. . This function returns zero on success else a LIBUSB20_ERROR value is @@ -530,7 +530,7 @@ returned. . .Pp . -.Fn libusb20_dev_get_perm +.Fn libusb20_dev_get_perm pdev pmode This function will retrieve the current USB device permissions. . This function returns zero on success else a LIBUSB20_ERROR value is @@ -538,7 +538,7 @@ returned. . .Pp . -.Fn libusb20_dev_get_iface_owner +.Fn libusb20_dev_get_iface_owner pdev iface_index puid pgid This function will retrieve the current USB interface ownership for the given USB interface. . @@ -547,7 +547,7 @@ returned. . .Pp . -.Fn libusb20_dev_get_iface_perm +.Fn libusb20_dev_get_iface_perm pdev iface_index pmode This function will retrieve the current USB interface permissions for the given USB interface. . @@ -556,7 +556,7 @@ returned. . .Pp . -.Fn libusb20_dev_get_device_desc +.Fn libusb20_dev_get_device_desc pdev This function returns a pointer to the decoded and host endian version of the device descriptor. . @@ -564,7 +564,7 @@ The USB device need not be opened when c . .Pp . -.Fn libusb20_dev_alloc_config +.Fn libusb20_dev_alloc_config pdev config_index This function will read out and decode the USB config descriptor for the given USB device and config index. This function returns a pointer to the decoded configuration which must eventually be passed to @@ -572,24 +572,24 @@ free(). NULL is returned in case of fail . .Pp . -.Fn libusb20_dev_alloc(void) +.Fn libusb20_dev_alloc void This is an internal function to allocate a new USB device. . .Pp . -.Fn libusb20_dev_get_address +.Fn libusb20_dev_get_address pdev This function returns the internal and not necessarily the real hardware address of the given USB device. . .Pp . -.Fn libusb20_dev_get_bus_number +.Fn libusb20_dev_get_bus_number pdev This function return the internal bus number which the given USB device belongs to. . .Pp . -.Fn libusb20_dev_get_mode +.Fn libusb20_dev_get_mode pdev This function returns the current operation mode of the USB entity. . Valid return values are: @@ -600,7 +600,7 @@ Valid return values are: . .Pp . -.Fn libusb20_dev_get_speed +.Fn libusb20_dev_get_speed pdev This function returns the current speed of the given USB device. . .Bl -tag @@ -614,24 +614,24 @@ This function returns the current speed . .Pp . -.Fn libusb20_dev_get_config_index +.Fn libusb20_dev_get_config_index pdev This function returns the currently select config index for the given USB device. . .Pp . -.Fn libusb20_dev_free +.Fn libusb20_dev_free pdev This function will free the given USB device and all associated USB transfers. . .Pp . -.Fn libusb20_dev_set_debug +.Fn libusb20_dev_set_debug pdev debug_level This function will set the debug level for the given USB device. . .Pp . -.Fn libusb20_dev_wait_process +.Fn libusb20_dev_wait_process pdev timeout This function will wait until a pending USB transfer has completed on the given USB device. . @@ -641,7 +641,7 @@ function. . .Sh USB BUS OPERATIONS . -.Fn libusb20_bus_set_owner +.Fn libusb20_bus_set_owner pbackend bus_index uid gid This function will set the ownership for the given USB bus. . This function returns zero on success else a LIBUSB20_ERROR value is @@ -649,7 +649,7 @@ returned. . .Pp . -.Fn libusb20_bus_set_perm +.Fn libusb20_bus_set_perm pbackend bus_index mode This function will set the permissions for the given USB bus. . This function returns zero on success else a LIBUSB20_ERROR value is @@ -657,7 +657,7 @@ returned. . .Pp . -.Fn libusb20_bus_get_owner +.Fn libusb20_bus_get_owner pbackend bus_index puid pgid This function will retrieve the ownership for the given USB bus. . This function returns zero on success else a LIBUSB20_ERROR value is @@ -665,7 +665,7 @@ returned. . .Pp . -.Fn libusb20_bus_get_perm +.Fn libusb20_bus_get_perm pbackend bus_index pmode This function will retrieve the permissions for the given USB bus. . This function returns zero on success else a LIBUSB20_ERROR value is @@ -674,7 +674,7 @@ returned. . .Sh USB BACKEND OPERATIONS . -.Fn libusb20_be_get_dev_quirk +.Fn libusb20_be_get_dev_quirk pbackend index pquirk This function will return the device quirk according to .Fa index into the libusb20_quirk structure pointed to by @@ -687,7 +687,7 @@ returned. . .Pp . -.Fn libusb20_be_get_quirk_name +.Fn libusb20_be_get_quirk_name pbackend index pquirk This function will return the quirk name according to .Fa index into the libusb20_quirk structure pointed to by @@ -700,7 +700,7 @@ returned. . .Pp . -.Fn libusb20_be_add_dev_quirk +.Fn libusb20_be_add_dev_quirk pbackend pquirk This function will add the libusb20_quirk structure pointed to by the .Fa pq argument into the device quirk list. @@ -713,7 +713,7 @@ returned. . .Pp . -.Fn libusb20_be_remove_dev_quirk +.Fn libusb20_be_remove_dev_quirk pbackend pquirk This function will remove the quirk matching the libusb20_quirk structure pointed to by the .Fa pq argument from the device quirk list. @@ -726,7 +726,7 @@ returned. . .Pp . -.Fn libusb20_be_set_owner +.Fn libusb20_be_set_owner pbackend uid gid This function will set the ownership for the given backend. . This function returns zero on success else a LIBUSB20_ERROR value is @@ -734,7 +734,7 @@ returned. . .Pp . -.Fn libusb20_be_set_perm +.Fn libusb20_be_set_perm pbackend mode This function will set the permissions for the given backend. . This function returns zero on success else a LIBUSB20_ERROR value is @@ -742,7 +742,7 @@ returned. . .Pp . -.Fn libusb20_be_get_owner +.Fn libusb20_be_get_owner pbackend puid pgid This function will retrieve the ownership of the given backend. . This function returns zero on success else a LIBUSB20_ERROR value is @@ -750,7 +750,7 @@ returned. . .Pp . -.Fn libusb20_be_get_perm +.Fn libusb20_be_get_perm pbackend pmode This function will retrieve the permissions of the given backend. . . @@ -759,20 +759,20 @@ returned. . .Pp . -.Fn libusb20_be_alloc +.Fn libusb20_be_alloc pmethods This is an internal function to allocate a USB backend. . .Pp -.Fn libusb20_be_alloc_default -.Fn libusb20_be_alloc_freebsd -.Fn libusb20_be_alloc_linux +.Fn libusb20_be_alloc_default void +.Fn libusb20_be_alloc_freebsd void +.Fn libusb20_be_alloc_linux void These functions are used to allocate a specific USB backend or the operating system default USB backend. Allocating a backend is a way to scan for currently present USB devices. . .Pp . -.Fn libusb20_be_device_foreach +.Fn libusb20_be_device_foreach pbackend pdev This function is used to iterate USB devices present in a USB backend. . The starting value of @@ -785,7 +785,7 @@ If NULL is returned the end of the USB d . .Pp . -.Fn libusb20_be_dequeue_device +.Fn libusb20_be_dequeue_device pbackend pdev This function will dequeue the given USB device pointer from the backend USB device list. . @@ -793,20 +793,20 @@ Dequeued USB devices will not be freed w . .Pp . -.Fn libusb20_be_enqueue_device +.Fn libusb20_be_enqueue_device pbackend pdev This function will enqueue the given USB device pointer in the backend USB device list. . Enqueued USB devices will get freed when the backend is freed. . .Pp . -.Fn libusb20_be_free +.Fn libusb20_be_free pbackend This function will free the given backend and all USB devices in its device list. . . .Sh USB DESCRIPTOR PARSING . -.Fn libusb20_me_get_1 +.Fn libusb20_me_get_1 pie offset This function will return a byte at the given byte offset of a message entity. . @@ -814,7 +814,7 @@ This function is safe against invalid of . .Pp . -.Fn libusb20_me_get_2 +.Fn libusb20_me_get_2 pie offset This function will return a little endian 16-bit value at the given byte offset of a message entity. . @@ -822,7 +822,7 @@ This function is safe against invalid of . .Pp . -.Fn libusb20_me_encode +.Fn libusb20_me_encode pbuf len pdecoded This function will encode a so-called *DECODED structure into binary format. . @@ -834,7 +834,7 @@ location. . .Pp . -.Fn libusb20_me_decode +.Fn libusb20_me_decode pbuf len pdecoded This function will decode a binary structure into a so-called *DECODED structure. . Modified: head/lib/libusb20/libusb20.c ============================================================================== --- head/lib/libusb20/libusb20.c Wed Nov 19 06:58:52 2008 (r185086) +++ head/lib/libusb20/libusb20.c Wed Nov 19 08:56:35 2008 (r185087) @@ -550,6 +550,9 @@ libusb20_dev_open(struct libusb20_device xfer->callback = &dummy_callback; } + /* set "nTransfer" early */ + pdev->nTransfer = nTransferMax; + error = (pdev->beMethods->open_device) (pdev, nTransferMax); if (error) { @@ -562,7 +565,6 @@ libusb20_dev_open(struct libusb20_device pdev->nTransfer = 0; } else { pdev->is_opened = 1; - pdev->nTransfer = nTransferMax; } return (error); } @@ -647,7 +649,7 @@ libusb20_dev_request_sync(struct libusb2 int libusb20_dev_req_string_sync(struct libusb20_device *pdev, - uint8_t index, uint16_t langid, void *ptr, uint16_t len) + uint8_t str_index, uint16_t langid, void *ptr, uint16_t len) { struct LIBUSB20_CONTROL_SETUP_DECODED req; int error; @@ -667,7 +669,7 @@ libusb20_dev_req_string_sync(struct libu LIBUSB20_RECIPIENT_DEVICE | LIBUSB20_ENDPOINT_IN; req.bRequest = LIBUSB20_REQUEST_GET_DESCRIPTOR; - req.wValue = (LIBUSB20_DT_STRING << 8) | index; + req.wValue = (LIBUSB20_DT_STRING << 8) | str_index; req.wIndex = langid; req.wLength = 4; /* bytes */ @@ -695,7 +697,7 @@ libusb20_dev_req_string_sync(struct libu int libusb20_dev_req_string_simple_sync(struct libusb20_device *pdev, - uint8_t index, void *ptr, uint16_t len) + uint8_t str_index, void *ptr, uint16_t len) { char *buf; int error; @@ -712,26 +714,23 @@ libusb20_dev_req_string_simple_sync(stru /* too short buffer */ return (LIBUSB20_ERROR_INVALID_PARAM); } - /* - * Make sure that there is sensible contents in the buffer in case - * of an error: - */ - *(uint8_t *)ptr = 0; - error = libusb20_dev_req_string_sync(pdev, 0, 0, temp, sizeof(temp)); - if (error < 0) + if (error < 0) { + *(uint8_t *)ptr = 0; /* zero terminate */ return (error); - + } langid = temp[2] | (temp[3] << 8); - error = libusb20_dev_req_string_sync(pdev, index, + error = libusb20_dev_req_string_sync(pdev, str_index, langid, temp, sizeof(temp)); - if (error < 0) + if (error < 0) { + *(uint8_t *)ptr = 0; /* zero terminate */ return (error); - + } if (temp[0] < 2) { /* string length is too short */ + *(uint8_t *)ptr = 0; /* zero terminate */ return (LIBUSB20_ERROR_OTHER); } /* reserve one byte for terminating zero */ @@ -762,14 +761,16 @@ libusb20_dev_req_string_simple_sync(stru *buf = c >> 8; swap = 2; } else { - *buf = '.'; + /* skip invalid character */ + continue; } /* * Filter by default - we don't allow greater and less than * signs because they might confuse the dmesg printouts! */ if ((*buf == '<') || (*buf == '>') || (!isprint(*buf))) { - *buf = '.'; + /* skip invalid character */ + continue; } buf++; } @@ -836,7 +837,7 @@ uint8_t libusb20_dev_get_config_index(struct libusb20_device *pdev) { int error; - uint8_t index; + uint8_t cfg_index; uint8_t do_close; if (!pdev->is_opened) { @@ -850,16 +851,16 @@ libusb20_dev_get_config_index(struct lib do_close = 0; } - error = (pdev->methods->get_config_index) (pdev, &index); + error = (pdev->methods->get_config_index) (pdev, &cfg_index); if (error) { - index = 0 - 1; /* current config index */ + cfg_index = 0 - 1; /* current config index */ } if (do_close) { if (libusb20_dev_close(pdev)) { /* ignore */ } } - return (index); + return (cfg_index); } uint8_t @@ -887,7 +888,7 @@ libusb20_dev_process(struct libusb20_dev void libusb20_dev_wait_process(struct libusb20_device *pdev, int timeout) { - struct pollfd pfd[2]; + struct pollfd pfd[1]; if (!pdev->is_opened) { return; @@ -895,11 +896,8 @@ libusb20_dev_wait_process(struct libusb2 pfd[0].fd = pdev->file; pfd[0].events = (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM); pfd[0].revents = 0; - pfd[1].fd = 0; /* standard input */ - pfd[1].events = (POLLIN | POLLRDNORM); - pfd[1].revents = 0; - if (poll(pfd, 2, timeout)) { + if (poll(pfd, 1, timeout)) { /* ignore any error */ } return; @@ -1071,16 +1069,16 @@ libusb20_bus_get_perm(struct libusb20_ba int libusb20_be_get_dev_quirk(struct libusb20_backend *pbe, - uint16_t index, struct libusb20_quirk *pq) + uint16_t quirk_index, struct libusb20_quirk *pq) { - return ((pbe->methods->root_get_dev_quirk) (pbe, index, pq)); + return ((pbe->methods->root_get_dev_quirk) (pbe, quirk_index, pq)); } int libusb20_be_get_quirk_name(struct libusb20_backend *pbe, - uint16_t index, struct libusb20_quirk *pq) + uint16_t quirk_index, struct libusb20_quirk *pq) { - return ((pbe->methods->root_get_quirk_name) (pbe, index, pq)); + return ((pbe->methods->root_get_quirk_name) (pbe, quirk_index, pq)); } int Modified: head/lib/libusb20/libusb20.h ============================================================================== --- head/lib/libusb20/libusb20.h Wed Nov 19 06:58:52 2008 (r185086) +++ head/lib/libusb20/libusb20.h Wed Nov 19 08:56:35 2008 (r185087) @@ -199,7 +199,7 @@ struct libusb20_quirk { /* USB transfer operations */ int libusb20_tr_close(struct libusb20_transfer *xfer); -int libusb20_tr_open(struct libusb20_transfer *xfer, uint32_t pMaxBufSize, uint32_t MaxFrameCount, uint8_t ep_no); +int libusb20_tr_open(struct libusb20_transfer *xfer, uint32_t max_buf_size, uint32_t max_frame_count, uint8_t ep_no); 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); @@ -297,6 +297,7 @@ struct libusb20_backend *libusb20_be_all struct libusb20_backend *libusb20_be_alloc_default(void); struct libusb20_backend *libusb20_be_alloc_freebsd(void); struct libusb20_backend *libusb20_be_alloc_linux(void); +struct libusb20_backend *libusb20_be_alloc_ugen20(void); struct libusb20_device *libusb20_be_device_foreach(struct libusb20_backend *pbe, struct libusb20_device *pdev); void libusb20_be_dequeue_device(struct libusb20_backend *pbe, struct libusb20_device *pdev); *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***