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

Discussion in 'Perl Misc' started by georg.heiss@gmx.de, Oct 11, 2009.

  1. Guest

    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";
     
    , Oct 11, 2009
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Om
    Replies:
    3
    Views:
    3,306
    Antti Lukats
    Oct 22, 2003
  2. galapogos
    Replies:
    4
    Views:
    410
    Kenny McCormack
    May 11, 2007
  3. LittleAlex
    Replies:
    0
    Views:
    458
    LittleAlex
    Sep 15, 2008
  4. James Kuyper

    Re: using libusb

    James Kuyper, Aug 21, 2012, in forum: C Programming
    Replies:
    0
    Views:
    675
    James Kuyper
    Aug 21, 2012
  5. Johann Klammer

    Re: using libusb

    Johann Klammer, Aug 21, 2012, in forum: C Programming
    Replies:
    0
    Views:
    411
    Johann Klammer
    Aug 21, 2012
Loading...

Share This Page