Discussion:
[libhid-discuss] Report Description Question (Not Matching lsusb)
Christopher Moore
2008-10-03 00:36:13 UTC
Permalink
Hello,

I'm trying to get some output from hid_dump_tree and I can't seem to get
anything meaningful out of it. For example, in one of the older posts
on this mailing list, I managed to see output like the following:

TRACE: hid_dump_tree(): iterating the parse tree for USB device 001/003[0]...
parse tree of HIDInterface 001/003[0]:
path: 0x00010009.0x00010033; type: 0x80
path: 0x00010009.0x00010034; type: 0x80
...

while, I can only recieve this:

TRACE: hid_reset_parser(): resetting the HID parser for USB device 002/005[3]...
TRACE: hid_prepare_parser(): dumping the raw report descriptor
TRACE: hid_prepare_parser(): 0x000: 0x05


-------------------

the code being used (Python):

hid_set_debug(HID_DEBUG_ALL)
hid_set_debug_stream(sys.stderr)
hid_set_usb_debug(0)

ret = hid_init()
if ret != HID_RET_SUCCESS:
sys.stderr.write("hid_init failed with return code %d.\n" % ret)

hid = hid_new_HIDInterface()
matcher = HIDInterfaceMatcher()
matcher.vendor_id = 0x13b1
matcher.product_id = 0x001d

ret = hid_force_open(hid, 3, matcher, 3)
ret = hid_dump_tree(sys.stdout, hid);

---------------------

I'm after Interface #3 (the hid device).

Thanks

Christopher
Charles Lepple
2008-10-03 01:57:11 UTC
Permalink
Post by Christopher Moore
Hello,
I'm trying to get some output from hid_dump_tree and I can't seem to get
anything meaningful out of it. For example, in one of the older posts
TRACE: hid_dump_tree(): iterating the parse tree for USB device 001/003[0]...
path: 0x00010009.0x00010033; type: 0x80
path: 0x00010009.0x00010034; type: 0x80
...
TRACE: hid_reset_parser(): resetting the HID parser for USB device 002/005[3]...
TRACE: hid_prepare_parser(): dumping the raw report descriptor
TRACE: hid_prepare_parser(): 0x000: 0x05
Please try the C test_libhid.c program first - the Python interface
is newer, and may have hidden bugs.
Post by Christopher Moore
-------------------
hid_set_debug(HID_DEBUG_ALL)
hid_set_debug_stream(sys.stderr)
hid_set_usb_debug(0)
ret = hid_init()
sys.stderr.write("hid_init failed with return code %d.\n" % ret)
hid = hid_new_HIDInterface()
matcher = HIDInterfaceMatcher()
matcher.vendor_id = 0x13b1
matcher.product_id = 0x001d
ret = hid_force_open(hid, 3, matcher, 3)
ret = hid_dump_tree(sys.stdout, hid);
---------------------
I'm after Interface #3 (the hid device).
I would also take a look at the hidwrap.py high-level wrapper around
the SWIG-generated code. The hidwrap.py interface is more object-
oriented, and hides some of the C heritage of the code.
--
Charles Lepple
Christopher Moore
2008-10-03 10:54:40 UTC
Permalink
Thanks again. I'll try out that .c code and also take a look at that
python script.
Post by Christopher Moore
Hello,
I'm trying to get some output from hid_dump_tree and I can't seem to get
anything meaningful out of it. For example, in one of the older posts
TRACE: hid_dump_tree(): iterating the parse tree for USB device 001/003[0]...
path: 0x00010009.0x00010033; type: 0x80
path: 0x00010009.0x00010034; type: 0x80
...
TRACE: hid_reset_parser(): resetting the HID parser for USB device 002/005[3]...
TRACE: hid_prepare_parser(): dumping the raw report descriptor
TRACE: hid_prepare_parser(): 0x000: 0x05
Please try the C test_libhid.c program first - the Python interface is
newer, and may have hidden bugs.
Post by Christopher Moore
-------------------
hid_set_debug(HID_DEBUG_ALL)
hid_set_debug_stream(sys.stderr)
hid_set_usb_debug(0)
ret = hid_init()
sys.stderr.write("hid_init failed with return code %d.\n" % ret)
hid = hid_new_HIDInterface()
matcher = HIDInterfaceMatcher()
matcher.vendor_id = 0x13b1
matcher.product_id = 0x001d
ret = hid_force_open(hid, 3, matcher, 3)
ret = hid_dump_tree(sys.stdout, hid);
---------------------
I'm after Interface #3 (the hid device).
I would also take a look at the hidwrap.py high-level wrapper around
the SWIG-generated code. The hidwrap.py interface is more
object-oriented, and hides some of the C heritage of the code.
Christopher Moore
2008-10-03 11:19:12 UTC
Permalink
the test_libhid.c (after updating it to point to my device), also
returns the same thing:

NOTICE: hid_prepare_report_descriptor(): successfully initialised report
descriptor for USB device 002/002[3].
TRACE: hid_prepare_parser(): setting up the HID parser for USB device
002/002[3]...
TRACE: hid_reset_parser(): resetting the HID parser for USB device
002/002[3]...
TRACE: hid_prepare_parser(): dumping the raw report
descriptor
TRACE: hid_prepare_parser(): 0x000:
0x05

TRACE: hid_prepare_parser(): parsing the HID tree of USB device
002/002[3]...
NOTICE: hid_prepare_parser(): successfully set up the HID parser for
USB device 002/002[3].
NOTICE: hid_force_open(): successfully opened USB device
002/002[3].
device identification of HIDInterface
002/002[3]:

dev_handle:
0x09adb4a8

device:
0x09ae21b8

location: 002/002
manufacturer: LINKSYS
product: Linksys CIT200
serial number: USBGAP0000000000000000000016617407E
TRACE: hid_reset_parser(): resetting the HID parser for USB device
002/002[3]...
TRACE: hid_dump_tree(): iterating the parse tree for USB device
002/002[3]...
parse tree of HIDInterface 002/002[3]:
TRACE: hid_reset_parser(): resetting the HID parser for USB device
002/002[3]...
TRACE: hid_close(): closing USB device 002/002[3]...


I ran that command as root. Meanwhile, running 'lsusb -d 13b1:001d
-vvv' returns the whole report.

Does this mean that libhid doesn't like my device and I should stick
with libusb?

Thanks

Christopher
Post by Christopher Moore
Hello,
I'm trying to get some output from hid_dump_tree and I can't seem to get
anything meaningful out of it. For example, in one of the older posts
TRACE: hid_dump_tree(): iterating the parse tree for USB device 001/003[0]...
path: 0x00010009.0x00010033; type: 0x80
path: 0x00010009.0x00010034; type: 0x80
...
TRACE: hid_reset_parser(): resetting the HID parser for USB device 002/005[3]...
TRACE: hid_prepare_parser(): dumping the raw report descriptor
TRACE: hid_prepare_parser(): 0x000: 0x05
Please try the C test_libhid.c program first - the Python interface is
newer, and may have hidden bugs.
Post by Christopher Moore
-------------------
hid_set_debug(HID_DEBUG_ALL)
hid_set_debug_stream(sys.stderr)
hid_set_usb_debug(0)
ret = hid_init()
sys.stderr.write("hid_init failed with return code %d.\n" % ret)
hid = hid_new_HIDInterface()
matcher = HIDInterfaceMatcher()
matcher.vendor_id = 0x13b1
matcher.product_id = 0x001d
ret = hid_force_open(hid, 3, matcher, 3)
ret = hid_dump_tree(sys.stdout, hid);
---------------------
I'm after Interface #3 (the hid device).
I would also take a look at the hidwrap.py high-level wrapper around
the SWIG-generated code. The hidwrap.py interface is more
object-oriented, and hides some of the C heritage of the code.
Charles Lepple
2008-10-03 12:46:38 UTC
Permalink
Post by Christopher Moore
Does this mean that libhid doesn't like my device and I should stick
with libusb?
We ran into this with some USB UPSes on the Network UPS Tools
project, I think.

For now, yes.

Eventually, I will try to merge in the NUT code that uses the lsusb-
style way of grabbing all of the USB descriptors (not just the HID
report descriptor), and using whichever is longer.
--
Charles Lepple
Loading...