Hello!

Have been using libusbhid and discovered a couple of discrepancies in
the man-page (libusbhid.3) and the source of usage.c

Some are just factual misses, but I also got (what I think is) 2 errors.
I will try to explain them;

1. (This is the I think is an error but not sure). The man-page tells me
that hid_usage_in_page and hid_parse_usage_in_page are each
others inverse.
If I haven't misunderstood the practical meaning of inverse in this
case then this should be true:
x == hid_parse_usage_in_page(hid_usage_in_page(x)).

My observation:
The main reason to why this isnt true, is that hid_usage_in_page()
returns the data of pages[k].page_contents[j].name
while hid_parse_usage_in_page() expects the data to
contain "%s:%s", pages[k].name, pages[k].page_contents[j].name

The reason I ask instead of just posting working code is this:
Am I misunderstanding the manual? In that case, the solution I want
to send in is a change in that sentence
Or Is the manual correct and the behavior of hid_usage_in_page() wrong,
is this something I can correct without breaking other systems?


2. The second error I found is located in hid_parse_usage_in_page().
It is unable to parse values found in page Button.

My observation:
usage.c is using a standard table named usb_hid_pages. In that table
we got a page called Buttons.
the usages in that page is shortened to "*  Button %d".
I believe this is the cause of why hid_parse_usage_in_page() is getting
the pagesize "wrong" and therefor unable to parse any button in the
button page. I guess this is the case with other similar cases as well.

my conclusion is that it would be possible to handle similar cases in a
similar way as it is handled in hid_usage_in_page().


As this is my first "issue" I would love to get as much feedback as
possible so I can work on delivering a desirable and usable patch in
my first try.

As to the "factual" misses in the man-page, I found two prototype
declarations that differs from the header file. Intend to send a
man-page diff on the ones that I have bumped into.

/David Bern

Reply via email to