From 48adae1728c6870a88a596ea092f98c76c7586b7 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Thu, 25 Jan 2024 19:39:35 +0100 Subject: [PATCH] Fix HID mouse documentation The size of a mouse HID event is 4 bytes. PR #4473 --- app/src/usb/hid_mouse.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/usb/hid_mouse.c b/app/src/usb/hid_mouse.c index bab89940..06e2a224 100644 --- a/app/src/usb/hid_mouse.c +++ b/app/src/usb/hid_mouse.c @@ -10,7 +10,8 @@ #define HID_MOUSE_ACCESSORY_ID 2 -// 1 byte for buttons + padding, 1 byte for X position, 1 byte for Y position +// 1 byte for buttons + padding, 1 byte for X position, 1 byte for Y position, +// 1 byte for wheel motion #define HID_MOUSE_EVENT_SIZE 4 /** @@ -90,11 +91,12 @@ static const unsigned char mouse_report_desc[] = { }; /** - * A mouse HID event is 3 bytes long: + * A mouse HID event is 4 bytes long: * * - byte 0: buttons state * - byte 1: relative x motion (signed byte from -127 to 127) * - byte 2: relative y motion (signed byte from -127 to 127) + * - byte 3: wheel motion (-1, 0 or 1) * * 7 6 5 4 3 2 1 0 * +---------------+ @@ -112,7 +114,7 @@ static const unsigned char mouse_report_desc[] = { * +---------------+ * byte 2: |. . . . . . . .| relative y motion * +---------------+ - * byte 3: |. . . . . . . .| wheel motion (-1, 0 or 1) + * byte 3: |. . . . . . . .| wheel motion * +---------------+ * * As an example, here is the report for a motion of (x=5, y=-4) with left