libusb-1.0 enters beta
I’ve been making good progress on libusb-1.0, which has now entered beta. Features over libusb-0.1 include:
- Asynchronous transfer capabilities (in addition to the synchronous style presented by v0.1)
- Support for transfers to isochronous endpoints
- Significantly faster bulk transfer performance for large transfers (several kilobytes or more)
- Detailed API documentation
- Power saving: on systems running recent Linux kernels, libusb-1.0 does not wake up all the USB devices plugged into the system during device enumeration
- Greatly reduced CPU usage while waiting for results of bulk/interrupt transfers (libusb-0.1 was waking up every 1ms)
- Thread safety
As noted on the homepage, libusb-1.0 is entirely incompatible with libusb-0.1. However, it is designed to install in parallel, in the same way that you can have GTK+ 1.2 and GTK+ 2.x installed on the same system and in use at the same time.
I have also produced a compatibility layer which replaces libusb-0.1. libusb-compat-0.1 looks and smells exactly the same as libusb-0.1 (same library name, API, header file, etc) but internally it just converts libusb-0.1 calls to libusb-1.0.
This means that existing libusb-0.1 applications can take advantage of some of the new libusb-1.0 hotness mentioned above: improved bulk I/O performance, decreased CPU usage, power saving. These improvements appear without any modification to the original application, provided that the user has uninstalled libusb-0.1, and installed libusb-1.0 plus libusb-compat-0.1.
I’m hoping this release will result in:
- More testing and adoption
- API review and feedback
- Ports to other operating systems. Only Linux is supported at the moment, but the library is structured internally for other ports to be written, and the internal API is documented in the source.
Further API changes may happen as a result of the above. This is not a finished product.