Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #179765 > unrolled thread

where is usb.h?

Started byMark Copper <mlcopper@gmail.com>
First post2017-04-04 18:10 +0200
Last post2017-04-05 17:30 +0200
Articles 10 — 6 participants

Back to article view | Back to linux.debian.user


Contents

  where is usb.h? Mark Copper <mlcopper@gmail.com> - 2017-04-04 18:10 +0200
    Re: where is usb.h? Greg Wooledge <wooledg@eeg.ccf.org> - 2017-04-04 18:20 +0200
    Re: where is usb.h? "Thomas Schmitt" <scdbackup@gmx.net> - 2017-04-04 18:40 +0200
    Re: where is usb.h? songbird <songbird@anthive.com> - 2017-04-04 20:50 +0200
      Re: where is usb.h? Mark Copper <mcopper@straitcity.com> - 2017-04-04 21:40 +0200
        Re: where is usb.h? songbird <songbird@anthive.com> - 2017-04-04 21:40 +0200
          Re: where is usb.h? Mark Copper <mcopper@straitcity.com> - 2017-04-04 22:20 +0200
            Re: where is usb.h? songbird <songbird@anthive.com> - 2017-04-04 23:10 +0200
              Re: where is usb.h? Dominique Dumont <dod@debian.org> - 2017-04-05 09:50 +0200
                Re: where is usb.h? Mark Copper <mlcopper@gmail.com> - 2017-04-05 17:30 +0200

#179765 — where is usb.h?

FromMark Copper <mlcopper@gmail.com>
Date2017-04-04 18:10 +0200
Subjectwhere is usb.h?
Message-ID<tszbQ-78Z-25@gated-at.bofh.it>
Red-faced question:

There is a Perl package, libdevice-usb-perl, in which C code is
"inlined" (using Perl package libinline-c-perl). The first statement
of the inlined C code is
  #include <usb.h>

The query
   https://packages.debian.org/search?searchon=contents&keywords=usb.h
shows many results, even for the AMD arch needed.

Is one of these the included file? Or is it somewhere else?

Thank you.

[toc] | [next] | [standalone]


#179767

FromGreg Wooledge <wooledg@eeg.ccf.org>
Date2017-04-04 18:20 +0200
Message-ID<tszlw-7cC-29@gated-at.bofh.it>
In reply to#179765
On Tue, Apr 04, 2017 at 11:06:57AM -0500, Mark Copper wrote:
> There is a Perl package, libdevice-usb-perl, in which C code is
> "inlined" (using Perl package libinline-c-perl). The first statement
> of the inlined C code is
>   #include <usb.h>

Typically (but not always), C include files will be in a directory
named "include", so you can often include that in your search.

IRC: /msg judd file include/usb.h
judd: Search for include/usb.h in jessie/amd64: libusb-dev: usr/include/usb.h; [etc.]

[toc] | [prev] | [next] | [standalone]


#179769

From"Thomas Schmitt" <scdbackup@gmx.net>
Date2017-04-04 18:40 +0200
Message-ID<tszES-7l1-21@gated-at.bofh.it>
In reply to#179765
Hi,

Mark Copper
> There is a Perl package, libdevice-usb-perl, in which C code is
> "inlined" (using Perl package libinline-c-perl). The first statement
> of the inlined C code is
>   #include <usb.h>
> The query
>   https://packages.debian.org/search?searchon=contents&keywords=usb.h
> shows many results,

But not my first suspect:

  libusb-dev: /usr/include/usb.h

(One of the results of:
   apt-file search /usb.h
 This more narrow search finds it too:
   https://packages.debian.org/search?suite=jessie&section=all&arch=any&searchon=contents&keywords=include%2Fusb.h
)

Am i right that you mean
  https://sources.debian.net/src/libdevice-usb-perl/0.36-3/lib/Device/USB.pm/#L537
?
In line 13 of that file, there is mentioned '-lusb', which would be
the linker option to link with libusb. libusb-dev would be the package
with include files for libusb.


Have a nice day :)

Thomas

[toc] | [prev] | [next] | [standalone]


#179774

Fromsongbird <songbird@anthive.com>
Date2017-04-04 20:50 +0200
Message-ID<tsBGF-dZ-11@gated-at.bofh.it>
In reply to#179765
Mark Copper wrote:
> Red-faced question:
>
> There is a Perl package, libdevice-usb-perl, in which C code is
> "inlined" (using Perl package libinline-c-perl). The first statement
> of the inlined C code is
>   #include <usb.h>
>
> The query
>    https://packages.debian.org/search?searchon=contents&keywords=usb.h
> shows many results, even for the AMD arch needed.
>
> Is one of these the included file? Or is it somewhere else?
>
> Thank you.

  is it missing a build dependency or something?

  what does apt-get build-dep libinline-c-perl do?


  songbird

[toc] | [prev] | [next] | [standalone]


#179779

FromMark Copper <mcopper@straitcity.com>
Date2017-04-04 21:40 +0200
Message-ID<tsCt4-Mp-5@gated-at.bofh.it>
In reply to#179774
>
>   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.

Mark

[toc] | [prev] | [next] | [standalone]


#179781

Fromsongbird <songbird@anthive.com>
Date2017-04-04 21:40 +0200
Message-ID<tsCt4-Mp-11@gated-at.bofh.it>
In reply to#179779
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

  ?


  songbird

[toc] | [prev] | [next] | [standalone]


#179782

FromMark Copper <mcopper@straitcity.com>
Date2017-04-04 22:20 +0200
Message-ID<tsD5M-1gm-13@gated-at.bofh.it>
In reply to#179781
On Tue, Apr 4, 2017 at 2:36 PM, songbird <songbird@anthive.com> 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.

[toc] | [prev] | [next] | [standalone]


#179784

Fromsongbird <songbird@anthive.com>
Date2017-04-04 23:10 +0200
Message-ID<tsDSa-1Nf-25@gated-at.bofh.it>
In reply to#179782
Mark Copper wrote:
> On Tue, Apr 4, 2017 at 2:36 PM, songbird <songbird@anthive.com> 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.


hmm, in the docs i see:

===
       This module depends on the Carp, Inline and Inline::C modules, as well
       as the strict and warnings pragmas. Obviously, libusb must be available
       since that is the entire reason for the module's existence.
===

  but i don't see any references above to the Inline
or Inline::C so i'm not sure if that's the problem or
not?

  i'm not familiar enough with perl to otherwise
debug this.


  songbird

[toc] | [prev] | [next] | [standalone]


#179794

FromDominique Dumont <dod@debian.org>
Date2017-04-05 09:50 +0200
Message-ID<tsNRv-89c-7@gated-at.bofh.it>
In reply to#179784
On Tuesday, 4 April 2017 17:00:28 CEST songbird wrote:
> Can't locate object method "nNumInterfaces" via package
> 
> > "Device::USB::DevConfig" at ./read_usb.pl line 26, <DATA> line 1.

Looks like a typo in Device::USB::DevConfig synopsis: nNumInterfaces is referenced only there.

On the other hand bNumInterfaces is documented later in the man page and used in the test files:

$ ack bNumInterfaces
t/15-usb_dev_configuration.t
32:        qw/wTotalLength bNumInterfaces interfaces bConfigurationValue
48:        is( $cfg->bNumInterfaces(), scalar @{$cfg->interfaces()}, "$filename:$cfgno: interface count" );

USB.pm
918:    hashStoreInt( hash, "bNumInterfaces", cfg->bNumInterfaces );
924:        list_interfaces( cfg->interface, cfg->bNumInterfaces )

lib/Device/USB/DevConfig.pm
79:=item bNumInterfaces
123:_make_descr_accessor( 'bNumInterfaces' );

lib/Device/USB.pm
918:    hashStoreInt( hash, "bNumInterfaces", cfg->bNumInterfaces );
924:        list_interfaces( cfg->interface, cfg->bNumInterfaces )

Please log a bug upstream [1] for this issue

All the best

[1] https://rt.cpan.org/Dist/Display.html?Name=Device-USB
-- 
 https://github.com/dod38fr/   -o- http://search.cpan.org/~ddumont/
http://ddumont.wordpress.com/  -o-   irc: dod at irc.debian.org

[toc] | [prev] | [next] | [standalone]


#179812

FromMark Copper <mlcopper@gmail.com>
Date2017-04-05 17:30 +0200
Message-ID<tsV2G-4nq-7@gated-at.bofh.it>
In reply to#179794
On Wed, Apr 5, 2017 at 2:39 AM, Dominique Dumont <dod@debian.org> wrote:
> On Tuesday, 4 April 2017 17:00:28 CEST songbird wrote:
>> Can't locate object method "nNumInterfaces" via package
>>
>> > "Device::USB::DevConfig" at ./read_usb.pl line 26, <DATA> line 1.
>
> Looks like a typo in Device::USB::DevConfig synopsis: nNumInterfaces is referenced only there.
>
> On the other hand bNumInterfaces is documented later in the man page and used in the test files:
>
> $ ack bNumInterfaces
> t/15-usb_dev_configuration.t
> 32:        qw/wTotalLength bNumInterfaces interfaces bConfigurationValue
> 48:        is( $cfg->bNumInterfaces(), scalar @{$cfg->interfaces()}, "$filename:$cfgno: interface count" );
>
> USB.pm
> 918:    hashStoreInt( hash, "bNumInterfaces", cfg->bNumInterfaces );
> 924:        list_interfaces( cfg->interface, cfg->bNumInterfaces )
>
> lib/Device/USB/DevConfig.pm
> 79:=item bNumInterfaces
> 123:_make_descr_accessor( 'bNumInterfaces' );
>
> lib/Device/USB.pm
> 918:    hashStoreInt( hash, "bNumInterfaces", cfg->bNumInterfaces );
> 924:        list_interfaces( cfg->interface, cfg->bNumInterfaces )
>
> Please log a bug upstream [1] for this issue
>
> All the best
>
> [1] https://rt.cpan.org/Dist/Display.html?Name=Device-USB

Yeah, it looks as if that module was never really more than proof of
concept and suggests a road map
   device --> hidapi --> scripting glue (e.g. Perl XS) --> HTTP server

Mark

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web