Compiling the Report Descriptor

I managed to get my “starter” driver running by defining my report descriptor a la:

HID_REPORT_DESCRIPTOR DefaultReportDescriptor = {
// mouse.hid; built with HidDescriptor Tool (DT.exe)
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x02, // USAGE (Mouse)
0xa1, 0x01, // COLLECTION (Application)
0x09, 0x01, // USAGE (Pointer)
0xa1, 0x00, // COLLECTION (Physical)
etc.

But I need to extend it beyond the capabilities of the HidDescriptor Tool. On another forum (to which I am awaiting posting access), I saw code that looks like:

uint8 AbsoluteMouseReport = {

USAGE_PAGE1(GENERIC_DESKTOP) >> 8,
USAGE_PAGE1(GENERIC_DESKTOP) & 0xFF,
USAGE1(MOUSE) >> 8,
USAGE1(MOUSE) & 0xFF,
COLLECTION1(APPLICATION) >> 8,
COLLECTION1(APPLICATION) & 0xFF,
USAGE1(POINTER) >> 8,
etc.

Apparently somewhere there exist macros that convert the human readable report descriptors into the binary equivalent. Is this publicly available? Where might I find documenation on it?

xxxxx@novint.com wrote:

I managed to get my “starter” driver running by defining my report descriptor a la:

HID_REPORT_DESCRIPTOR DefaultReportDescriptor = {
// mouse.hid; built with HidDescriptor Tool (DT.exe)
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x02, // USAGE (Mouse)
0xa1, 0x01, // COLLECTION (Application)
0x09, 0x01, // USAGE (Pointer)
0xa1, 0x00, // COLLECTION (Physical)
etc.

Read the USB HID documentation, it takes about 30 minutes to understand
the layout of a descriptor and create one ‘by hand’.

Pete

But I need to extend it beyond the capabilities of the HidDescriptor Tool. On another forum (to which I am awaiting posting access), I saw code that looks like:

uint8 AbsoluteMouseReport = {

USAGE_PAGE1(GENERIC_DESKTOP) >> 8,
USAGE_PAGE1(GENERIC_DESKTOP) & 0xFF,
USAGE1(MOUSE) >> 8,
USAGE1(MOUSE) & 0xFF,
COLLECTION1(APPLICATION) >> 8,
COLLECTION1(APPLICATION) & 0xFF,
USAGE1(POINTER) >> 8,
etc.

Apparently somewhere there exist macros that convert the human readable report descriptors into the binary equivalent. Is this publicly available? Where might I find documenation on it?


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


Kernel Drivers
Windows File System and Device Driver Consulting
www.KernelDrivers.com
866.263.9295

From: “Peter Scott”
> Read the USB HID documentation, it takes about 30 minutes to understand
> the layout of a descriptor and create one ‘by hand’.

Hmm. I must be stupid, then, because it took me several weeks to understand
that very dense spec to the point where I could build HID descriptors and
write the chapter on HID for my long-ago book, even WITH the help of
HIDTOOL – which isn’t available any more, SFAIK.

I feel the OP’s pain. You have to already understand the HID spec before you
can understand the HID spec.

Walter Oney
Consulting and Training
www.oneysoft.com

Walter Oney wrote:

From: “Peter Scott”
>> Read the USB HID documentation, it takes about 30 minutes to
>> understand the layout of a descriptor and create one ‘by hand’.
>
> Hmm. I must be stupid, then, because it took me several weeks to
> understand that very dense spec to the point where I could build HID
> descriptors and write the chapter on HID for my long-ago book, even WITH
> the help of HIDTOOL – which isn’t available any more, SFAIK.
>

Honestly, I am a file system person, not a HID driver person. I had
never written a HID descriptor and had a client which I wrote a
multi-touch driver, including the multi-touch interface, digitizer,
mouse and 4 custom collections with features and reports. I grabbed the
USB document, read the section on the layout of HID descriptors and was
writing my descriptor in under an hour, without HIDTool (didn’t even
know one existed). I found it to be quite straight forward but then
again, I enjoy understanding that type of thing. True, it took me
another day to get everything right in the descriptor but that was more
a typo problem than an understanding problem.

Pete

> I feel the OP’s pain. You have to already understand the HID spec before
> you can understand the HID spec.
>
> Walter Oney
> Consulting and Training
> www.oneysoft.com
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer


Kernel Drivers
Windows File System and Device Driver Consulting
www.KernelDrivers.com
866.263.9295

Well, I suppose I could have done a better job articulating my question. I know how to write a human-readable descriptor, full of words like COLLECTION and USAGE_PAGE. What I am looking for is how this gets converted into binary numbers like 0x05, 0x01 for USAGE PAGE (Generic Desktop) and 0xa1, 0x01 for COLLECTION (Application). The HID Description Tool is hopelessly out of date, and I can’t find documentation on what appears to be a suite of macros that expand into the binary values. Does anyone reading this know where the macros live and are documented?