Skip to content

Commit

Permalink
fw: switch the mouse wheel descriptor to 16 bits
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiobaltieri committed Oct 8, 2024
1 parent ae3d52e commit 9c6749f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions firmware/include/dt-bindings/hid.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@

#define HID_MOUSE_REPORT(id) \
HID_MOUSE_REPORT_HEADER(id) \
0x15 0x81 /* Logical Minimum (-127) */ \
0x25 0x7f /* Logical Maximum (127) */ \
0x75 0x08 /* Report Size (8) */ \
0x16 0x01 0x80 /* Logical Minimum (-32767) */ \
0x26 0xff 0x7f /* Logical Maximum (32767) */ \
0x75 0x10 /* Report Size (16) */ \
0x95 0x01 /* Report Count (1) */ \
0x09 0x38 /* Usage (Wheel) */ \
0x81 0x06 /* Input (Data,Var,Rel) */ \
Expand All @@ -110,11 +110,11 @@
0x45 0x78 /* Physical Maximum (120) */ \
0xb1 0x02 /* Feature (Data,Var,Abs) */ \
0x85 id /* Report ID () */ \
0x15 0x81 /* Logical Minimum (-127) */ \
0x25 0x7f /* Logical Maximum (127) */ \
0x16 0x01 0x80 /* Logical Minimum (-32767) */ \
0x26 0xff 0x7f /* Logical Maximum (32767) */ \
0x35 0x00 /* Physical Minimum (0) */ \
0x45 0x00 /* Physical Maximum (0) */ \
0x75 0x08 /* Report Size (8) */ \
0x75 0x10 /* Report Size (16) */ \
0x95 0x01 /* Report Count (1) */ \
0x09 0x38 /* Usage (Wheel) */ \
0x81 0x06 /* Input (Data,Var,Rel) */ \
Expand Down
4 changes: 2 additions & 2 deletions firmware/src/hid_mouse.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ struct hid_mouse_report {
uint8_t buttons;
int16_t x;
int16_t y;
int8_t wheel;
int16_t wheel;
} __packed;

struct hid_mouse_config {
Expand Down Expand Up @@ -80,7 +80,7 @@ static void hid_mouse_set_rel(struct hid_mouse_report *report,
break;
case INPUT_REL_WHEEL:
report->wheel = CLAMP(report->wheel + value,
INT8_MIN, INT8_MAX);
INT16_MIN, INT16_MAX);
break;
default:
return;
Expand Down

0 comments on commit 9c6749f

Please sign in to comment.