Author Topic: USBCV HID Descriptor error  (Read 45505 times)

jdunne

  • Member
  • ***
  • Posts: 26
USBCV HID Descriptor error
« on: April 26, 2011, 12:17:57 pm »
Hello,

I'm attempting to make my USB device compliant with the USBCV tool.  It works perfectly fine under normal use, but when I attempt to test the device it fails the HID Tests.  The error is quite cryptic and very unhelpful.  I'm hoping somebody has knows of a tool that can be used to verify report descriptors.

Following is the error, which is about as helpful as it saying "Error.":
Now Starting Test: HID Class Report Descriptor Test (Configuration Index 0)
Start time: Tue Apr 26 10:55:24 2011

External report descriptor parser 0x200 warnings
External report descriptor parser 0xA errors
(3.2.61) The report descriptor returned in response to a GetDescriptor(Report)
 must be compliant with the HID specification.


I looked into Windows kernel debugging, but got scared and ran for the hills.  Ideally I'd like to just generate a .log file of the enumeration process without having to use all the crazy 2 PC setups they have.  Has anyone used Windows kernel debugging to debug an HID device?  I'd be more willing to put in the effort if I knew I'd get a useful output.  Like I said, the device works, so I'm not really sure if Windows would even show an error in the debug trace.  If anything it might be a warning.

Anyway, does anyone know of a tool to check for errors in HID report descriptors?  Mine are quite lengthy and I can't post them here, so I'm really looking for suggestions of tools to use. 

I might be crazy, but I recall using an application several years ago which output an HTML page showing report descriptor errors.  I can't remember what its called and I can't seem to find it in any of my tools.  The only thing I remember is that I'm fairly certain it was either a Perl script or a Python script.

Joe

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: USBCV HID Descriptor error
« Reply #1 on: April 26, 2011, 02:47:56 pm »

jdunne

  • Member
  • ***
  • Posts: 26
Re: USBCV HID Descriptor error
« Reply #2 on: April 26, 2011, 02:53:49 pm »
Jan,

Thanks for the reply.  The HID descriptor tool is useful for creating a report descriptor.  It is not useful for verifying one is correct.  I'm trying to determine why usbcv is telling me that it doesn't like my descriptors.

Joe

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: USBCV HID Descriptor error
« Reply #3 on: April 26, 2011, 03:05:46 pm »
That's the only tool I can recall. You could try removing sections of the descriptor and retesting to try to isolate the problem.

If the device enumerates, I don't think debugging the enumeration will show anything.

Jan

jdunne

  • Member
  • ***
  • Posts: 26
Re: USBCV HID Descriptor error
« Reply #4 on: April 26, 2011, 03:10:43 pm »
Jan,

That's the same conclusion I came to.  I have another similar device which does pass the usbcv test and I'm presently in the process of copying portions of the working descriptor over until I get a pass result.  Thanks for the input.

Joe

jdunne

  • Member
  • ***
  • Posts: 26
Re: USBCV HID Descriptor error
« Reply #5 on: April 27, 2011, 11:43:47 am »
Jan,

You were right!  HID Descriptor tool that you linked to contains a parser.  I never realized it before.  The main reason I hadn't noticed the parser is because I never use the tool because its such a piece of junk to actually use to manually create report descriptors. 

Anyway, having discovered that it contains a parser I wanted to import my ridiculously large report descriptor (1200 bytes) into DT's proprietary .HID format.  I wrote up a quick and dirty parser this morning that parses a .c source descriptor and converts it to the .HID format.  This allows a pre-existing report descriptor to be imported into the descriptor tool for debugging.

I'd like to post the source and application, but it appears your site doesn't allow attachments.  Any suggestions where or how to post it?  Otherwise I guess I'll post it on Microchip's forum and link to that.  I'd like to share my tool so others can benefit from it.

Joe

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: USBCV HID Descriptor error
« Reply #6 on: April 27, 2011, 12:19:53 pm »
I've re-enabled attachments.

Jan

jdunne

  • Member
  • ***
  • Posts: 26
Re: USBCV HID Descriptor error
« Reply #7 on: April 27, 2011, 12:33:10 pm »
From the readme.txt

HID Descriptor tool import tool
The version 2.4 HID descriptor tool from usb.org tragically doesn't contain an import .c file functionality.
It only supports its own proprietary .hid file format (which fortunately is fairly simple).
This tool is written in VB6.

This tool imports a .c file containing only the report descriptor and outputs a .hid file containing the descriptors
imported.  Note that DT.exe will choke when trying to parse the descriptor unless actually COPY the .HID file to the
folder where the dt.exe tool is located.

Limitations of the tool:  (I threw this together in 2 hours, so don't expect perfection)

1. The tool properly ignores // comment lines and BLANK lines, but does not support C style comments /* */ Remove C style comments if they are used in your application.
2. The tool looks for a comma to determine if the line contains data.  (It isn't exactly all that intelligent of a parser) This usually means you'll have to add a comma to the LAST line of your descriptor definition for the tool to find it properly.  (See the example)
3. The tool only supports ONE ITEM PER LINE!!  So, if you've got 0xC0, 0xC0 on a single line to end 2 collections, the tool will FAIL to import that line.

Enjoy.

Joe

[attachment deleted by admin]

jdunne

  • Member
  • ***
  • Posts: 26
Re: USBCV HID Descriptor error
« Reply #8 on: April 27, 2011, 03:08:00 pm »
Hello,

Having used my newly created tool to import my report descriptors into the HID report descriptor tool from usb.org, I've now solved my problems, which turned out that I had my logical minimum defined larger than my logical maximum for a few report items.

Also, the cryptic error message from USB20CV:
Code: [Select]
External report descriptor parser 0x200 warnings
External report descriptor parser 0xA errors
(3.2.61) The report descriptor returned in response to a GetDescriptor(Report)
 must be compliant with the HID specification.

As it turns out, the line that reads "External report descriptor parser 0xA errors" actually means there are 0x0A == 10 (TEN) errors in my report descriptor.  The hex formatting threw me off.  I guess that they have another formatting issue because the 0x200 warnings actually means there are 2 (TWO) warnings.

Hopefully this information helps somebody down the road.  I have wasted a day of my life on this mess.

Joe

jdunne

  • Member
  • ***
  • Posts: 26
Re: USBCV HID Descriptor error
« Reply #9 on: April 27, 2011, 03:10:09 pm »

By the way, the .hid file output from my tool needs to be copied to the same folder as the dt.exe file otherwise dt.exe throws a bunch of errors when trying to load it.


Joe

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: USBCV HID Descriptor error
« Reply #10 on: April 27, 2011, 04:51:51 pm »
Glad you found the problem.

Jan

Tsuneo

  • Frequent Contributor
  • ****
  • Posts: 145
Re: USBCV HID Descriptor error
« Reply #11 on: April 27, 2011, 11:24:34 pm »
HID descriptor tool on USB.org applies the same parser DLL (Tparse.dll) as USB20CV, supplied by Intel. But the version of the engine on HID descriptor tool is not updated so long, though those of USB20CV are often updated.

To update HID descriptor tool using USB20CV files, drag in these files from USB20CV and replace them all.

C:\Program Files\USB-IF Test Suite\USB20CV\lib\
- Tparse.dll
- dt.ini
- *.upg

And then, you'll get the same parser result on HID descriptor tool as USB20CV, also with more user-friendly error message.

Tsuneo

jdunne

  • Member
  • ***
  • Posts: 26
Re: USBCV HID Descriptor error
« Reply #12 on: April 27, 2011, 11:33:33 pm »
Tsuneo,

Thank you!  I will definitely update my descriptor tool to use the latest parser.  Its too bad they didn't include source for the tool because its quite buggy.  Hopefully the updated files will help.

Joe

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: USBCV HID Descriptor error
« Reply #13 on: April 28, 2011, 09:14:18 am »
Thanks, Tsuneo!

Jan

mihooper

  • Member
  • ***
  • Posts: 24
DTImport Tool
« Reply #14 on: March 13, 2012, 06:51:26 am »
Folks,

I am struggling with some Spectrum Digital USB code for a TI C55xx DSP (as apparently *many* people do) and would appreciate some guidance. The sample source code for the report descriptor appears to be poorly formatted:
Code: [Select]
Uint8 reportDesc[] = {0x05,0x01,0x09,0x02,0xa1,0x01,0x09,0x01,
                                   0xa1,0x00,0x05,0x09,0x19,0x01,0x29,0x03,
                                   0x15,0x00,0x25,0x01,0x95,0x03,0x75,0x01,
                                   0x81,0x02,0x95,0x01,0x75,0x05,0x81,0x01,
                                   0x05,0x01,0x09,0x30,0x09,0x31,0x09,0x38,
                                   0x15,0x81,0x25,0x7f,0x75,0x08,0x95,0x03,
                                   0x81,0x06,0xc0,0xc0};
I would like to use jdunne's DTImport tool, but since it requires that each line only contain the appropriate number of bytes, will not parse properly. Can someone help me figure out the proper formatting for this descriptor?

Guidance appreciated.

Thx,
MikeH
Thx,
MikeH