diff --git a/app/include/dt-bindings/zmk/mouse.h b/app/include/dt-bindings/zmk/mouse.h index 4bb3064dfc47..dec99c13b65c 100644 --- a/app/include/dt-bindings/zmk/mouse.h +++ b/app/include/dt-bindings/zmk/mouse.h @@ -21,9 +21,3 @@ #define MB4 (0x08) #define MB5 (0x10) - -#define MB6 (0x20) - -#define MB7 (0x40) - -#define MB8 (0x80) diff --git a/app/include/zmk/hid.h b/app/include/zmk/hid.h index e3f8cd6934b6..a499d0afdcba 100644 --- a/app/include/zmk/hid.h +++ b/app/include/zmk/hid.h @@ -99,12 +99,26 @@ static const uint8_t zmk_hid_report_desc[] = { HID_COLLECTION(HID_COLLECTION_PHYSICAL), HID_USAGE_PAGE(HID_USAGE_BUTTON), HID_USAGE_MIN8(0x1), - HID_USAGE_MAX8(0x10), + HID_USAGE_MAX8(0x5), HID_LOGICAL_MIN8(0x00), HID_LOGICAL_MAX8(0x01), HID_REPORT_SIZE(0x01), - HID_REPORT_COUNT(0x10), + HID_REPORT_COUNT(0x5), HID_INPUT(0x02), + // Constant padding for the last 3 bits. + HID_REPORT_SIZE(0x03), + HID_REPORT_COUNT(0x01), + HID_INPUT(0x01), + // Some OSes ignore pointer devices without X/Y data. + HID_USAGE_PAGE(HID_USAGE_GEN_DESKTOP), + HID_USAGE(HID_USAGE_GD_X), + HID_USAGE(HID_USAGE_GD_Y), + HID_USAGE(HID_USAGE_GD_WHEEL), + HID_LOGICAL_MIN8(-0x7F), + HID_LOGICAL_MAX8(0x7F), + HID_REPORT_SIZE(0x08), + HID_REPORT_COUNT(0x03), + HID_INPUT(0x06), HID_END_COLLECTION, HID_END_COLLECTION, }; @@ -146,6 +160,9 @@ struct zmk_hid_consumer_report { struct zmk_hid_mouse_report_body { zmk_mouse_button_flags_t buttons; + int8_t d_x; + int8_t d_y; + int8_t d_wheel; } __packed; struct zmk_hid_mouse_report { diff --git a/app/include/zmk/mouse.h b/app/include/zmk/mouse.h index b48f0085743b..d873f15689a7 100644 --- a/app/include/zmk/mouse.h +++ b/app/include/zmk/mouse.h @@ -8,5 +8,5 @@ #include -typedef uint16_t zmk_mouse_button_flags_t; +typedef uint8_t zmk_mouse_button_flags_t; typedef uint16_t zmk_mouse_button_t;