Udev::FFI::Enumerate
use Udev::FFI; my $udev = Udev::FFI->new() or die("Can't create Udev::FFI object: $@"); my $enumerate = $udev->new_enumerate() or die("Can't create enumerate context: $@"); $enumerate->add_match_subsystem('usb'); $enumerate->add_match_sysattr('idVendor'); # devices with VID $enumerate->scan_devices(); my @devices = $enumerate->get_list_entries(); for (@devices) { my $device = $udev->new_device_from_syspath($_); if (defined $device) { print "DEVICE: ".$device->get_sysname()."\n"; print "VID: ".$device->get_sysattr_value('idVendor')."\n"; print "PID: ".$device->get_sysattr_value('idProduct')."\n\n"; } }
Udev::FFI main Udev::FFI documentation
To install Udev::FFI, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Udev::FFI
CPAN shell
perl -MCPAN -e shell install Udev::FFI
For more information on module installation, please visit the detailed CPAN module installation guide.