libusb, use Device::USB; works only as user root?

G

georg.heiss

Hi, why does the attached Script only works as user root?

running as user root i get:
root@siduxbox:/home/gh# perl usb.pl
Device: 1781:0A98
Manufactured by raphnet.net
Product: USBTenki


running as default user i get a empty result set:
gh@siduxbox:~$ perl usb.pl
Device: 1781:0A98
Manufactured by
Product:

Kind Regards
Georg

use Device::USB;
my $Vendor= '1781';
my $Product= '0a98';
my $intVendor = unpack("n", pack("H4", $Vendor)); #hex2int
my $intProduct = unpack("n", pack("H4", $Product)); #hex2int
#print "$intProduct\n";

my $usb = Device::USB->new();
my @devices = $usb->list_devices_if( sub { Device::USB::CLASS_HUB ==
$_->bDeviceClass() } );
#print "@devices\n";

my $dev = $usb->find_device( $intVendor, $intProduct );
printf "Device: %04X:%04X\n", $dev->idVendor(), $dev->idProduct();
$dev->open();
print "Manufactured by ", $dev->manufacturer(), "\n",
" Product: ", $dev->product(), "\n";
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top