Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include redundant report descriptor fields #45

Open
FlorianUekermann opened this issue Aug 13, 2022 · 1 comment
Open

Include redundant report descriptor fields #45

FlorianUekermann opened this issue Aug 13, 2022 · 1 comment

Comments

@FlorianUekermann
Copy link

I use the gen_hid_descriptor macro like this:

#[gen_hid_descriptor(
    (collection = APPLICATION, usage_page = 0xaaaa, usage = 0xaa) = {
        (usage = 0xbb,) = {
            input_buffer = input;
        };
        (usage = 0xcc,) = {
            output_buffer = output;
        };
    }
)]
pub struct Report {
    input_buffer: [u8; 64],
    output_buffer: [u8; 64],
}

the resulting descriptor looks like this:

0x06, 0xAA, 0xAA,  // Usage Page (Reserved 0xAAAA)
0x09, 0xAA,        // Usage (0xAA)
0xA1, 0x01,        // Collection (Application)
0x09, 0xAA,        //   Usage (0xBB)
0x15, 0x00,        //   Logical Minimum (0)
0x26, 0xFF, 0x00,  //   Logical Maximum (255)
0x75, 0x08,        //   Report Size (8)
0x95, 0x40,        //   Report Count (64)
0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x09, 0xBB,        //   Usage (0xCC)
0x91, 0x02,        //   Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0xC0,              // End Collection

As you can see, the logical min & max, as well as report size & count are skipped for the output. I suspect this is correct and because they are identical to the input (I'm not an expert on HID). However, I'm need them to be in there for robust device discovery. It would be great if I could disable this optimization somehow.

@FlorianUekermann FlorianUekermann changed the title skipped report descriptor fields Include redundant report descriptor fields Aug 13, 2022
@twitchyliquid64
Copy link
Owner

Logical min/max are global items right? so the parser should remember + use the last value.

Theres a lot of bugs caused by buggy parsers, I agree we need a quirk setting to emit all the items for every input/output thats declared.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants