Quantcast

libusb 1.0, hidapi compilation/setup problem

classic Classic list List threaded Threaded
28 messages Options
12
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

libusb 1.0, hidapi compilation/setup problem

Cuber
I originally was using the old version of libusb to try to read information from a HID device. I was having problems and took advice of those who helped in my last thread I switched to libusb1.0 and am now also using hidapi, but i'm unalbe to get it to compile in my application.

For my application, I put the test program's code in my file to start, and then put the hid-libusb.c file in the same directory. I made sure after following the readme instructions for both that all the files are in the right places. My project has its own include and lib directories so I copied all the libusb-1.0* files to  /usr/MyProgram/lib  and put the libusb.h and hidapi.h files in /usr/MyProgram/include.

When I compile I get errors such as:

error: forward declaration of ‘struct hid_device_info’
error: invalid use of undefined type ‘struct hid_device_info’

and/or (depending on how I compile)

hid-libusb.c:(.text+0x513): undefined reference to `libusb_get_device_list'
hid-libusb.c:(.text+0x551): undefined reference to `libusb_get_device_descriptor'

I'm trying different ways of compiling it like using scons or a makefiles. the line I last tried was :
gcc -o myprogram{,.cpp} hid-libusb.c -L/usr/MyProgram/lib -lusb -I/usr/MyProgram/include

I'm not sure if this is just the compile script problem (since i'm inexperienced with them), or something I missed in installing/setup of libusb or hidapi. or I'm missing some files in certain places. Any help or suggestions would be very appreciated since i'm not sure what to try.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: libusb 1.0, hidapi compilation/setup problem

Alan Ott
On 10/24/2011 04:37 PM, cuber wrote:

> I originally was using the old version of libusb to try to read information
> from a HID device. I was having problems and took advice of those who helped
> in my last thread I switched to libusb1.0 and am now also using hidapi, but
> i'm unalbe to get it to compile in my application.
>
> For my application, I put the test program's code in my file to start, and
> then put the hid-libusb.c file in the same directory. I made sure after
> following the readme instructions for both that all the files are in the
> right places. My project has its own include and lib directories so I copied
> all the libusb-1.0* files to  /usr/MyProgram/lib  and put the libusb.h and
> hidapi.h files in /usr/MyProgram/include.
>

Don't put libusb files in your project. Libusb should be installed for
the entire system, either using your distribution's package manager, or
by using ./configure && make && make install from the libusb sources.

> When I compile I get errors such as:
>
> error: forward declaration of ‘struct hid_device_info’
> error: invalid use of undefined type ‘struct hid_device_info’
>
> and/or (depending on how I compile)
>
> hid-libusb.c:(.text+0x513): undefined reference to `libusb_get_device_list'
> hid-libusb.c:(.text+0x551): undefined reference to
> `libusb_get_device_descriptor'
>

Do the hidapi example programs compile for you? In hidapi, cd to linux/
and type 'make'.

If that doesn't work, send me the output. If it does, see if you can
find out what's different between your project and the Makefile I have
included. The Makefiles for HIDAPI are intentionally simple.

> I'm trying different ways of compiling it like using scons or a makefiles.
> the line I last tried was :
> gcc -o myprogram{,.cpp} hid-libusb.c -L/usr/MyProgram/lib -lusb
> -I/usr/MyProgram/include

Building multiple source files in a single command like this can be
tricky, as you have to get everything in the right dependency order.
You're using gcc though instead of g++ which won't work since your test
program is C++. Further, hid-libusb.c is of course a C file, which will
not compile as C++.

Alan.


------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn
about Cisco certifications, training, and career opportunities.
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Libusb-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusb-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: libusb 1.0, hidapi compilation/setup problem

Cuber
thanks Alan,

i did the ./configure, make and make install for libusb. I only copied the lib files over after that so that it could work independently.

running make in the /linux folder of hidapi works once i define the PKG_CONFIG_PATH evn variable and remove the udev library flag in the makefile. I can post the output tomorrow morning with udev if that's helpful, but the install/readme seemed to indicate that udev was only used for hidraw? I've tried copying the makefile that works over and adding my source file to it but it didn't work, but maybe I made an error.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: libusb 1.0, hidapi compilation/setup problem

Cuber
just to update.

So I cleaned everything, re-configured and installed libusb and hidapi. I again removed libudev to get the test program to work and then copied just the makefile and hid-libusb.c to my source folder and I got my application to compile with some minor modifications. ( I guess the issue was using my local copies of the lib/include files?). The  call to hid_exit caused a compilation error for some reason (after being okay with all the other hid function calls). If i commented it out it compiles and runs. Although I'm now getting permission errors (needs write access) when running it so I can't open the device(running as root gives a different error with libusb?).

Thanks for all of your help
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: libusb 1.0, hidapi compilation/setup problem

Alan Ott
In reply to this post by Cuber
On 10/24/2011 11:15 PM, cuber wrote:
> thanks Alan,
>
> i did the ./configure, make and make install for libusb.

Good. Is there a reason you built from source instead of using the one
that comes from your distro's package manager? On my (old) Ubuntu:
    sudo apt-get install libusb-1.0-0-dev
(use tab completion to make sure you get it right for your system)

>  I only copied the
> lib files over after that so that it could work independently.
>

Stop doing that. Use libusb library that's part of the system. If you
really want to do something else (like static linking), do that later
once you've gotten it to work the normal way.

> running make in the /linux folder of hidapi works once i define the
> PKG_CONFIG_PATH evn variable

If you install libusb to /usr/local/ then you have to add that to the
PKG_CONFIG_PATH on a lot of systems. If you use the one from the package
manager (which goes typically into /usr/) then you won't.

>  and remove the udev library flag in the
> makefile. I can post the output tomorrow morning with udev if that's
> helpful, but the install/readme seemed to indicate that udev was only used
> for hidraw?

That's true, you can take it out for hidapi/libusb. It's only used for
the hidraw implementation.

>  I've tried copying the makefile that works over and adding my
> source file to it but it didn't work, but maybe I made an error.

Likely. Please provide info on the distro, info on where you put your
sources, your modified Makefile, and the output.

Alan.


------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn
about Cisco certifications, training, and career opportunities.
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Libusb-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusb-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: libusb 1.0, hidapi compilation/setup problem

Alan Ott
In reply to this post by Cuber
On 10/25/2011 12:07 PM, cuber wrote:
> just to update.
>
> So I cleaned everything, re-configured and installed libusb and hidapi. I
> again removed libudev to get the test program to work and then copied just
> the makefile and hid-libusb.c to my source folder and I got my application
> to compile with some minor modifications. ( I guess the issue was using my
> local copies of the lib/include files?). The  call to hid_exit caused a
> compilation error for some reason (after being okay with all the other hid
> function calls).

Compiler or linker error? Can you send some output? Make sure to use the
latest HIDAPI git:
    git clone git://github.com/signal11/hidapi.git


>  If i commented it out it compiles and runs. Although I'm
> now getting permission errors (needs write access) when running it so I
> can't open the device(running as root gives a different error with libusb?).

Your USB devices don't have permissions set to be opened by normal users
by default. You need a udev rule to specify this. Here's one I used for
the X-Keys devices. Put it in your /etc/udev/rules.d/ :
    https://github.com/piengineering/xkeys/blob/master/udev/90-xkeys.rules

Modify the VID, and you can add an idProduct field for the PID if you so
desire.

Alan.


------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn
about Cisco certifications, training, and career opportunities.
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Libusb-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusb-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: libusb 1.0, hidapi compilation/setup problem

Alan Ott
On 10/25/2011 12:25 PM, Alan Ott wrote:
> On 10/25/2011 12:07 PM, cuber wrote:
>
>>  If i commented it out it compiles and runs. Although I'm
>> now getting permission errors (needs write access) when running it so I
>> can't open the device(running as root gives a different error with libusb?).
>

I just pushed an update which contains a sample udev file (udev/
directory) for both hidraw- and libusb- based HIDAPI implementations.
Check that out and see especially if the comments in it can help you get
the permissions right.

Alan.


------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn
about Cisco certifications, training, and career opportunities.
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Libusb-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusb-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: libusb 1.0, hidapi compilation/setup problem

Cuber
In reply to this post by Alan Ott
here's the output when running make in my application:
cc -Wall -g -c -I../hidapi/ `pkg-config libusb-1.0 --cflags` hid-libusb.c -o hid-libusb.o
g++ -Wall -g -c -I../hidapi/ `pkg-config libusb-1.0 --cflags` test.cpp -o test.o
test.cpp: In function ‘int main(int, char**)’:
test.cpp:367: error: ‘hid_exit’ was not declared in this scope
make: *** [test.o] Error 1


i'm still getting these outputs after putting the udev rule:
libusb couldn't open USB device /dev/bus/usb/007/002: Permission denied.
libusb requires write access to USB device nodes.
libusb couldn't open USB device /dev/bus/usb/008/002: Permission denied.
libusb requires write access to USB device nodes.
libusb couldn't open USB device /dev/bus/usb/008/003: Permission denied.
libusb requires write access to USB device nodes.
Device Found
  type: 1f69 0001
  path: 0007:0002:00
  serial_number: (null)
  Manufacturer: (null)
  Product:      (null)
  Release:      1
  Interface:    0

...

and just to verify, the rule I put in /etc/udev/rules.d/ as the same name:
# X-Keys
SUBSYSTEM=="usb", ATTRS{idVendor}=="1f69", MODE="0666"


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: libusb 1.0, hidapi compilation/setup problem

Cuber
I just saw your last post. i'll update.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: libusb 1.0, hidapi compilation/setup problem

Cuber
I followed the comments in the hid.rules file but still had the same problems. but I just changed SUBSYSTEM=="usb" to "usb_device" and it was able to open my device:

libusb couldn't open USB device /dev/bus/usb/008/002: Permission denied.
libusb requires write access to USB device nodes.
libusb couldn't open USB device /dev/bus/usb/008/003: Permission denied.
libusb requires write access to USB device nodes.
Device Found
. . .

Unable to get a feature report.
(null)Unable to write() (2)
Data read:
   00 4b

i've yet to see if those permission denied messages/ feature report are a problem but it's progress for now!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: libusb 1.0, hidapi compilation/setup problem

Alan Ott
On 10/25/2011 05:48 PM, cuber wrote:
> I followed the comments in the hid.rules file but still had the same
> problems. but I just changed SUBSYSTEM=="usb" to "usb_device" and it was
> able to open my device:
>

I seem to remember having to do the opposite at some point, like it
changed for some udev version. Does anyone know what the root cause of
this is, or the reason for the change?

Cuber, what distro are you running and what version?

> libusb couldn't open USB device /dev/bus/usb/008/002: Permission denied.
> libusb requires write access to USB device nodes.
> libusb couldn't open USB device /dev/bus/usb/008/003: Permission denied.
> libusb requires write access to USB device nodes.
> Device Found
> . . .
>
> Unable to get a feature report.
> (null)Unable to write() (2)
> Data read:
>    00 4b
>
> i've yet to see if those permission denied messages/ feature report are a
> problem but it's progress for now!

Are you sure your device supports feature reports, or did you just
copy/paste from the example? Not all devices support every type of report.

Alan.


------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn
about Cisco certifications, training, and career opportunities.
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Libusb-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusb-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: libusb 1.0, hidapi compilation/setup problem

Chuck Cook
In reply to this post by Cuber
http://forums.fedoraforum.org/showthread.php?t=256061

If it is a udev problem, this fix should solve the problem.


Charles Cook PhD (owner)
Florida Midland LLC
Longwood, FL


On 10/25/2011 05:48 PM, cuber wrote:
I followed the comments in the hid.rules file but still had the same
problems. but I just changed SUBSYSTEM=="usb" to "usb_device" and it was
able to open my device:

libusb couldn't open USB device /dev/bus/usb/008/002: Permission denied.
libusb requires write access to USB device nodes.
libusb couldn't open USB device /dev/bus/usb/008/003: Permission denied.
libusb requires write access to USB device nodes.
Device Found
. . .

Unable to get a feature report.
(null)Unable to write() (2)
Data read:
   00 4b 

i've yet to see if those permission denied messages/ feature report are a
problem but it's progress for now!

--
View this message in context: http://libusb.6.n5.nabble.com/libusb-1-0-hidapi-compilation-setup-problem-tp4934073p4937901.html
Sent from the LibUSB Dev mailing list archive at Nabble.com.

------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn 
about Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Libusb-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusb-devel


------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn
about Cisco certifications, training, and career opportunities.
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Libusb-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusb-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

OT HID advice sought

Kustaa Nyholm-2
Sorry for the OT intrusion, but since I know many people well versed in
HID
hang around this list and I'm a member of this list I thought I'd try and
take advantage of it.

I'm working with an third party, that has a simple composite device with
some buttons and functions and we are co-operating in specifying the
requirements for the firmware.

Any solution that requires installation of any kind on the host
(Windows/Mac)
side is out of the question.

Sorry can't be more explicit here.

The problem is that neither party is an expert on USB.

Anyway the device is going to represent itself as a HID keyboard and the
buttons

on the device will be treated as key presses on a keyboard (ALT -
something).

The question is how to best control the functions on the device through
the HID interface. These are simple on/off functions with very infrequent
state changes.

Something like what is used to control the NUMLOCK-etc LEDs on
the keyboard comes to mind, but obviously can't use exactly those.

So I'm looking for ideas/pointers what would be the simplest way to
accomplish
this and which would not cause 'compatibility' issues with the way host OS
handles keyboards.

Can I, for example,simply define an output report to control those
functions?

What else is involved?

br Kusti


------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn
about Cisco certifications, training, and career opportunities.
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Libusb-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusb-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: OT HID advice sought

Xiaofan Chen
On Wed, Oct 26, 2011 at 4:08 PM, Kustaa Nyholm
<[hidden email]> wrote:
> I'm working with an third party, that has a simple composite device with
> some buttons and functions and we are co-operating in specifying the
> requirements for the firmware.
>
> Any solution that requires installation of any kind on the host
> (Windows/Mac) side is out of the question.

What does this means? No kernel driver, right? Is some user
space program (using HIDAPI) okay?

> Sorry can't be more explicit here.
>
> The problem is that neither party is an expert on USB.
>
> Anyway the device is going to represent itself as a HID keyboard and the
> buttons
>
> on the device will be treated as key presses on a keyboard (ALT -
> something).

Why? This is not clear at all.

> The question is how to best control the functions on the device through
> the HID interface. These are simple on/off functions with very infrequent
> state changes.
>
> Something like what is used to control the NUMLOCK-etc LEDs on
> the keyboard comes to mind, but obviously can't use exactly those.

I believe those things are control-out transfer.

> So I'm looking for ideas/pointers what would be the simplest way to
> accomplish  this and which would not cause 'compatibility' issues
> with the way host OS handles keyboards.
>
> Can I, for example,simply define an output report to control those
> functions?
>
> What else is involved?
>

Your requirement is not clear. So I am just guessing here.

A USB composite device.
1st interface: keyboard interface, OS keyboard driver to handles this,
for your keyboard function.

2nd interface: generic HID interface for the ON/OFF function,
HIDAPI based program to handle this. You can use Feature Report
(control transfer) or Output report (control transfer and interrupt
transfer) for these functions.

--
Xiaofan

------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn
about Cisco certifications, training, and career opportunities.
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Libusb-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusb-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: OT HID advice sought

Kustaa Nyholm-2
On 10/26/11 11:29, "Xiaofan Chen" <[hidden email]> wrote:
>What does this means? No kernel driver, right? Is some user
>space program (using HIDAPI) okay?

Exactly: no drivers but HIDAPI is okay.

>
>>Sorry can't be more explicit here.
>>
>>The problem is that neither party is an expert on USB.
>>
>>Anyway the device is going to represent itself as a HID keyboard and the
>>buttons
>>
>>on the device will be treated as key presses on a keyboard (ALT -
>>something).
>
>Why? This is not clear at all.

We are not the only one who will be interfacing with this device
and some of the Nth parties are barely able to respond to key
presses, let alone use HIDAPI....

>
>>The question is how to best control the functions on the device through
>>the HID interface. These are simple on/off functions with very infrequent
>>state changes.
>>
>>Something like what is used to control the NUMLOCK-etc LEDs on
>>the keyboard comes to mind, but obviously can't use exactly those.
>
>I believe those things are control-out transfer.

Ok, thanks for the confirmation.

>
>>So I'm looking for ideas/pointers what would be the simplest way to
>>accomplish  this and which would not cause 'compatibility' issues
>>with the way host OS handles keyboards.
>>
>>Can I, for example,simply define an output report to control those
>>functions?
>>
>>What else is involved?
>>
>
>Your requirement is not clear. So I am just guessing here.
>
>A USB composite device.
>1st interface: keyboard interface, OS keyboard driver to handles this,
>for your keyboard function.
>
>2nd interface: generic HID interface for the ON/OFF function,
>HIDAPI based program to handle this. You can use Feature Report
>(control transfer) or Output report (control transfer and interrupt
>transfer) for these functions.

Hmmm, exposing my ignorance here: would a 2nd interface require an
other set of end points separate from the keyboard-HID interface?

The hardware only supports four end points and two are already in use
by the HID and two by UVC. At least that is what I think, I'm
skating on thin ice here, maybe I've got my interfaces and end points
mixed...

So we would need to use the existing HID out end point for our
control transfer, or what? Are there issues there if we just
'extend' that mechanism.

Thanks for taking interest.

br Kusti







------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn
about Cisco certifications, training, and career opportunities.
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Libusb-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusb-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: libusb 1.0, hidapi compilation/setup problem

Cuber
In reply to this post by Alan Ott
Alan,

I'm running CentOS 5.7   2.6.18-274.7.1.el5.centos.plus

it seems to. but i'm unsure if i'm checking this correctly. lsusb -v -d reveals info for the Report Descriptor (in the past this was unavailable even as root).

Report Descriptor: (length is 43)
            Item(Global): Usage Page, data= [ 0x01 ] 1
                            Generic Desktop Controls
            Item(Local ): Usage, data= [ 0x05 ] 5
                            Gamepad
            Item(Main  ): Collection, data= [ 0x01 ] 1
                            Application
            Item(Global): Usage Page, data= [ 0x09 ] 9
                            Buttons
            Item(Local ): Usage Minimum, data= [ 0x01 ] 1
                            Button 1 (Primary)
            Item(Local ): Usage Maximum, data= [ 0x06 ] 6
                            (null)
            Item(Global): Logical Minimum, data= [ 0x00 ] 0
            Item(Global): Logical Maximum, data= [ 0x01 ] 1
            Item(Global): Report Count, data= [ 0x06 ] 6
            Item(Global): Report Size, data= [ 0x01 ] 1
            Item(Main  ): Input, data= [ 0x02 ] 2
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Global): Report Count, data= [ 0x01 ] 1
            Item(Global): Report Size, data= [ 0x02 ] 2
            Item(Main  ): Input, data= [ 0x03 ] 3
                            Constant Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Global): Usage Page, data= [ 0x01 ] 1
                            Generic Desktop Controls
            Item(Local ): Usage, data= [ 0x32 ] 50
                            Direction-Z
            Item(Global): Logical Minimum, data= [ 0x80 ] 128
            Item(Global): Logical Maximum, data= [ 0x7f ] 127
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Report Count, data= [ 0x01 ] 1
            Item(Main  ): Input, data= [ 0x02 ] 2
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Main  ): End Collection, data=none
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: libusb 1.0, hidapi compilation/setup problem

Alan Stern
In reply to this post by Alan Ott
On Tue, 25 Oct 2011, Alan Ott wrote:

> On 10/25/2011 05:48 PM, cuber wrote:
> > I followed the comments in the hid.rules file but still had the same
> > problems. but I just changed SUBSYSTEM=="usb" to "usb_device" and it was
> > able to open my device:
> >
>
> I seem to remember having to do the opposite at some point, like it
> changed for some udev version. Does anyone know what the root cause of
> this is, or the reason for the change?

I believe it changed in the 2.6.24 kernel, when usb_device_type got its
own uevent handler.  Prior to that, uevents for new devices got issued
under the more general usb_bus_type heading.

Alan Stern


------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn
about Cisco certifications, training, and career opportunities.
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Libusb-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusb-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: libusb 1.0, hidapi compilation/setup problem

Alan Ott
On 10/26/2011 10:26 AM, Alan Stern wrote:

> On Tue, 25 Oct 2011, Alan Ott wrote:
>> On 10/25/2011 05:48 PM, cuber wrote:
>>> I followed the comments in the hid.rules file but still had the same
>>> problems. but I just changed SUBSYSTEM=="usb" to "usb_device" and it was
>>> able to open my device:
>> I seem to remember having to do the opposite at some point, like it
>> changed for some udev version. Does anyone know what the root cause of
>> this is, or the reason for the change?
> I believe it changed in the 2.6.24 kernel, when usb_device_type got its
> own uevent handler.  Prior to that, uevents for new devices got issued
> under the more general usb_bus_type heading.

Thanks Alan. I'll put this in the comments.


------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn
about Cisco certifications, training, and career opportunities.
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Libusb-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusb-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: OT HID advice sought

Peter Stuge
In reply to this post by Kustaa Nyholm-2
Kustaa Nyholm wrote:
> would a 2nd interface require an other set of end points separate
> from the keyboard-HID interface?

Each interface has it's own endpoints, and endpoint 0 is considered
not belonging to any specific interface so it can be considered
common, but Windows may not allow useful access to it without say
WinUSB being installed.

Are the Microsoft descriptors an alternative? Ie. that one or both
interfaces use WinUSB when plugged in, and thus accessible using
libusb? Doesn't work on older Windows systems though. I clearly
assume that you are working with Windows, since anywhere else I think
it would be easier to use vendor specific.


> The hardware only supports four end points and two are already in
> use by the HID

FWIW a HID class interface isn't required to have an interrupt out
endpoint, so if the hardware has no further restrictions (e.g.
2/2 IN/OUT endpoints) then you can use just one endpoint for each.


> I'm skating on thin ice here,

Well, check, otherwise noone can give any useful advice.


> So we would need to use the existing HID out end point for our
> control transfer, or what?

That sounds confusing.

HID1_11.pdf Section 4.4 specifies the HID class interface, although
with sloppy terminology. They have a column with heading Pipe which
lists one pipe and two endpoints. Anyway, ep0 is common and given,
and not actually part of the interface at all beyond that it can also
carry requests that are destined for an interface.

HID class then specs one interrupt in endpoint which is required, and
one interrupt out endpoint which is optional.

So if the out endpoint exists it must be interrupt, so there are no
control transfers going over it.

A control transfer goes over a control endpoint, usually the only
control endpoint in a device is ep0, since it can carry also
interface-specific requests.


Endpoint 0 can certainly be used to send (small amount) data to the
device, but you must investigate exactly how and what you can
accomplish through the kernel drivers and system APIs that you are
able to use. WinUSB and libusb would make it trivial. HID makes it
more complicated. I understand you can't install but if target
platform is newer systems then perhaps you can still use WinUSB and
libusb by adding Microsoft descriptors to the device.


//Peter

------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn
about Cisco certifications, training, and career opportunities.
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Libusb-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusb-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: OT HID advice sought

Tim Roberts
In reply to this post by Kustaa Nyholm-2
Kustaa Nyholm wrote:
> Hmmm, exposing my ignorance here: would a 2nd interface require an
> other set of end points separate from the keyboard-HID interface?

Possibly, but HID reports can also be sent via the control endpoint.
Your second interface wouldn't necessarily need an endpoint.

> The hardware only supports four end points and two are already in use
> by the HID and two by UVC. At least that is what I think, I'm
> skating on thin ice here, maybe I've got my interfaces and end points
> mixed...

Why does your UVC interface need two endpoints?  In virtually every
case, you can get by with just the isochronous endpoint.  The sync
endpoint is more trouble than it's worth, unless you absolutely need to
maintain sync with your own UAC stream.

> So we would need to use the existing HID out end point for our
> control transfer, or what? Are there issues there if we just
> 'extend' that mechanism.

You can't have one endpoint in two interfaces.  Your device has N
endpoints, and the interfaces are just a way to group those endpoints.
Except for the "select interface" request, interfaces are never
mentioned in USB wire transfers.  All addressing is done by endpoint.

--
Tim Roberts, [hidden email]
Providenza & Boekelheide, Inc.


------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn
about Cisco certifications, training, and career opportunities.
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Libusb-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusb-devel
12
Loading...