File: lsusb.pl

package info (click to toggle)
libusb-libusb-perl 0.09-3
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 396 kB
  • sloc: perl: 727; makefile: 3
file content (22 lines) | stat: -rwxr-xr-x 532 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env perl
use warnings;
use strict;
use 5.010;

use blib;
use USB::LibUSB;

my $ctx = USB::LibUSB->init();
my @devices = $ctx->get_device_list();

for my $dev (@devices) {
    my $bus_number = $dev->get_bus_number();
    my $device_address = $dev->get_device_address();
    my $desc = $dev->get_device_descriptor();
    my $idVendor = $desc->{idVendor};
    my $idProduct = $desc->{idProduct};
    
    printf("Bus %03d Device %03d: ID %04x:%04x\n", $bus_number,
           $device_address, $idVendor, $idProduct);
}