Skip to content

Commit

Permalink
fix(usb): Build with ZMK_USB_BOOT disabled.
Browse files Browse the repository at this point in the history
* Invert the logic so `get_keyboard_report` is sane when `ZMK_USB_BOOT`
  is disabled.
  • Loading branch information
petejohanson committed Nov 14, 2023
1 parent 2a1904e commit f6716f8
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions app/src/usb_hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ void zmk_usb_hid_set_protocol(uint8_t protocol) { hid_protocol = protocol; }
#endif /* IS_ENABLED(CONFIG_ZMK_USB_BOOT) */

static uint8_t *get_keyboard_report(size_t *len) {
if (hid_protocol == HID_PROTOCOL_REPORT) {
struct zmk_hid_keyboard_report *report = zmk_hid_get_keyboard_report();
*len = sizeof(*report);
return (uint8_t *)report;
}
#if IS_ENABLED(CONFIG_ZMK_USB_BOOT)
zmk_hid_boot_report_t *boot_report = zmk_hid_get_boot_report();
*len = sizeof(*boot_report);
return (uint8_t *)boot_report;
if (hid_protocol != HID_PROTOCOL_REPORT) {
zmk_hid_boot_report_t *boot_report = zmk_hid_get_boot_report();
*len = sizeof(*boot_report);
return (uint8_t *)boot_report;
}
#endif
struct zmk_hid_keyboard_report *report = zmk_hid_get_keyboard_report();
*len = sizeof(*report);
return (uint8_t *)report;
}

static int get_report_cb(const struct device *dev, struct usb_setup_packet *setup, int32_t *len,
Expand Down

0 comments on commit f6716f8

Please sign in to comment.