From 4b9607dbc3a5227709302e8f9a4d3d16e41eb15c Mon Sep 17 00:00:00 2001 From: Robert Fisk Date: Thu, 28 Apr 2016 11:37:42 +1200 Subject: [PATCH] HID parser and wheel support works! --- Downstream/Src/downstream_hid.c | 4 ++-- Upstream/Src/upstream_hid.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Downstream/Src/downstream_hid.c b/Downstream/Src/downstream_hid.c index 79c2f9c..095ab1c 100644 --- a/Downstream/Src/downstream_hid.c +++ b/Downstream/Src/downstream_hid.c @@ -170,7 +170,7 @@ HAL_StatusTypeDef Downstream_HID_Mouse_ParseReportDescriptor(void) ReportYBitOffset = currentReportBitIndex + (currentReportSize * yUsageIndex); ReportYBitLength = currentReportSize; } - if (xUsageIndex != 0xFF) + if (wheelUsageIndex != 0xFF) { ReportWheelBitOffset = currentReportBitIndex + (currentReportSize * wheelUsageIndex); ReportWheelBitLength = currentReportSize; @@ -179,7 +179,7 @@ HAL_StatusTypeDef Downstream_HID_Mouse_ParseReportDescriptor(void) break; } currentReportBitIndex += (currentReportSize * currentReportCount); - if (currentReportBitIndex < (HID_MAX_REPORT_LEN * 8)) + if (currentReportBitIndex >= (HID_MAX_REPORT_LEN * 8)) { return HAL_ERROR; } diff --git a/Upstream/Src/upstream_hid.c b/Upstream/Src/upstream_hid.c index c131441..5ff95c4 100644 --- a/Upstream/Src/upstream_hid.c +++ b/Upstream/Src/upstream_hid.c @@ -17,7 +17,7 @@ #include "usbd_hid.h" -#define HID_MOUSE_DATA_LEN 3 +#define HID_MOUSE_DATA_LEN 4 #define HID_KEYBOARD_DATA_LEN 0