Commit d704c99
authored
Discard high nibble when decoding Unit Exponent (#17)
HidSharp assumes the high nibble in a unit exponent field is meaningful, while the HID Usage Tables 1.3 defines the unit exponent as a 4-bit value (Exponent 0 through F, page 302 / 303). Report Descriptors only support values in multitudes of 8 bits, so the first 4 bits are padding / meaningless. This means we should ignore the high nibble when decoding the report descriptor and not make any assumptions about its meaning.
There are some devices which define the unit exponent as 0xF0 through 0xFF. Reconstructing the report descriptor fails on these devices.
This is how the Linux kernel does it as well: https://github.com/torvalds/linux/blob/master/drivers/hid/hid-core.c#L4271 parent c6e9365 commit d704c99
1 file changed
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
| 67 | + | |
66 | 68 | | |
67 | 69 | | |
68 | 70 | | |
69 | 71 | | |
70 | 72 | | |
71 | | - | |
| 73 | + | |
72 | 74 | | |
73 | 75 | | |
74 | 76 | | |
| |||
0 commit comments