|
|
@ -7,7 +7,8 @@ |
|
|
|
#pragma once |
|
|
|
#pragma once |
|
|
|
|
|
|
|
|
|
|
|
#include <usb/usb_device.h> |
|
|
|
#include <usb/usb_device.h> |
|
|
|
#include <usb/class/usb_hid.h> |
|
|
|
//#include <usb/class/usb_hid.h>
|
|
|
|
|
|
|
|
#include <usb/class/hid.h> |
|
|
|
|
|
|
|
|
|
|
|
#include <zmk/keys.h> |
|
|
|
#include <zmk/keys.h> |
|
|
|
#include <zmk/mouse.h> |
|
|
|
#include <zmk/mouse.h> |
|
|
@ -85,122 +86,86 @@ static const uint8_t zmk_hid_report_desc[] = { |
|
|
|
#error "A proper consumer HID report usage range must be selected" |
|
|
|
#error "A proper consumer HID report usage range must be selected" |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
/* REPORT_COUNT (CONFIG_ZMK_HID_CONSUMER_REPORT_SIZE) */ |
|
|
|
/* REPORT_COUNT (CONFIG_ZMK_HID_CONSUMER_REPORT_SIZE) */ |
|
|
|
HID_GI_REPORT_COUNT, |
|
|
|
HID_REPORT_COUNT(CONFIG_ZMK_HID_CONSUMER_REPORT_SIZE), |
|
|
|
CONFIG_ZMK_HID_CONSUMER_REPORT_SIZE, |
|
|
|
HID_INPUT(0x00), |
|
|
|
HID_MI_INPUT, |
|
|
|
|
|
|
|
0x00, |
|
|
|
0x00, |
|
|
|
/* END COLLECTION */ |
|
|
|
/* END COLLECTION */ |
|
|
|
HID_MI_COLLECTION_END, |
|
|
|
HID_END_COLLECTION, |
|
|
|
|
|
|
|
|
|
|
|
/* USAGE_PAGE (Generic Desktop) */ |
|
|
|
/* USAGE_PAGE (Generic Desktop) */ |
|
|
|
HID_GI_USAGE_PAGE, |
|
|
|
HID_USAGE_PAGE(HID_USAGE_GD), |
|
|
|
HID_USAGE_GD, |
|
|
|
|
|
|
|
/* USAGE (Mouse) */ |
|
|
|
/* USAGE (Mouse) */ |
|
|
|
HID_LI_USAGE, |
|
|
|
HID_USAGE(HID_USAGE_GD_MOUSE), |
|
|
|
HID_USAGE_GD_MOUSE, |
|
|
|
|
|
|
|
/* COLLECTION (Application) */ |
|
|
|
/* COLLECTION (Application) */ |
|
|
|
HID_MI_COLLECTION, |
|
|
|
HID_COLLECTION(HID_COLLECTION_APPLICATION), |
|
|
|
COLLECTION_APPLICATION, |
|
|
|
|
|
|
|
/* REPORT ID (4) */ |
|
|
|
/* REPORT ID (4) */ |
|
|
|
HID_GI_REPORT_ID, |
|
|
|
HID_REPORT_ID(0x04), |
|
|
|
0x04, |
|
|
|
|
|
|
|
/* USAGE (Pointer) */ |
|
|
|
/* USAGE (Pointer) */ |
|
|
|
HID_LI_USAGE, |
|
|
|
HID_USAGE(HID_USAGE_GD_POINTER), |
|
|
|
HID_USAGE_GD_POINTER, |
|
|
|
|
|
|
|
/* COLLECTION (Physical) */ |
|
|
|
/* COLLECTION (Physical) */ |
|
|
|
HID_MI_COLLECTION, |
|
|
|
HID_COLLECTION(HID_COLLECTION_PHYSICAL), |
|
|
|
COLLECTION_PHYSICAL, |
|
|
|
|
|
|
|
/* USAGE_PAGE (Button) */ |
|
|
|
/* USAGE_PAGE (Button) */ |
|
|
|
HID_GI_USAGE_PAGE, |
|
|
|
HID_USAGE_PAGE(HID_USAGE_BUTTON), |
|
|
|
HID_USAGE_BUTTON, |
|
|
|
|
|
|
|
/* USAGE_MINIMUM (0x1) (button 1?) */ |
|
|
|
/* USAGE_MINIMUM (0x1) (button 1?) */ |
|
|
|
HID_LI_USAGE_MIN(1), |
|
|
|
HID_USAGE_MIN8(0x01), |
|
|
|
0x1, |
|
|
|
|
|
|
|
/* USAGE_MAXIMUM (0x10) (button 5? Buttons up to 8 still work) */ |
|
|
|
/* USAGE_MAXIMUM (0x10) (button 5? Buttons up to 8 still work) */ |
|
|
|
HID_LI_USAGE_MAX(1), |
|
|
|
HID_USAGE_MAX8(0x10), |
|
|
|
0x10, |
|
|
|
|
|
|
|
/* LOGICAL_MINIMUM (0) */ |
|
|
|
/* LOGICAL_MINIMUM (0) */ |
|
|
|
HID_GI_LOGICAL_MIN(1), |
|
|
|
HID_LOGICAL_MIN8(0x00), |
|
|
|
0x00, |
|
|
|
|
|
|
|
/* LOGICAL_MAXIMUM (1) */ |
|
|
|
/* LOGICAL_MAXIMUM (1) */ |
|
|
|
HID_GI_LOGICAL_MAX(1), |
|
|
|
HID_LOGICAL_MAX8(0x01), |
|
|
|
0x01, |
|
|
|
|
|
|
|
/* REPORT_SIZE (1) */ |
|
|
|
/* REPORT_SIZE (1) */ |
|
|
|
HID_GI_REPORT_SIZE, |
|
|
|
HID_REPORT_SIZE(0x01), |
|
|
|
0x01, |
|
|
|
|
|
|
|
/* REPORT_COUNT (16) */ |
|
|
|
/* REPORT_COUNT (16) */ |
|
|
|
HID_GI_REPORT_COUNT, |
|
|
|
HID_REPORT_COUNT(0x10), |
|
|
|
0x10, |
|
|
|
|
|
|
|
/* INPUT (Data,Var,Abs) */ |
|
|
|
/* INPUT (Data,Var,Abs) */ |
|
|
|
HID_MI_INPUT, |
|
|
|
HID_INPUT(0x02), |
|
|
|
0x02, |
|
|
|
|
|
|
|
/* USAGE_PAGE (Generic Desktop) */ |
|
|
|
/* USAGE_PAGE (Generic Desktop) */ |
|
|
|
HID_GI_USAGE_PAGE, |
|
|
|
HID_USAGE_PAGE(HID_USAGE_GD), |
|
|
|
HID_USAGE_GD, |
|
|
|
|
|
|
|
/* LOGICAL_MINIMUM (-32767) */ |
|
|
|
/* LOGICAL_MINIMUM (-32767) */ |
|
|
|
HID_GI_LOGICAL_MIN(2), |
|
|
|
HID_LOGICAL_MIN16(0x01, 0x80), |
|
|
|
0x01, |
|
|
|
|
|
|
|
0x80, |
|
|
|
|
|
|
|
/* LOGICAL_MAXIMUM (32767) */ |
|
|
|
/* LOGICAL_MAXIMUM (32767) */ |
|
|
|
HID_GI_LOGICAL_MAX(2), |
|
|
|
HID_LOGICAL_MAX16(0xFF, 0x7F), |
|
|
|
0xFF, |
|
|
|
|
|
|
|
0x7F, |
|
|
|
|
|
|
|
/* REPORT_SIZE (16) */ |
|
|
|
/* REPORT_SIZE (16) */ |
|
|
|
HID_GI_REPORT_SIZE, |
|
|
|
HID_REPORT_SIZE(0x10), |
|
|
|
0x10, |
|
|
|
|
|
|
|
/* REPORT_COUNT (2) */ |
|
|
|
/* REPORT_COUNT (2) */ |
|
|
|
HID_GI_REPORT_COUNT, |
|
|
|
HID_REPORT_COUNT(0x02), |
|
|
|
0x02, |
|
|
|
|
|
|
|
/* USAGE (X) */ // Vertical scroll
|
|
|
|
/* USAGE (X) */ // Vertical scroll
|
|
|
|
HID_LI_USAGE, |
|
|
|
HID_USAGE(HID_USAGE_GD_X), |
|
|
|
HID_USAGE_GD_X, |
|
|
|
|
|
|
|
/* USAGE (Y) */ |
|
|
|
/* USAGE (Y) */ |
|
|
|
HID_LI_USAGE, |
|
|
|
HID_USAGE(HID_USAGE_GD_Y), |
|
|
|
HID_USAGE_GD_Y, |
|
|
|
|
|
|
|
/* Input (Data,Var,Rel) */ |
|
|
|
/* Input (Data,Var,Rel) */ |
|
|
|
HID_MI_INPUT, |
|
|
|
HID_INPUT(0x06), |
|
|
|
0x06, |
|
|
|
|
|
|
|
/* LOGICAL_MINIMUM (-127) */ |
|
|
|
/* LOGICAL_MINIMUM (-127) */ |
|
|
|
HID_GI_LOGICAL_MIN(1), |
|
|
|
HID_LOGICAL_MIN8(0x81), |
|
|
|
0x81, |
|
|
|
|
|
|
|
/* LOGICAL_MAXIMUM (127) */ |
|
|
|
/* LOGICAL_MAXIMUM (127) */ |
|
|
|
HID_GI_LOGICAL_MAX(1), |
|
|
|
HID_LOGICAL_MAX8(0x7F), |
|
|
|
0x7F, |
|
|
|
|
|
|
|
/* REPORT_SIZE (8) */ |
|
|
|
/* REPORT_SIZE (8) */ |
|
|
|
HID_GI_REPORT_SIZE, |
|
|
|
HID_REPORT_SIZE(0x08), |
|
|
|
0x08, |
|
|
|
|
|
|
|
/* REPORT_COUNT (1) */ |
|
|
|
/* REPORT_COUNT (1) */ |
|
|
|
HID_GI_REPORT_COUNT, |
|
|
|
HID_REPORT_COUNT(0x01), |
|
|
|
0x01, |
|
|
|
|
|
|
|
/* USAGE (Wheel) */ |
|
|
|
/* USAGE (Wheel) */ |
|
|
|
HID_LI_USAGE, |
|
|
|
HID_USAGE(HID_USAGE_GD_WHEEL), |
|
|
|
HID_USAGE_GD_WHEEL, |
|
|
|
|
|
|
|
/* Input (Data,Var,Rel) */ |
|
|
|
/* Input (Data,Var,Rel) */ |
|
|
|
HID_MI_INPUT, |
|
|
|
HID_INPUT(0x06), |
|
|
|
0x06, |
|
|
|
|
|
|
|
/* USAGE_PAGE (Consumer) */ // Horizontal scroll
|
|
|
|
/* USAGE_PAGE (Consumer) */ // Horizontal scroll
|
|
|
|
HID_GI_USAGE_PAGE, |
|
|
|
HID_USAGE_PAGE(HID_USAGE_CONSUMER), |
|
|
|
HID_USAGE_CONSUMER, |
|
|
|
|
|
|
|
/* USAGE (AC Pan) */ |
|
|
|
/* USAGE (AC Pan) */ |
|
|
|
0x0A, |
|
|
|
0x0A, |
|
|
|
0x38, |
|
|
|
0x38, |
|
|
|
0x02, |
|
|
|
0x02, |
|
|
|
/* LOGICAL_MINIMUM (-127) */ |
|
|
|
/* LOGICAL_MINIMUM (-127) */ |
|
|
|
HID_GI_LOGICAL_MIN(1), |
|
|
|
HID_LOGICAL_MIN8(0x81), |
|
|
|
0x81, |
|
|
|
|
|
|
|
/* LOGICAL_MAXIMUM (127) */ |
|
|
|
/* LOGICAL_MAXIMUM (127) */ |
|
|
|
HID_GI_LOGICAL_MAX(1), |
|
|
|
HID_LOGICAL_MAX8(0x7F), |
|
|
|
0x7F, |
|
|
|
|
|
|
|
/* REPORT_COUNT (1) */ |
|
|
|
/* REPORT_COUNT (1) */ |
|
|
|
HID_GI_REPORT_COUNT, |
|
|
|
HID_REPORT_COUNT(0x01), |
|
|
|
0x01, |
|
|
|
|
|
|
|
/* Input (Data,Var,Rel) */ |
|
|
|
/* Input (Data,Var,Rel) */ |
|
|
|
HID_MI_INPUT, |
|
|
|
HID_INPUT(0x06), |
|
|
|
0x06, |
|
|
|
|
|
|
|
/* END COLLECTION */ |
|
|
|
/* END COLLECTION */ |
|
|
|
HID_MI_COLLECTION_END, |
|
|
|
HID_END_COLLECTION, |
|
|
|
/* END COLLECTION */ |
|
|
|
/* END COLLECTION */ |
|
|
|
HID_MI_COLLECTION_END, |
|
|
|
HID_END_COLLECTION, |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// struct zmk_hid_boot_report
|
|
|
|
// struct zmk_hid_boot_report
|
|
|
|