[4/13](resend)hidclass.sys: Add USB Descriptor parsing

Aric Stewart aric at codeweavers.com
Thu Sep 3 07:09:59 CDT 2015


Thanks for the review:

On 9/2/15 1:53 PM, Andrew Eikum wrote:
> A couple small notes inline below.
> 
>> +        bSize = (bSize == 3) ? 4 : bSize;
>> +        if (bType == 0x03 && bTag == 0x0F && bSize == 2 && i + 2 < length)
>> +        {
>> +            /* Long data items: Should be unused */
>> +            ERR("Long Data Item, should be unused\n");
> 
> This confused me. Is this a malformed report from the HID or something
> Wine doesn't yet support?

It is in the spec but my reading I found statements that it was an option that was unused. So I wanted to highlight it if it was found but did not need to handle it.

> 
>
>> +            if (bType == 0x00)
>> +            {
>> +                struct feature *feature;
>> +                switch(bTag)
>> +                {
>> +                    case 0x08:
> 
> Here and elsewhere, there's a lot of magic numbers. Do these have
> names in the standard? Could you make up names for them? TAG_INPUT or
> something. Or is it more useful to have the raw numbers?

All these magic number have defined tags as per the USB spec. I was really hoping to find a nice header file where they where all defined but while there are a lot of document describing them and tools to turn the tags into numbers there was not clean header file. I chose to keep the numbers as numbers to avoid a lot of #defines. But that was just a personal choice. USB Report Descriptors are almost always written in a format like:

    0x05, 0x01,                    // USAGE_PAGE (Generic Desktop)
    0x09, 0x05,                    // USAGE (Game Pad)
    0xa1, 0x01,                    // COLLECTION (Application)
    0xa1, 0x00,                    //   COLLECTION (Physical)
    0x85, 0x01, 		  //     REPORT_ID (1)
  ...
Where the hex values are the actual values in the report and the comments have the human readable meanings.

Other comments are being integrated and the patch resent

thanks again!
-aric





More information about the wine-devel mailing list