diff options
Diffstat (limited to 'tmk_core/common/host.c')
-rw-r--r-- | tmk_core/common/host.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tmk_core/common/host.c b/tmk_core/common/host.c index e12b62216..f5d041699 100644 --- a/tmk_core/common/host.c +++ b/tmk_core/common/host.c | |||
@@ -22,6 +22,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
22 | #include "util.h" | 22 | #include "util.h" |
23 | #include "debug.h" | 23 | #include "debug.h" |
24 | 24 | ||
25 | #ifdef NKRO_ENABLE | ||
26 | #include "keycode_config.h" | ||
27 | extern keymap_config_t keymap_config; | ||
28 | #endif | ||
29 | |||
25 | static host_driver_t *driver; | 30 | static host_driver_t *driver; |
26 | static uint16_t last_system_report = 0; | 31 | static uint16_t last_system_report = 0; |
27 | static uint16_t last_consumer_report = 0; | 32 | static uint16_t last_consumer_report = 0; |
@@ -46,6 +51,20 @@ uint8_t host_keyboard_leds(void) | |||
46 | void host_keyboard_send(report_keyboard_t *report) | 51 | void host_keyboard_send(report_keyboard_t *report) |
47 | { | 52 | { |
48 | if (!driver) return; | 53 | if (!driver) return; |
54 | #if defined(NKRO_ENABLE) && defined(NKRO_SHARED_EP) | ||
55 | if (keyboard_protocol && keymap_config.nkro) { | ||
56 | /* The callers of this function assume that report->mods is where mods go in. | ||
57 | * But report->nkro.mods can be at a different offset if core keyboard does not have a report ID. | ||
58 | */ | ||
59 | report->nkro.mods = report->mods; | ||
60 | report->nkro.report_id = REPORT_ID_NKRO; | ||
61 | } else | ||
62 | #endif | ||
63 | { | ||
64 | #ifdef KEYBOARD_SHARED_EP | ||
65 | report->report_id = REPORT_ID_KEYBOARD; | ||
66 | #endif | ||
67 | } | ||
49 | (*driver->send_keyboard)(report); | 68 | (*driver->send_keyboard)(report); |
50 | 69 | ||
51 | if (debug_keyboard) { | 70 | if (debug_keyboard) { |
@@ -60,6 +79,9 @@ void host_keyboard_send(report_keyboard_t *report) | |||
60 | void host_mouse_send(report_mouse_t *report) | 79 | void host_mouse_send(report_mouse_t *report) |
61 | { | 80 | { |
62 | if (!driver) return; | 81 | if (!driver) return; |
82 | #ifdef MOUSE_SHARED_EP | ||
83 | report->report_id = REPORT_ID_MOUSE; | ||
84 | #endif | ||
63 | (*driver->send_mouse)(report); | 85 | (*driver->send_mouse)(report); |
64 | } | 86 | } |
65 | 87 | ||