February 2019 Archives

USB::LibUSB 0.06 released

libusb is a highly portable library providing generic access to USB devices. USB::LibUSB was newly written in 2017 to provide Perl bindings to the libusb-1.0 API. It replaces the deprecated module Device::USB, which targeted the older and incompatible libusb-0.1 API.

This release of USB::LibUSB fixes a bug in the config descriptor data structure. Before the fix, only the first interface of a given configuration was represented. Now, the "interface" element of the config descriptor hash holds an array of interfaces, each of which consists of an array of alternate settings. Typically each interface has only one alternate setting:

my $config = $dev->get_active_config_descriptor(); 
my @interfaces = @{$config->{interface}};
# Get first alternate setting of first interface
my $first_interface = $interfaces[0]->[0];

Many thanks to Mike Ferrara who spotted the issue when porting code from Device::USB to USB::LibUSB.

About simon reinhardt

user-pic I use Perl for experimental physics. PhD student at Institute for experimental and applied physics, Uni Regensburg.