Correctly parse HID report descriptor items with unusual lengths.

Thanks Logitech.
USG_1.0
Robert Fisk 8 years ago
parent e63525f868
commit a98af92c23

@ -33,25 +33,26 @@
//Stuff for parsing HID descriptors:
#define HID_ITEM_LONG 0xFE
#define HID_ITEM_MASK 0xFC
#define HID_ITEM_LENGTH_MASK 0x03
#define HID_ITEM_USAGE_PAGE 0x05 //'global' usage page
#define HID_ITEM_USAGE_PAGE 0x04 //'global' usage page
#define HID_ITEM_USAGE_PAGE_BUTTON 0x09
#define HID_ITEM_USAGE_PAGE_DESKTOP 0x01
#define HID_ITEM_COLLECTION 0xA1
#define HID_ITEM_COLLECTION 0xA0
#define HID_ITEM_COLLECTION_PHYS 0x00
#define HID_ITEM_END_COLLECTION 0xC0
#define HID_ITEM_USAGE 0x09 //'local' usage
#define HID_ITEM_USAGE 0x08 //'local' usage
#define HID_ITEM_USAGE_X 0x30
#define HID_ITEM_USAGE_Y 0x31
#define HID_ITEM_USAGE_WHEEL 0x38
#define HID_ITEM_REPORT_SIZE 0x75 //'global' report size
#define HID_ITEM_REPORT_COUNT 0x95 //'global' report count
#define HID_ITEM_REPORT_SIZE 0x74 //'global' report size
#define HID_ITEM_REPORT_COUNT 0x94 //'global' report count
#define HID_ITEM_INPUT 0x81 //'main' input
#define HID_ITEM_INPUT 0x80 //'main' input
#define HID_ITEM_INPUT_ABS 0x02
#define HID_ITEM_INPUT_REL 0x06

@ -93,7 +93,7 @@ static HAL_StatusTypeDef Downstream_HID_Mouse_ParseReportDescriptor(void)
(ReportYBitLength == 0) ||
(ReportWheelBitLength == 0)))
{
switch (ItemHeader)
switch (ItemHeader & HID_ITEM_MASK)
{
case HID_ITEM_USAGE_PAGE:
currentUsagePage = ItemData;

Loading…
Cancel
Save