wiki:libusb-1.0

Version 29 (modified by xiaofan, 2 years ago) (diff)

Add btstack and madwimaz

libusb-1.0

libusb-1.0 is an almost-rewrite of the previous stable branch, libusb-0.1. It is a lightweight library that can be efficiently integrated into applications of any kind, with several new features.

libusb-1.0 development is being lead by Daniel Drake and Peter Stuge. Contributions encouraged!

Down is the new up

Confusingly, another development branch of libusb was created a while ago, also named libusb-1.0. This branch never reached maturity and will not be developed further, although it was forked to form the OpenUSB project. The library you are reading about here can be viewed as a completely different implementation.

Status

The library is complete. New releases will primarily be for bug-fixes. Internal cleanups/improvements and new features (API additions, but not modifications) will be implemented in libusb-1.1?.

Download

Documentation

doxygen comments are present in the source and the generated HTML documentation can be found at http://libusb.sourceforge.net/api-1.0/

Feedback is appreciated.

Development

Development happens in a git repository: git://git.libusb.org/libusb.git (gitweb interface)

For those not familiar with git, here are the git commands you can use retrieve and compile libusb-1.0:

git clone git://git.libusb.org/libusb.git ; retrieve development branch (this only needs to be done once)
git pull                                  ; keep in sync with the remote tree

On Windows, if you don't want to use git on the commandline, you can use TortoiseGit to access and keep in sync with the git repository.
Note that before you can install TortoiseGit you need to install MSysGit and make sure that, during the installation of MSysGit, when prompted to adjust the PATH environment, you select "Run Git from the Windows Command Prompt" (2nd option). Also, in the general settings of TortoiseGit, the MSysGit path must point to the MSysGit bin directory (eg: C:Program Files (x86)Gitin").

Contributions encouraged - please either email patches to the libusb-devel mailing list, or publish your git tree somewhere and email a pull request to the mailing list.

Open Source Projects using libusb-1.0

Bindings for other languages

Portability

libusb-1.0 includes a platform abstraction layer allowing for cross-platform compatibility. Linux and Darwin (Mac OS X) are supported in the latest release. Windows support is coming soon in the official release (in git as of August 2010).

FreeBSD 8 and above include a FreeBSD-specific reimplementation of the libusb-1.0 API, so your applications will probably work there too. The source code for this library can be found here.

If you are interested in porting to other platforms, the PORTING file tells you where to start. We are more than happy to help out here, please write to the mailing list with your questions and feedback.

Backwards compatibility

libusb-1.0 is not backwards compatible with libusb-0.1 - all function names are different, etc. However, libusb-1.0 is designed to be happily installable alongside libusb-0.1 (even in the default configuration) so the lack of backwards compatibility is not really a problem - users can have both libusb versions present on the same system without conflict.

That said, there is a libusb-compat-0.1 compatibility layer. This is a "wrapper" which converts libusb-0.1 function calls to their 1.0 equivalents. For more info, see libusb-compat-0.1.

Mailing list

The libusb-devel mailing list exists for both users of the library, plus developers interested in contributing to the library itself.


Comparisons with other USB libraries

libusb-0.1

libusb-0.1 is the very popular predecessor of this project.

Advantages compared to libusb-1.0

  • Portable to a larger number of operating systems
  • Widespread adoption

Disadvantages compared to libusb-1.0

  • Does not provide isochronous endpoint I/O
  • Does not provide asynchronous I/O
  • Not being developed further

OpenUSB

OpenUSB is a fork of a never-released development branch of libusb, confusingly also named libusb-1.0.

Advantages compared to libusb-1.0

  • OpenUSB is working on Solaris whereas libusb-1.0 does not support Solaris now. Take note: both libusb-1.0 and OpenUSB have support of Linux and Mac OS X.
  • Support hotplug (using HAL and DBUS under Linux)

Disadvantages compared to libusb-1.0

  • Does not expose pollable file descriptors (and it would not be realistic to offer this functionality without a lot of rework)
  • Creates a number of internal threads for each process that uses it
  • In Daniel Drake's opinion, more complex than it needs to be (largely due to the complexity of threading)
  • No work is being done yet for Windows support