#!/usr/bin/perl

# Example Perl code to read ports on U421 USB interface card
# Andrew Daviel advax [at] triumf.ca November 2012

# Updated version of this code may be found at http://andrew.daviel.org/usbmicro
# Or not.

$VENDOR = 0x0DE7 ; 
$PRODUCT = 0x01A5 ; #  U421

use Device::USB;
my $usb = Device::USB->new();
my $dev = $usb->find_device( $VENDOR, $PRODUCT );
printf "Device: %04X:%04X\n", $dev->idVendor(), $dev->idProduct();
print "MaxPower: $dev->{config}[0]{MaxPower}\n" ;
exit ;

my @devices = $usb->list_devices ;
foreach $dev (@devices) {
  printf "Device: %04X:%04X\n", $dev->idVendor(), $dev->idProduct();
#  if writable ..
#  $dev->open();
#  print "  Manufactured by ", $dev->manufacturer()," Product: ", $dev->product(), "\n";
  #$dev->close() ;
}

exit ;

