forked from kofal.net/zmk
feat(usb): Add boot protocol support
* USB boot protocol support * Use a single definition of a boot report, used for regular reports in non-6KRO, and for rollover in all branches. * Handle gaps in the zmk report when producing a boot report in HKRO mode. For .example, if it was 8KRO, it would be possible to have the state 0 0 0 0 0 0 0 17 (by pressing 8 keys, and letting go of the first 7). Copying the first 6 bytes would not show up the single pressed key. * Disable usb status change and callback on SOF events: SOF events were introduced by the boot protocol changes, and required internally by Zephyr's idle support, but are unused within ZMK itself. Ignore them in the usb status callback. --------- Co-authored-by: Andrew Childs <lorne@cons.org.nz>
This commit is contained in:
@@ -121,12 +121,10 @@ struct zmk_endpoint_instance zmk_endpoints_selected(void) {
|
||||
}
|
||||
|
||||
static int send_keyboard_report(void) {
|
||||
struct zmk_hid_keyboard_report *keyboard_report = zmk_hid_get_keyboard_report();
|
||||
|
||||
switch (current_instance.transport) {
|
||||
#if IS_ENABLED(CONFIG_ZMK_USB)
|
||||
case ZMK_TRANSPORT_USB: {
|
||||
int err = zmk_usb_hid_send_report((uint8_t *)keyboard_report, sizeof(*keyboard_report));
|
||||
int err = zmk_usb_hid_send_keyboard_report();
|
||||
if (err) {
|
||||
LOG_ERR("FAILED TO SEND OVER USB: %d", err);
|
||||
}
|
||||
@@ -136,6 +134,7 @@ static int send_keyboard_report(void) {
|
||||
|
||||
#if IS_ENABLED(CONFIG_ZMK_BLE)
|
||||
case ZMK_TRANSPORT_BLE: {
|
||||
struct zmk_hid_keyboard_report *keyboard_report = zmk_hid_get_keyboard_report();
|
||||
int err = zmk_hog_send_keyboard_report(&keyboard_report->body);
|
||||
if (err) {
|
||||
LOG_ERR("FAILED TO SEND OVER HOG: %d", err);
|
||||
@@ -150,12 +149,10 @@ static int send_keyboard_report(void) {
|
||||
}
|
||||
|
||||
static int send_consumer_report(void) {
|
||||
struct zmk_hid_consumer_report *consumer_report = zmk_hid_get_consumer_report();
|
||||
|
||||
switch (current_instance.transport) {
|
||||
#if IS_ENABLED(CONFIG_ZMK_USB)
|
||||
case ZMK_TRANSPORT_USB: {
|
||||
int err = zmk_usb_hid_send_report((uint8_t *)consumer_report, sizeof(*consumer_report));
|
||||
int err = zmk_usb_hid_send_consumer_report();
|
||||
if (err) {
|
||||
LOG_ERR("FAILED TO SEND OVER USB: %d", err);
|
||||
}
|
||||
@@ -165,6 +162,7 @@ static int send_consumer_report(void) {
|
||||
|
||||
#if IS_ENABLED(CONFIG_ZMK_BLE)
|
||||
case ZMK_TRANSPORT_BLE: {
|
||||
struct zmk_hid_consumer_report *consumer_report = zmk_hid_get_consumer_report();
|
||||
int err = zmk_hog_send_consumer_report(&consumer_report->body);
|
||||
if (err) {
|
||||
LOG_ERR("FAILED TO SEND OVER HOG: %d", err);
|
||||
|
||||
Reference in New Issue
Block a user