Web lists-archives.com

Re: where is usb.h?




On Tue, Apr 4, 2017 at 2:36 PM, songbird <songbird@xxxxxxxxxxx> wrote:
> Mark Copper wrote:
>>>
>>>   is it missing a build dependency or something?
>>>
>>>   what does apt-get build-dep libinline-c-perl do?
>>>
>>
>>
>> The following NEW packages will be installed:
>>   libfile-sharedir-install-perl libio-all-perl libspiffy-perl
>>   libsub-uplevel-perl libtest-warn-perl
>>
>> I wasn't expecting that.
>>
>> The package libdevice-usb-perl seemed to install without difficulty.
>> It works in the sense that the main constructor functions, but other
>> things don't work.  I know it's old code but I just need to read a
>> number from an interrupt endpoint so I was just trying chase down
>> whether it was an easy-to-fix problem.
>
>   remember that installing a package for use
> is different than installing a package for
> building.
>
>   did you try the same command for libdevice-usb-perl?
>
>   aka:
>
> apt-get build-dep libdevice-usb-perl
>
>   ?

Nothing at all there.  I'm thinking it must be something simple.  This
test produces the output below which made me think not all the C code
was getting read in properly.

#!/usr/bin/perl

use warnings;
use strict;
use Device::USB;
use Carp;
use Data::Dumper;
$Data::Dumper::Indent = 1;

my $data;
my $VENDOR=0x0b67;
my $PRODUCT=0x555e;
my $usb = Device::USB->new();
my $dev = $usb->find_device( $VENDOR, $PRODUCT );
croak "Device not found.\n" unless defined $dev;
print "Device found: ", $dev->filename(), ": ";
printf "Device: %04X:%04X\n", $dev->idVendor(), $dev->idProduct();
if($dev->open())
    {
        print "\t", $dev->manufacturer(), ": ", $dev->product(), "\n";
        print Dumper( $dev );
    }
print "Bytes read: " . $dev->interrupt_read(129, $data, 64, 1000) . "\n";
print "Data read: " . $data . "\n";
my $cfg = $dev->config()->[0];
print "Config:", $cfg->iConfiguration(), ": interface count: ",
$cfg->nNumInterfaces(), "\n";
__END__


Output:
Use of uninitialized value in concatenation (.) or string at
/usr/lib/x86_64-linux-gnu/perl5/5.20/Device/USB.pm line 10.
Use of uninitialized value in concatenation (.) or string at
/usr/lib/x86_64-linux-gnu/perl5/5.20/Device/USB.pm line 10.
Use of uninitialized value in concatenation (.) or string at
/usr/lib/x86_64-linux-gnu/perl5/5.20/Device/USB.pm line 10.
Device found: 003: Device: 0B67:555E
    :
$VAR1 = bless( {
  'descriptor' => {
    'idVendor' => 2919,
    'iProduct' => 2,
    'bcdDevice' => '0.04',
    'bcdUSB' => '1.10',
    'idProduct' => 21854,
    'bDeviceSubClass' => 0,
    'iSerialNumber' => 3,
    'bNumConfigurations' => 1,
    'bDeviceProtocol' => 0,
    'bMaxPacketSize0' => 64,
    'iManufacturer' => 1,
    'bDescriptorType' => 1,
    'bDeviceClass' => 0
  },
  'config' => [
    bless( {
      'bConfigurationValue' => 1,
      'bNumInterfaces' => 1,
      'MaxPower' => 100,
      'bmAttributes' => 128,
      'wTotalLength' => 41,
      'interfaces' => [
        [
          bless( {
            'bAlternateSetting' => 0,
            'endpoints' => [
              bless( {
                'bDescriptorType' => 5,
                'bSynchAddress' => 0,
                'bRefresh' => 0,
                'wMaxPacketSize' => 6,
                'bEndpointAddress' => 129,
                'bInterval' => 50,
                'bmAttributes' => 3
              }, 'Device::USB::DevEndpoint' ),
              bless( {
                'bmAttributes' => 3,
                'bInterval' => 100,
                'bEndpointAddress' => 2,
                'bSynchAddress' => 0,
                'wMaxPacketSize' => 14,
                'bRefresh' => 0,
                'bDescriptorType' => 5
              }, 'Device::USB::DevEndpoint' )
            ],
            'bInterfaceNumber' => 0,
            'bInterfaceSubClass' => 141,
            'bNumEndpoints' => 2,
            'bInterfaceClass' => 3,
            'bDescriptorType' => 4,
            'bInterfaceProtocol' => 141,
            'iInterface' => 0
          }, 'Device::USB::DevInterface' )
        ]
      ],
      'bDescriptorType' => 2,
      'iConfiguration' => 4
    }, 'Device::USB::DevConfig' )
  ],
  'handle' => 16283552,
  'device' => 21499456,
  'filename' => '003'
}, 'Device::USB::Device' );
Bytes read: -2
Data read:
Can't locate object method "nNumInterfaces" via package
"Device::USB::DevConfig" at ./read_usb.pl line 26, <DATA> line 1.