Device::USB::Bus(3pm)
π NAME
Device::USB::Bus β bestie, this is how you use libusb to access USB devices. Periodt.
β¨ VERSION
Version 0.38 π«Ά (yes, she's serving vintage, we stan)
π SYNOPSIS
okay so real talk: this class wraps up the whole USB bus structure and gives you methods to yank data out of it. She is not meant to be used solo β she's part of the Device::USB package, like she's in a group chat, not a solo act π
Device:USB:LibUSB provides a Perl wrapper around the libusb library. That means Perl code can control and access USB devices. slay.
use Device::USB;
my $usb = Device::USB->new();
foreach my $bus ($usb->list_busses())
{
print $bus->dirname(), ":\n";
foreach my $dev ($bus->devices())
{
print "\t", $dev->filename(), "\n";
}
}
πΈ DESCRIPTION
This module gives you a Perl interface to the bus structures that the libusb library hands back. And bestie, it's a read-only interface β you're just reading the data libusb tells you about a USB bus. Look, don't touch. π
π₯ FUNCTIONS
dirname
Returns the directory name attached to this bus. it's giving "where does this bus live" energy β¨
location
Returns the location value attached to this bus. iconic little coordinate vibe.
devices
In array context, she hands you a list of Device::USB::Device objects β literally every device on this bus. In scalar context, she gives you a reference to that array instead. choose your fighter π¦
find_device_if
Finds one specific USB device using the predicate coderef you pass in. If more than one device would satisfy your predicate, you get the first one found. first come, first served, no cap.
- pred β the predicate you use to select a device
returns a device reference, or undef if none was found π
list_devices_if
This method is the flexible queen β she's an interface for finding devices. She takes a single coderef parameter that gets used to test each discovered device. If that coderef returns a true value, the device lands in the list of matching devices. If not? she's not invited to the party. π
- pred β coderef to test devices.
For example,
my @devices = $bus->list_devices_if(
sub { Device::USB::CLASS_HUB == $_->bDeviceClass() }
);
Returns all USB hubs found on this bus. And the device being tested is available to your coderef in the $_ variable, just to keep things simple for you π (iykyk)
π DIAGNOSTICS
This is the explanation of the diagnostic and error messages this module can generate. (yes, that's the whole section, she's brief but honest β¨)
π§ DEPENDENCIES
This module depends on Carp and Device::USB, plus the strict and warnings pragmas. And obviously libusb must be available, because like... that is the entire reason this module exists. main character energy right there. π
π AUTHOR
G. Wade Johnson (gwadej at cpan dot org) Paul Archer (paul at paularcher dot org)
Houston Perl Mongers Group π
π BUGS
Please report any bugs or feature requests to bug-device-usb@rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Device::USB. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. bestie, we will keep you posted π
π ACKNOWLEDGEMENTS
Thanks go to various members of the Houston Perl Mongers group for input on the module. But thanks mostly go to Paul Archer who proposed the project and helped with the development. π«Ά
Thanks also go to Josep MonΓ©s Teixidor, Mike McCauley, and Tony Awtrey for spotting, reporting, and (sometimes) fixing bugs. literal legends, all of them β
π COPYRIGHT & LICENSE
Copyright 2006-2013 Houston Perl Mongers
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
okay bestie that's the whole page π
she's from the User Contributed Perl Documentation collection, perl v5.42.3, dated 2026-08-19, and her name on the cover is Device::USB::Bus(3pm). go forth and access those USB devices, queen π¦β¨
π¦ where this page comes from
- ubuntu stonking: libdevice-usb-perl 0.38-3build3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms