History log of /freebsd-11-stable/lib/libusb/libusb10.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 362224 16-Jun-2020 kevans

MFC r361977: libusb: improve compatibility

Specifically, add LIBUSB_CLASS_PHYSICAL and the libusb_has_capability API.
Descriptions and functionality for these derived from the
documentation at [0]. The current set of capabilities are all supported by
libusb.

These were detected as missing after updating net/freerdp to 2.1.1, which
attempted to use both.

[0] http://libusb.sourceforge.net/api-1.0/group__libusb__misc.html


# 353135 06-Oct-2019 kevans

MFC r353009: libusb: LIBUSB_DEBUG env var override of libusb_set_debug

The debug level generally just controls verbosity of libusb for debugging
libusb devices/usage. We allow the environment to set the debug level
independent of the application, but the application will always override
this if it explicitly sets the debug level.

Changing the environment is easy, but patching the software to change the
debug level isn't necessarily easy or possible. Further, there's this
write-only debug_fixed variable that would seem to imply that the debug
level should be fixed, but it isn't currently used. Change the logic to use
strtol() so we can detect real 0 vs. conversion failure, then honor
debug_fixed in libusb_set_debug.


# 345540 26-Mar-2019 hselasky

MFC r344795:
Fix typos in libusb.

Found by: Denis Ahrens <denis@h3q.com>
Sponsored by: Mellanox Technologies


# 338788 19-Sep-2018 hselasky

MFC r338616:
Fix issues about cancelling USB transfers in LibUSB when the USB device has
been detached. When a USB device has been detached the kernel file handle
stops responding to commands. USB applications which continue to run after
the USB device has been detached, depend on LibUSB generated events to tear
down its pending USB transfers. Add code to handle the needed cleanup when
processing the USB transfer(s) fails and prevent new USB transfer(s) from
being submitted.

Found by: Ludovic Rousseau <ludovic.rousseau+freebsd@gmail.com>
PR: 231076
Sponsored by: Mellanox Technologies


# 331722 29-Mar-2018 eadler

Revert r330897:

This was intended to be a non-functional change. It wasn't. The commit
message was thus wrong. In addition it broke arm, and merged crypto
related code.

Revert with prejudice.

This revert skips files touched in r316370 since that commit was since
MFCed. This revert also skips files that require $FreeBSD$ property
changes.

Thank you to those who helped me get out of this mess including but not
limited to gonzo, kevans, rgrimes.

Requested by: gjb (re)


# 330897 14-Mar-2018 eadler

Partial merge of the SPDX changes

These changes are incomplete but are making it difficult
to determine what other changes can/should be merged.

No objections from: pfg


# 302408 07-Jul-2016 gjb

Copy head@r302406 to stable/11 as part of the 11.0-RELEASE cycle.
Prune svn:mergeinfo from the new branch, as nothing has been merged
here.

Additional commits post-branch will follow.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


/freebsd-11-stable/MAINTAINERS
/freebsd-11-stable/cddl
/freebsd-11-stable/cddl/contrib/opensolaris
/freebsd-11-stable/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print
/freebsd-11-stable/cddl/contrib/opensolaris/cmd/zfs
/freebsd-11-stable/cddl/contrib/opensolaris/lib/libzfs
/freebsd-11-stable/contrib/amd
/freebsd-11-stable/contrib/apr
/freebsd-11-stable/contrib/apr-util
/freebsd-11-stable/contrib/atf
/freebsd-11-stable/contrib/binutils
/freebsd-11-stable/contrib/bmake
/freebsd-11-stable/contrib/byacc
/freebsd-11-stable/contrib/bzip2
/freebsd-11-stable/contrib/com_err
/freebsd-11-stable/contrib/compiler-rt
/freebsd-11-stable/contrib/dialog
/freebsd-11-stable/contrib/dma
/freebsd-11-stable/contrib/dtc
/freebsd-11-stable/contrib/ee
/freebsd-11-stable/contrib/elftoolchain
/freebsd-11-stable/contrib/elftoolchain/ar
/freebsd-11-stable/contrib/elftoolchain/brandelf
/freebsd-11-stable/contrib/elftoolchain/elfdump
/freebsd-11-stable/contrib/expat
/freebsd-11-stable/contrib/file
/freebsd-11-stable/contrib/gcc
/freebsd-11-stable/contrib/gcclibs/libgomp
/freebsd-11-stable/contrib/gdb
/freebsd-11-stable/contrib/gdtoa
/freebsd-11-stable/contrib/groff
/freebsd-11-stable/contrib/ipfilter
/freebsd-11-stable/contrib/ldns
/freebsd-11-stable/contrib/ldns-host
/freebsd-11-stable/contrib/less
/freebsd-11-stable/contrib/libarchive
/freebsd-11-stable/contrib/libarchive/cpio
/freebsd-11-stable/contrib/libarchive/libarchive
/freebsd-11-stable/contrib/libarchive/libarchive_fe
/freebsd-11-stable/contrib/libarchive/tar
/freebsd-11-stable/contrib/libc++
/freebsd-11-stable/contrib/libc-vis
/freebsd-11-stable/contrib/libcxxrt
/freebsd-11-stable/contrib/libexecinfo
/freebsd-11-stable/contrib/libpcap
/freebsd-11-stable/contrib/libstdc++
/freebsd-11-stable/contrib/libucl
/freebsd-11-stable/contrib/libxo
/freebsd-11-stable/contrib/llvm
/freebsd-11-stable/contrib/llvm/projects/libunwind
/freebsd-11-stable/contrib/llvm/tools/clang
/freebsd-11-stable/contrib/llvm/tools/lldb
/freebsd-11-stable/contrib/llvm/tools/llvm-dwarfdump
/freebsd-11-stable/contrib/llvm/tools/llvm-lto
/freebsd-11-stable/contrib/mdocml
/freebsd-11-stable/contrib/mtree
/freebsd-11-stable/contrib/ncurses
/freebsd-11-stable/contrib/netcat
/freebsd-11-stable/contrib/ntp
/freebsd-11-stable/contrib/nvi
/freebsd-11-stable/contrib/one-true-awk
/freebsd-11-stable/contrib/openbsm
/freebsd-11-stable/contrib/openpam
/freebsd-11-stable/contrib/openresolv
/freebsd-11-stable/contrib/pf
/freebsd-11-stable/contrib/sendmail
/freebsd-11-stable/contrib/serf
/freebsd-11-stable/contrib/sqlite3
/freebsd-11-stable/contrib/subversion
/freebsd-11-stable/contrib/tcpdump
/freebsd-11-stable/contrib/tcsh
/freebsd-11-stable/contrib/tnftp
/freebsd-11-stable/contrib/top
/freebsd-11-stable/contrib/top/install-sh
/freebsd-11-stable/contrib/tzcode/stdtime
/freebsd-11-stable/contrib/tzcode/zic
/freebsd-11-stable/contrib/tzdata
/freebsd-11-stable/contrib/unbound
/freebsd-11-stable/contrib/vis
/freebsd-11-stable/contrib/wpa
/freebsd-11-stable/contrib/xz
/freebsd-11-stable/crypto/heimdal
/freebsd-11-stable/crypto/openssh
/freebsd-11-stable/crypto/openssl
/freebsd-11-stable/gnu/lib
/freebsd-11-stable/gnu/usr.bin/binutils
/freebsd-11-stable/gnu/usr.bin/cc/cc_tools
/freebsd-11-stable/gnu/usr.bin/gdb
/freebsd-11-stable/lib/libc/locale/ascii.c
/freebsd-11-stable/sys/cddl/contrib/opensolaris
/freebsd-11-stable/sys/contrib/dev/acpica
/freebsd-11-stable/sys/contrib/ipfilter
/freebsd-11-stable/sys/contrib/libfdt
/freebsd-11-stable/sys/contrib/octeon-sdk
/freebsd-11-stable/sys/contrib/x86emu
/freebsd-11-stable/sys/contrib/xz-embedded
/freebsd-11-stable/usr.sbin/bhyve/atkbdc.h
/freebsd-11-stable/usr.sbin/bhyve/bhyvegc.c
/freebsd-11-stable/usr.sbin/bhyve/bhyvegc.h
/freebsd-11-stable/usr.sbin/bhyve/console.c
/freebsd-11-stable/usr.sbin/bhyve/console.h
/freebsd-11-stable/usr.sbin/bhyve/pci_fbuf.c
/freebsd-11-stable/usr.sbin/bhyve/pci_xhci.c
/freebsd-11-stable/usr.sbin/bhyve/pci_xhci.h
/freebsd-11-stable/usr.sbin/bhyve/ps2kbd.c
/freebsd-11-stable/usr.sbin/bhyve/ps2kbd.h
/freebsd-11-stable/usr.sbin/bhyve/ps2mouse.c
/freebsd-11-stable/usr.sbin/bhyve/ps2mouse.h
/freebsd-11-stable/usr.sbin/bhyve/rfb.c
/freebsd-11-stable/usr.sbin/bhyve/rfb.h
/freebsd-11-stable/usr.sbin/bhyve/sockstream.c
/freebsd-11-stable/usr.sbin/bhyve/sockstream.h
/freebsd-11-stable/usr.sbin/bhyve/usb_emul.c
/freebsd-11-stable/usr.sbin/bhyve/usb_emul.h
/freebsd-11-stable/usr.sbin/bhyve/usb_mouse.c
/freebsd-11-stable/usr.sbin/bhyve/vga.c
/freebsd-11-stable/usr.sbin/bhyve/vga.h
# 302125 23-Jun-2016 hselasky

Add support for USB streams to the LibUSB v1.0 API and update the
libusb(3) manual page.

Approved by: re (gjb)
Requested by: swills
MFC after: 1 week


# 302080 22-Jun-2016 hselasky

Implement libusb_hotplug_register_callback() and
libusb_hotplug_deregister_callback() for the LibUSB v1.0 API and
update the libusb(3) manual page.

Approved by: re (kib)
Requested by: swills
MFC after: 1 week


# 301969 16-Jun-2016 hselasky

Add missing return statement.

Approved by: re (gjb)
MFC after: 1 week


# 301966 16-Jun-2016 hselasky

Add support for libusb_set_auto_detach_kernel_driver() to the LibUSB v1.0 API.

Approved by: re (kostikbel)
Requested by: swills
MFC after: 1 week


# 301964 16-Jun-2016 hselasky

Add support for libusb_get_port_number() to the LibUSB v1.0 API.

Approved by: re (kostikbel)
Requested by: swills
MFC after: 1 week


# 301956 16-Jun-2016 hselasky

Implement libusb_get_version() and update libusb manual page.

Approved by: re (glebius)
Requested by: swills
MFC after: 1 week


# 301842 12-Jun-2016 hselasky

Implement code to stop all USB endpoints before executing a USB device
reset command, alternate setting command or set configuration
command. Else LibUSB v1.0 will not re-open the endpoints which the
kernel closes and the USB application might wait infinitely for
transfers to complete.

Approved by: re (hrs)
MFC after: 3 days


# 284744 23-Jun-2015 araujo

Remove unused variables to silence CLANG warnings.
Remove some BLANK lines and unnecessary TABS.

Differential Revision: D2687
Reviewed by: rodrigc, hselasky


# 264344 11-Apr-2014 hselasky

Tune buffer sizes for SuperSpeed USB when using LibUSB v0.1 and v1.0
APIs to increase the maximum bandwidth limit.

MFC after: 1 week


# 261224 28-Jan-2014 hselasky

Comply to the official LibUSB v1.0 API:
"It is legal to attempt to claim an already-claimed interface."

MFC after: 1 week


# 251495 07-Jun-2013 emaste

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.


# 250342 07-May-2013 emaste

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@


# 248236 13-Mar-2013 hselasky

- Make the FreeBSD's USB library compile under Linux.
- Fix a compile warning where the return value of a call
to a write() function was ignored.
- Remove redundant include files from userland USB header files.
- Add some now needed include files to various C-files.


# 236944 12-Jun-2012 hselasky

LibUSB v1.0 API compiliance and bugfixes.

- Use CLOCK_MONOTONIC instead of CLOCK_REALTIME, because CLOCK_MONOTONIC
does not wrap into negative in near future. This fixes any potential
problems using "pthread_cond_timedwait()".

- Fix a bug where the "libusb_wait_for_event()" function computes an
absolute timeout instead of a relative timeout. USB transfers do
not depend on this timeout value.

- Add dependency towards LibPthread to Makefile, because LibUSB v1.0
needs this library to function correctly.

MFC after: 1 week


# 234684 25-Apr-2012 hselasky

Fix binary compatibility to the official LibUSB 1.0.
This is useful for GNU/kFreeBSD and the libusb2debian port.
Applications using the asynchronous API of LibUSB 1.0 needs
to be recompiled after this update.

Found by: lme @


# 234491 20-Apr-2012 hselasky

Fix some compile warnings.

MFC after: 1 week


# 234193 12-Apr-2012 hselasky

Add missing LibUSB 1.0 API function.

Reported by: lme @
MFC after: 1 week


# 228236 03-Dec-2011 hselasky

Simplify libusb_open_device_with_vid_pid(): Only set
pdev to non-NULL on success instead of unconditonally
setting it and maybe resetting it later.

Submitted by: Christoph Mallon
MFC after: 3 days


# 228235 03-Dec-2011 hselasky

libusb_open() sets the given device handle to NULL if it
fails, so there is no need to do it again after returning.

Submitted by: Christoph Mallon
MFC after: 3 days


# 226220 10-Oct-2011 hselasky

Fix how libusb20_dev_kernel_driver_active() and
libusb_dev_kernel_driver_active() works. In case of
libusb20 the manpage was wrong and in case of
libusb10 the implementation was wrong.

Submitted by: Kai Wang
MFC after: 3 days


# 225659 19-Sep-2011 hselasky

Implement missing USB debug information functions.

Approved by: re (kib)
MFC after: 1 week


# 225035 20-Aug-2011 hselasky

Use correct enum instead of constant value.

MFC after: 1 week
Spotted by: scf @
Approved by: re (kib)


# 224903 16-Aug-2011 hselasky

Add missing function to get device speed to the LibUSB v1.0 API.

MFC after: 1 week
Approved by: re (kib)


# 224085 16-Jul-2011 hselasky

- Add two missing functions to the LibUSB v0.1 API.
- Clamp the string length to 255 bytes when getting
the interface description.
- Clamp data request length to 65535 bytes when doing
control requests.

MFC after: 3 days


# 223642 28-Jun-2011 hselasky

LibUSB v1.0: Need at least one frame when doing the dummy open
else clear stall won't work in that case.


# 219100 28-Feb-2011 hselasky

- Add support for software pre-scaling of ISOCHRONOUS transfers.

MFC after: 14 days
Approved by: thompsa (mentor)


# 215253 13-Nov-2010 hselasky

Fix LibUSB v1.0 compliancy.

1) We need to allow the USB callback to free the USB transfer itself.
2) The USB transfer buffer should only be automatically freed when
freeing the USB transfer.

Fixed by: hselasky
Submitted by: Gustau Perez i Querol
Approved by: thompsa (mentor)


# 213853 14-Oct-2010 hselasky

- Add missing LibUSB API functions:
* libusb_strerror()
* libusb_get_driver[_np]()
* libusb_detach_kernel_driver[_np]()
- Factor out setting of non-blocking flag inside libusb.
- Add missing NULL check after libusb_get_device() call.
- Correct some wrong error codes due to copy and paste error.

PR: usb/150546
Submitted by: Robert Jenssen, Alexander Leidinger
Approved by: thompsa (mentor)


# 213848 14-Oct-2010 hselasky

LibUSB (new API):
- Add a new API function to check the connected
status of the USB handle in the LibUSB v1.0 and
LibUSB v0.1 interfaces.

Approved by: thompsa (mentor)


# 208020 12-May-2010 thompsa

Fix header file compliancy with libusb 1.0 from sourceforge.

Reported by: Xiaofan Chen
Submitted by: Hans Petter Selasky


# 203815 13-Feb-2010 wkoszek

Resort includes to match style(9) a bit more. No functional change
is expected after this commit.

Tested by: make buildworld
Reviewed by: hps (patch without .h changes)


# 203774 11-Feb-2010 wkoszek

Use more standard way for setting nonblocking flag for a filedescriptor.
This makes libusb porting a bit easier.

There shouldn't by any negative change in behaviour after this commit.

Remove redundant headers.

Reviewed by: hps@


# 200424 11-Dec-2009 scf

Fix libusb_open_device_with_vid_pid() to return a NULL if no device is
found instead of the last device in its search list.

Reviewed by: thompsa
MFC after: 5 days


# 199575 20-Nov-2009 thompsa

Sync to P4
- fix a transfer cancelling bug/segfault [1]
- correct a return code in the transfer cancel function.
- add new API function, libusb20_tr_bulk_intr_sync().

Submitted by: HPS
Reported by: Robert Jenssen [1]


# 199055 08-Nov-2009 thompsa

- fix refcounting error during data transfer
- fix a memory leak on the USB backend
- fix invalid pointer computations (in one case memory outside the allocated
area was written in LibUSB v1.0)
- make sure memory is always initialised, also in failing cases
- add missing functions from v1.0.4

PR: usb/140325
Reported by: Robert Jenssen
Submitted by: Hans Petter Selasky
MFC After: 3 days


# 195957 29-Jul-2009 alfred

LibUSB v1.0:

- Significantly improve libusb10 support.
- Many minor issues fixed.
- P4 ID: 166189, 165853, 165991, 166052, 166069

Submitted by: hps
Approved by: re


# 195560 10-Jul-2009 thompsa

Sync the libusb 1.0 exported api to the latest GSoC code.

- Fix possible uninitialised variables and null derefs
- Support big transfers
- Various bug fixes and style changes

Submitted by: Sylvestre Gallon
Sponsored by: Google Summer of Code 2009
Approved by: re (kib)


# 194676 22-Jun-2009 thompsa

Add files missed in r194674.

Add libusb 1.0 support which is compatible with the latest revision on
Sourceforge. Libusb 1.0 is a portable usb api released December 2008 and
supersedes the original libusb released 10 years ago, it supports isochronous
endpoints and asynchronous I/O. Many applications have already started using
the interfaces.

This has been developed as part of Google Summer of Code this year by Sylvestre
Gallon and has been cribbed early due to it being desirable in FreeBSD 8.0

Submitted by: Sylvestre Gallon
Sponsored by: Google Summer of Code 2009
Reviewed by: Hans Petter Selasky