Discussion:
[libhid-discuss] Installing Python wrappers from SVN
Sarah Mount
2008-11-16 21:42:39 UTC
Permalink
Hi all,

I'm trying to compile and install libhid from the latest SVN source
(in response to the other thread on SWIG!). I'm using Ubuntu Ibex and
I notice that by default the "prefix" used by configure/make is
/usr/local/ which causes a problem with installing the Python SWIG
wrappers on Ibex.

Running configure with '--prefix=/usr/' helps but the following files:

_hid.a _hid.la _hid.so hidwrap.pyc __init__.pyo
hid_ctypes.py hid.py _hid.so.0 hidwrap.pyo
hid_ctypes.pyc hid.pyc _hid.so.0.0.0 __init__.py
hid_ctypes.pyo hid.pyo hidwrap.py __init__.pyc

get installed in /usr/lib/python2.5/site-packages/libhid/. Now,
/usr/lib/python2.5/site-packages/ is on the PYTHONPATH, so that's
great, but now the top level hid.py and hidwrap.py are in the
.../libhid/ directory, meaning that they can't be imported directly
(checking this Python indeed raises an ImportError).

Importing libhid.hid looks like it ought to work but actually gives
import libhid.hid
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr//lib/python2.5/site-packages/libhid/__init__.py", line
11, in <module>
import _hid
ImportError: /usr/lib/python2.5/site-packages/libhid/_hid.so:
undefined symbol: assert
I would guess that this only needs a small change in the way I'm using
the autoconf/make tools to fix, but I can't figure out which variable
needs changing. Any help gratefully received!

Many thanks,

Sarah
--
Sarah Mount, Senior Lecturer, University of Wolverhampton
Web: http://www.wlv.ac.uk/~in0316/
Book: http://www.pythonforrookies.org/
Blog: http://varspool.blogspot.com/
Photos: http://flickr.com/photos/sarahmount/

This email, together with any attachment, is for the exclusive and
confidential use of the addressee(s) and may contain legally
privileged information. Any use, disclosure or reproduction without
the sender's explicit consent is unauthorised and may be unlawful.

Any e-mail including its content and any attachments may be monitored
and used by The University of Wolverhampton for reasons of security
and for monitoring internal compliance with the University's policy on
internet use. E-mail blocking software may also be used. The
University cannot guarantee that this message or any attachment is
virus free or has not been intercepted and amended.

If you believe you have received this message in error please notify
the sender by email, telephone or fax and destroy the message and any
copies.
Charles Lepple
2008-11-17 02:34:31 UTC
Permalink
Post by Sarah Mount
Importing libhid.hid looks like it ought to work but actually gives
import libhid.hid
File "<stdin>", line 1, in <module>
File "/usr//lib/python2.5/site-packages/libhid/__init__.py", line
11, in <module>
import _hid
undefined symbol: assert
That's a very odd error. "assert" should be a preprocessor #define.
What if you cd to /usr/lib/python2.5/site-packages/libhid, then run
python and try "import hid"?
Sarah Mount
2008-11-17 11:47:47 UTC
Permalink
Post by Sarah Mount
Importing libhid.hid looks like it ought to work but actually gives
Post by Charles Lepple
import libhid.hid
File "<stdin>", line 1, in <module>
File "/usr//lib/python2.5/site-packages/libhid/__init__.py", line
11, in <module>
import _hid
undefined symbol: assert
That's a very odd error. "assert" should be a preprocessor #define. What if
you cd to /usr/lib/python2.5/site-packages/libhid, then run python and try
"import hid"?
Post by Sarah Mount
Post by Charles Lepple
import hid
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.5/site-packages/libhid/hid.py", line 11, in <module>
import _hid
ImportError: ./_hid.so: undefined symbol: assert
The ldd output you asked for is this:

$ sudo ldd /usr/lib/python2.5/site-packages/libhid/_hid.so
linux-gate.so.1 => (0xb80d9000)
/lib/snoopy.so (0xb80c5000)
libhid.so.0 => /usr/lib/libhid.so.0 (0xb80a0000)
libusb-0.1.so.4 => /lib/libusb-0.1.so.4 (0xb8097000)
libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7f39000)
libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb7f35000)
/lib/ld-linux.so.2 (0xb80da000)
$


Odd!

Many thanks,

Sarah
--
Sarah Mount, Senior Lecturer, University of Wolverhampton
Web: http://www.wlv.ac.uk/~in0316/
Book: http://www.pythonforrookies.org/
Blog: http://varspool.blogspot.com/
Photos: http://flickr.com/photos/sarahmount/

This email, together with any attachment, is for the exclusive and
confidential use of the addressee(s) and may contain legally
privileged information. Any use, disclosure or reproduction without
the sender's explicit consent is unauthorised and may be unlawful.

Any e-mail including its content and any attachments may be monitored
and used by The University of Wolverhampton for reasons of security
and for monitoring internal compliance with the University's policy on
internet use. E-mail blocking software may also be used. The
University cannot guarantee that this message or any attachment is
virus free or has not been intercepted and amended.

If you believe you have received this message in error please notify
the sender by email, telephone or fax and destroy the message and any
copies.
Charles Lepple
2008-11-17 15:02:41 UTC
Permalink
Post by Charles Lepple
Post by Sarah Mount
Importing libhid.hid looks like it ought to work but actually gives
import libhid.hid
File "<stdin>", line 1, in <module>
File "/usr//lib/python2.5/site-packages/libhid/__init__.py", line
11, in <module>
import _hid
undefined symbol: assert
That's a very odd error. "assert" should be a preprocessor
#define. What if
you cd to /usr/lib/python2.5/site-packages/libhid, then run python and try
"import hid"?
I am pretty sure I did not see this on 8.04, and I don't have an 8.10
box available to test.

I'd say to file a bug on Launchpad, but that won't be helpful if you
didn't see that error with the original Ubuntu package.

Anyone else on the list running Ubuntu?
--
Charles Lepple
Sarah Mount
2008-11-17 15:12:31 UTC
Permalink
Post by Sarah Mount
Importing libhid.hid looks like it ought to work but actually gives
import libhid.hid
File "<stdin>", line 1, in <module>
File "/usr//lib/python2.5/site-packages/libhid/__init__.py", line
11, in <module>
import _hid
undefined symbol: assert
That's a very odd error. "assert" should be a preprocessor #define. What if
you cd to /usr/lib/python2.5/site-packages/libhid, then run python and try
"import hid"?
I am pretty sure I did not see this on 8.04, and I don't have an 8.10 box
available to test.
I'd say to file a bug on Launchpad, but that won't be helpful if you didn't
see that error with the original Ubuntu package.
Anyone else on the list running Ubuntu?
Thanks Charles. I notice that the python-hid package on the Ubuntu
repositories is set up quite differently to the SVN. dpkg -L says this
about it:


/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/python-hid
/usr/share/doc/python-hid/README
/usr/share/doc/python-hid/copyright
/usr/share/doc/python-hid/examples
/usr/share/doc/python-hid/examples/test_libhid.py
/usr/share/doc/python-hid/changelog.Debian.gz
/usr/share/python-support
/usr/share/python-support/python-hid
/usr/share/python-support/python-hid/hid
/usr/share/python-support/python-hid/hid/_hid.a
/usr/share/python-support/python-hid/hid/_hid.la
/usr/share/python-support/python-hid/hid/__init__.py
/usr/lib
/usr/lib/python-support
/usr/lib/python-support/python-hid
/usr/lib/python-support/python-hid/python2.5
/usr/lib/python-support/python-hid/python2.5/hid
/usr/lib/python-support/python-hid/python2.5/hid/_hid.so.0.0.0
/usr/lib/python-support/python-hid/python2.5/hid/_hid.so.0
/usr/lib/python-support/python-hid/python2.5/hid/_hid.so


Which doesn't include files such as hid.py, so it looks like the
Canonical people have completely repackaged everything.

Thanks,

Sarah
--
Sarah Mount, Senior Lecturer, University of Wolverhampton
Web: http://www.wlv.ac.uk/~in0316/
Book: http://www.pythonforrookies.org/
Blog: http://varspool.blogspot.com/
Photos: http://flickr.com/photos/sarahmount/

This email, together with any attachment, is for the exclusive and
confidential use of the addressee(s) and may contain legally
privileged information. Any use, disclosure or reproduction without
the sender's explicit consent is unauthorised and may be unlawful.

Any e-mail including its content and any attachments may be monitored
and used by The University of Wolverhampton for reasons of security
and for monitoring internal compliance with the University's policy on
internet use. E-mail blocking software may also be used. The
University cannot guarantee that this message or any attachment is
virus free or has not been intercepted and amended.

If you believe you have received this message in error please notify
the sender by email, telephone or fax and destroy the message and any
copies.
Charles Lepple
2008-11-17 15:17:03 UTC
Permalink
Post by Sarah Mount
Which doesn't include files such as hid.py, so it looks like the
Canonical people have completely repackaged everything.
I think hid.py was included after 0.2.15.
--
Charles Lepple
Charles Lepple
2008-11-17 05:15:56 UTC
Permalink
Post by Sarah Mount
undefined symbol: assert
Also, what does 'ldd /usr/lib/python2.5/site-packages/libhid/_hid.so'
return?
--
Charles Lepple
Charles Lepple
2008-11-17 15:11:09 UTC
Permalink
Post by Sarah Mount
I'm trying to compile and install libhid from the latest SVN source
(in response to the other thread on SWIG!). I'm using Ubuntu Ibex and
I notice that by default the "prefix" used by configure/make is
/usr/local/ which causes a problem with installing the Python SWIG
wrappers on Ibex.
Another option might be to download the changeset that you need [355]
and apply that to the version of libhid in Ubuntu.

http://boxster.ghz.cc/projects/libhid/changeset/355

There's a link to the raw patch at the bottom of that page ("Unified
Diff") and after going through the 'apt-src install libhid' routine,
that patch should still apply.
--
Charles Lepple
Sarah Mount
2008-11-17 19:47:22 UTC
Permalink
Post by Sarah Mount
I'm trying to compile and install libhid from the latest SVN source
(in response to the other thread on SWIG!). I'm using Ubuntu Ibex and
I notice that by default the "prefix" used by configure/make is
/usr/local/ which causes a problem with installing the Python SWIG
wrappers on Ibex.
Another option might be to download the changeset that you need [355] and
apply that to the version of libhid in Ubuntu.
http://boxster.ghz.cc/projects/libhid/changeset/355
There's a link to the raw patch at the bottom of that page ("Unified Diff")
and after going through the 'apt-src install libhid' routine, that patch
should still apply.
Well, this is interesting -- I've never used apt-src before :)

I've tried this now and applied the changeset, but still get the same
error on Ibex. I've managed to find a Ubuntu Hardy machine and on that
the build seems to work. For some odd reason my other Python code runs
vastly slower, but no matter. It would be useful to track this problem
down and fix it though, if that's possible.

Many thanks,

Sarah
--
Sarah Mount, Senior Lecturer, University of Wolverhampton
Web: http://www.wlv.ac.uk/~in0316/
Book: http://www.pythonforrookies.org/
Blog: http://varspool.blogspot.com/
Photos: http://flickr.com/photos/sarahmount/

This email, together with any attachment, is for the exclusive and
confidential use of the addressee(s) and may contain legally
privileged information. Any use, disclosure or reproduction without
the sender's explicit consent is unauthorised and may be unlawful.

Any e-mail including its content and any attachments may be monitored
and used by The University of Wolverhampton for reasons of security
and for monitoring internal compliance with the University's policy on
internet use. E-mail blocking software may also be used. The
University cannot guarantee that this message or any attachment is
virus free or has not been intercepted and amended.

If you believe you have received this message in error please notify
the sender by email, telephone or fax and destroy the message and any
copies.
Charles Lepple
2008-12-23 14:15:30 UTC
Permalink
Post by Sarah Mount
Importing libhid.hid looks like it ought to work but actually gives
import libhid.hid
File "<stdin>", line 1, in <module>
File "/usr//lib/python2.5/site-packages/libhid/__init__.py", line
11, in <module>
import _hid
undefined symbol: assert
It looks like this is the same issue as http://bugs.debian.org/cgi-
bin/bugreport.cgi?bug=476525

The SVN trunk (r364) should have the fix incorporated.

Thanks to Blaine Booher for bringing this to my attention.
Blaine Booher
2008-12-23 18:37:53 UTC
Permalink
I can verify that this works. Thank you so much! :)

Blaine
Post by Charles Lepple
Post by Sarah Mount
Importing libhid.hid looks like it ought to work but actually gives
import libhid.hid
File "<stdin>", line 1, in <module>
File "/usr//lib/python2.5/site-packages/libhid/__init__.py", line
11, in <module>
import _hid
undefined symbol: assert
It looks like this is the same issue as http://bugs.debian.org/cgi-
bin/bugreport.cgi?bug=476525
The SVN trunk (r364) should have the fix incorporated.
Thanks to Blaine Booher for bringing this to my attention.
_______________________________________________
libhid-discuss mailing list
libhid-discuss at lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/libhid-discuss
Blaine Booher
2008-12-24 17:53:38 UTC
Permalink
Hey everyone,
I'm really confused and any suggestions would be very helpful. I have a device, and I know (from USB Snoopy on Windows) what data packets I need to send to it. When the software that comes with the device is started, 6 packets are sent/received (see first attachment). Once I get the first packet sent, I can worry about the rest later. At this point I'd just like to get the device to respond to correct report requests.

bmRequestType = 0x22 -> Direction: Host-to-device, Type: Class, Recipient: Endpoint
bRequest = 0x09 -> HID SET_OUTPUT_REPORT
wValue = 0x0200 -> Report type (0x02, aka Output report) and report ID (0x00)
wIndex = 0x0001 -> Sent to interface 1
wLength = 0x0008 -> 8 bytes of data

Data payload:
02 02 95 95 00 00 00 00

Now, I know that I need to be using the set_output_report function (at least I think this is correct, since it corresponds with the constant HID_REPORT_SET 0x09). I have two basic questions:
1. I partially understand the 'path' parameter in the set_output_report, but I am not sure. The source code calls usblib's control_msg function, which I am familiar with. It seems that I need 0x22 as the second parameter in the usb_control_msg. I'm not sure how to set this up properly using the HID path tree. When I look at the usbmon output (Given the example code below), I see 21 09 0200 0000 0040 being sent to the device - which is close, but not what I need. Is it possible that these values would work anyway since they derive from the HID Path tree?
2. Where do I input the values for the wValue and wIndex? I assume that this derives from the hid_find_object (and hence HID path tree), but I'm not sure if I trust the results since I am unfamiliar with the path set up... See below.

Here is the source code for the data packet being sent by set_output_report (with my comments):
TRACE("looking up report ID...");
hidif->hid_data->Type = ITEM_OUTPUT;
hidif->hid_data->ReportID = 0;

hid_find_object(hidif, path, depth);
// Should I be using hid_find_object if I already know the parameters?

int len = usb_control_msg(hidif->dev_handle,
USB_ENDPOINT_OUT + USB_TYPE_CLASS + USB_RECIP_INTERFACE, // This should be 0x22, right?
HID_REPORT_SET, // 0x09
hidif->hid_data->ReportID + (HID_RT_OUTPUT << 8), // This should be 0x0200?
hidif->interface, // Interface ID
(char*)buffer, size, USB_TIMEOUT); // Timeout

If it is wise to use the path, rather than hardcode these values (I'll explain this in a second), I believe my path values (give a tree dump) are as follows. Does this look right?
parse tree of HIDInterface 002/005[0]:
path: 0xffa00001.0xffa00002; type: 0x80
path: 0xffa00001.0x00000000; type: 0x80
path: 0xffa00001.0x00000000; type: 0x80
[... truncated ...]
path: 0xffa00001.0x00000000; type: 0x80
path: 0xffa00001.0xffa00003; type: 0x90
path: 0xffa00001.0x00000000; type: 0x90
[... truncated ...]
path: 0xffa00001.0x00000000; type: 0x90

PATH_IN = [0xffa00001, 0xffa00002]
PATH_OUT = [0xffa00001, 0xffa00003]

The main reason that I am concerned over this is because initially I tried using libusb, without libhid. I found it impossible to send the following control message (rejected by the kernel):
control_msg(0x22, 0x09, (data), 0x0200, 0x0001, 64). It says that the request type is invalid (0x22) and will not allow the packet to even reach the USB bus. This leads me to believe that something fishy is going on that I don't understand, and I need to use the HID path method (maybe to generate a different request type?)

Any help would be wonderful. I feel so close, but I know I am missing something basic. I do have libhid successfully reading interrupt requests on 0x81 when I push a button on the device. Its just these control transfers and reports that I'm having trouble with.

Thanks,
Blaine


USB Snoopy Output:
[b]14 out down 0x00 9.839 CLASS_ENDPOINT 02 02 95 95 00 00 00 00 [/b]
URB Header (length: 80)
SequenceNumber: 14
Function: 001c (CLASS_ENDPOINT)
PipeHandle: 00000000
SetupPacket:
0000: 22 09 00 02 01 00 00 00
bmRequestType: 22
DIR: Host-To-Device
TYPE: Class
RECIPIENT: Endpoint
bRequest: 09

TransferBuffer: 0x00000008 (8) length
0000: 02 02 95 95 00 00 00 00

[b]14 out up n/a 9.842 CONTROL_TRANSFER - 0x00000000[/b]
URB Header (length: 80)
SequenceNumber: 14
Function: 0008 (CONTROL_TRANSFER)
PipeHandle: 82db2020

SetupPacket:
0000: 22 09 00 02 01 00 08 00
bmRequestType: 22
DIR: Host-To-Device
TYPE: Class
RECIPIENT: Endpoint
bRequest: 09
No TransferBuffer

[b]10 in up 0x81 9.843 BULK_OR_INTERRUPT_TRANSFER 80 a9 28 01 09 01 25 e0 0x00000000[/b]
URB Header (length: 72)
SequenceNumber: 10
Function: 0009 (BULK_OR_INTERRUPT_TRANSFER)
TransferFlags: 0x00000003

TransferBuffer: 0x00000040 (64) length
0000: 80 a9 28 01 09 01 25 e0 8d 0e 02 00 00 00 00 00
0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

[b]15 in down 0x81 9.843 BULK_OR_INTERRUPT_TRANSFER -[/b]
URB Header (length: 72)
SequenceNumber: 15
Function: 0009 (BULK_OR_INTERRUPT_TRANSFER)
TransferFlags: 0x00000003

No TransferBuffer

[b]16 out down 0x00 9.845 CLASS_ENDPOINT 02 04 80 b5 01 01 00 00 [/b]
URB Header (length: 80)
SequenceNumber: 16
Function: 001c (CLASS_ENDPOINT)
PipeHandle: 00000000
SetupPacket:
0000: 22 09 00 02 01 00 00 00
bmRequestType: 22
DIR: Host-To-Device
TYPE: Class
RECIPIENT: Endpoint
bRequest: 09

TransferBuffer: 0x00000008 (8) length
0000: 02 04 80 b5 01 01 00 00

[b]16 out up n/a 9.849 CONTROL_TRANSFER - 0x00000000[/b]
URB Header (length: 80)
SequenceNumber: 16
Function: 0008 (CONTROL_TRANSFER)
PipeHandle: 82db2020

SetupPacket:
0000: 22 09 00 02 01 00 08 00
bmRequestType: 22
DIR: Host-To-Device
TYPE: Class
RECIPIENT: Endpoint
bRequest: 09

No TransferBuffer






Device Information:
lsusb -vvv, truncated to my device:

Bus 002 Device 015: ID 0e20:0101
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor 0x0e20
idProduct 0x0101
bcdDevice 3.03
iManufacturer 4 Pegasus Technologies Ltd.
iProduct 56 NoteTaker FW Ver 3.03
iSerial 100 0003-0003
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 59
bNumInterfaces 2
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xa0
(Bus Powered)
Remote Wakeup
MaxPower 100mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 0 No Subclass
bInterfaceProtocol 0 None
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 1
** UNRECOGNIZED: 09 21 10 01 00 01 22 24 00
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 0 No Subclass
bInterfaceProtocol 0 None
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0006 1x 6 bytes
bInterval 1
** UNRECOGNIZED: 09 21 10 01 00 01 22 87 00
Device Status: 0x0001
Self Powered
Charles Lepple
2008-12-28 04:54:44 UTC
Permalink
Post by Blaine Booher
Hey everyone,
I'm really confused and any suggestions would be very helpful. I
have a device, and I know (from USB Snoopy on Windows) what data
packets I need to send to it.
You may be interested in this program:

http://iki.fi/lindi/usb/usbsnoop2libusb.pl

It generates a skeleton libusb application based on usbsnoop output.
Post by Blaine Booher
When the software that comes with the device is started, 6
packets are sent/received (see first attachment). Once I get the
first packet sent, I can worry about the rest later. At this point
I'd just like to get the device to respond to correct report requests.
bmRequestType = 0x22 -> Direction: Host-to-device, Type: Class,
Recipient: Endpoint
bRequest = 0x09 -> HID SET_OUTPUT_REPORT
wValue = 0x0200 -> Report type (0x02, aka Output report) and report
ID (0x00)
wIndex = 0x0001 -> Sent to interface 1
wLength = 0x0008 -> 8 bytes of data
02 02 95 95 00 00 00 00
Now, I know that I need to be using the set_output_report function
(at least I think this is correct, since it corresponds with the
constant HID_REPORT_SET 0x09).
Yup, hid_set_output_report() does send a control message with
HID_REPORT_SET (0x09).
Post by Blaine Booher
1. I partially understand the 'path' parameter in the
set_output_report, but I am not sure. The source code calls
usblib's control_msg function, which I am familiar with. It seems
that I need 0x22 as the second parameter in the usb_control_msg.
I'm not sure how to set this up properly using the HID path tree.
When I look at the usbmon output (Given the example code below), I
see 21 09 0200 0000 0040 being sent to the device - which is close,
but not what I need. Is it possible that these values would work
anyway since they derive from the HID Path tree?
0x21 is USB_ENDPOINT_OUT + USB_TYPE_CLASS + USB_RECIP_INTERFACE. I'm
not sure why it wants to be "Recipient: Endpoint" as you indicated
above.

If you can find a reference that says why 0x22 might be a valid
option, you might be able to convince me to modify the code.
Post by Blaine Booher
2. Where do I input the values for the wValue and wIndex? I assume
that this derives from the hid_find_object (and hence HID path
tree), but I'm not sure if I trust the results since I am
unfamiliar with the path set up... See below.
Here is the source code for the data packet being sent by
TRACE("looking up report ID...");
hidif->hid_data->Type = ITEM_OUTPUT;
hidif->hid_data->ReportID = 0;
hid_find_object(hidif, path, depth);
// Should I be using hid_find_object if I already know the
parameters?
This is an interesting question. If you already know the parameters,
and if they don't match what libhid sends, it may be easier to just
use libusb directly.
Post by Blaine Booher
int len = usb_control_msg(hidif->dev_handle,
USB_ENDPOINT_OUT + USB_TYPE_CLASS + USB_RECIP_INTERFACE, //
This should be 0x22, right?
HID_REPORT_SET, // 0x09
hidif->hid_data->ReportID + (HID_RT_OUTPUT << 8), // This
should be 0x0200?
hidif->interface, // Interface ID
(char*)buffer, size, USB_TIMEOUT); // Timeout
If it is wise to use the path, rather than hardcode these values
(I'll explain this in a second), I believe my path values (give a
tree dump) are as follows. Does this look right?
path: 0xffa00001.0xffa00002; type: 0x80
path: 0xffa00001.0x00000000; type: 0x80
path: 0xffa00001.0x00000000; type: 0x80
[... truncated ...]
path: 0xffa00001.0x00000000; type: 0x80
path: 0xffa00001.0xffa00003; type: 0x90
path: 0xffa00001.0x00000000; type: 0x90
[... truncated ...]
path: 0xffa00001.0x00000000; type: 0x90
PATH_IN = [0xffa00001, 0xffa00002]
PATH_OUT = [0xffa00001, 0xffa00003]
The main reason that I am concerned over this is because initially
I tried using libusb, without libhid. I found it impossible to
control_msg(0x22, 0x09, (data), 0x0200, 0x0001, 64). It says that
the request type is invalid (0x22) and will not allow the packet to
even reach the USB bus. This leads me to believe that something
fishy is going on that I don't understand, and I need to use the
HID path method (maybe to generate a different request type?)
Unfortunately, I am a little suspicious of usbsnoopy's output here.
What version are you using, and where did you get it?

You might try this one: http://www.pcausa.com/Utilities/UsbSnoop/
default.htm (SniffUSB 2.0) or http://benoit.papillault.free.fr/
usbsnoop/index.php.en (usbsnoop 1.8)
Post by Blaine Booher
Any help would be wonderful. I feel so close, but I know I am
missing something basic. I do have libhid successfully reading
interrupt requests on 0x81 when I push a button on the device. Its
just these control transfers and reports that I'm having trouble with.
Thanks,
Blaine
[b]14 out down 0x00 9.839 CLASS_ENDPOINT 02 02 95 95 00
00 00 00 [/b]
URB Header (length: 80)
SequenceNumber: 14
Function: 001c (CLASS_ENDPOINT)
PipeHandle: 00000000
0000: 22 09 00 02 01 00 00 00
bmRequestType: 22
DIR: Host-To-Device
TYPE: Class
RECIPIENT: Endpoint
bRequest: 09
TransferBuffer: 0x00000008 (8) length
0000: 02 02 95 95 00 00 00 00
[b]14 out up n/a 9.842 CONTROL_TRANSFER - 0x00000000[/b]
URB Header (length: 80)
SequenceNumber: 14
Function: 0008 (CONTROL_TRANSFER)
PipeHandle: 82db2020
0000: 22 09 00 02 01 00 08 00
bmRequestType: 22
DIR: Host-To-Device
TYPE: Class
RECIPIENT: Endpoint
bRequest: 09
No TransferBuffer
[b]10 in up 0x81 9.843 BULK_OR_INTERRUPT_TRANSFER 80 a9
28 01 09 01 25 e0 0x00000000[/b]
URB Header (length: 72)
SequenceNumber: 10
Function: 0009 (BULK_OR_INTERRUPT_TRANSFER)
TransferFlags: 0x00000003
TransferBuffer: 0x00000040 (64) length
0000: 80 a9 28 01 09 01 25 e0 8d 0e 02 00 00 00 00 00
0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[b]15 in down 0x81 9.843 BULK_OR_INTERRUPT_TRANSFER -[/b]
URB Header (length: 72)
SequenceNumber: 15
Function: 0009 (BULK_OR_INTERRUPT_TRANSFER)
TransferFlags: 0x00000003
No TransferBuffer
[b]16 out down 0x00 9.845 CLASS_ENDPOINT 02 04 80 b5 01
01 00 00 [/b]
URB Header (length: 80)
SequenceNumber: 16
Function: 001c (CLASS_ENDPOINT)
PipeHandle: 00000000
0000: 22 09 00 02 01 00 00 00
bmRequestType: 22
DIR: Host-To-Device
TYPE: Class
RECIPIENT: Endpoint
bRequest: 09
TransferBuffer: 0x00000008 (8) length
0000: 02 04 80 b5 01 01 00 00
[b]16 out up n/a 9.849 CONTROL_TRANSFER - 0x00000000[/b]
URB Header (length: 80)
SequenceNumber: 16
Function: 0008 (CONTROL_TRANSFER)
PipeHandle: 82db2020
0000: 22 09 00 02 01 00 08 00
bmRequestType: 22
DIR: Host-To-Device
TYPE: Class
RECIPIENT: Endpoint
bRequest: 09
No TransferBuffer
Bus 002 Device 015: ID 0e20:0101
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor 0x0e20
idProduct 0x0101
bcdDevice 3.03
iManufacturer 4 Pegasus Technologies Ltd.
iProduct 56 NoteTaker FW Ver 3.03
iSerial 100 0003-0003
bNumConfigurations 1
bLength 9
bDescriptorType 2
wTotalLength 59
bNumInterfaces 2
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xa0
(Bus Powered)
Remote Wakeup
MaxPower 100mA
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 0 No Subclass
bInterfaceProtocol 0 None
iInterface 0
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 1
** UNRECOGNIZED: 09 21 10 01 00 01 22 24 00
Odd that your version of lsusb doesn't recognize this descriptor.
Post by Blaine Booher
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 0 No Subclass
bInterfaceProtocol 0 None
iInterface 0
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0006 1x 6 bytes
bInterval 1
** UNRECOGNIZED: 09 21 10 01 00 01 22 87 00
Same here. A lot of useful information is not being displayed by lsusb.
Post by Blaine Booher
Device Status: 0x0001
Self Powered
Loading...