Enable USB boot protocol by default and fix ifdefs

This commit is contained in:
Ryan P. Bitanga 2022-02-21 16:19:58 +08:00
parent d91926211a
commit c32a5e9f73
3 changed files with 8 additions and 3 deletions

View file

@ -82,8 +82,6 @@ config ZMK_USB
select USB
select USB_DEVICE_STACK
select USB_DEVICE_HID
select USB_DEVICE_SOF
select USB_HID_BOOT_PROTOCOL
if ZMK_USB
@ -92,6 +90,9 @@ config USB_NUMOF_EP_WRITE_RETRIES
config ZMK_USB_BOOT
bool "USB Boot Protocol Support"
default y
select USB_HID_BOOT_PROTOCOL
select USB_DEVICE_SOF
if ZMK_USB_BOOT

View file

@ -110,6 +110,7 @@ static zmk_hid_boot_report_t error_report = {
#define TOGGLE_KEYBOARD(code, val) WRITE_BIT(keyboard_report.body.keys[code / 8], code % 8, val)
#if IS_ENABLED(CONFIG_ZMK_USB_BOOT)
static zmk_hid_boot_report_t *get_boot_report() {
HID_CHECK_ROLLOVER_ERROR();
@ -130,6 +131,7 @@ static zmk_hid_boot_report_t *get_boot_report() {
}
return &boot_report;
}
#endif
static inline int select_keyboard_usage(zmk_key_t usage) {
if (usage > ZMK_HID_KEYBOARD_NKRO_MAX_USAGE) {
@ -166,6 +168,7 @@ static inline int deselect_keyboard_usage(zmk_key_t usage) {
} \
}
#if IS_ENABLED(CONFIG_ZMK_USB_BOOT)
static zmk_hid_boot_report_t *get_boot_report() {
HID_CHECK_ROLLOVER_ERROR();
#if CONFIG_ZMK_HID_KEYBOARD_REPORT_SIZE != HID_BOOT_KEY_LEN
@ -177,6 +180,7 @@ static zmk_hid_boot_report_t *get_boot_report() {
return &keyboard_report.body;
#endif
}
#endif
static inline int select_keyboard_usage(zmk_key_t usage) {
TOGGLE_KEYBOARD(0U, usage);

View file

@ -103,7 +103,7 @@ int zmk_usb_hid_send_report(uint8_t report_id) {
report = zmk_hid_get_keyboard_report(HID_REPORT_FULL, hid_protocol);
len = hid_protocol == HID_PROTOCOL_BOOT ? sizeof(zmk_hid_boot_report_t) : sizeof(struct zmk_hid_keyboard_report);
#else
report = zmk_hid_get_keyboard_report(HID_REPORT_FULL, hid_protocol);
report = zmk_hid_get_keyboard_report(HID_REPORT_FULL, HID_PROTOCOL_REPORT);
len = sizeof(struct zmk_hid_keyboard_report);
#endif
} else {