aboutsummaryrefslogtreecommitdiff
path: root/common/host.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/host.c')
-rw-r--r--common/host.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/common/host.c b/common/host.c
index 8dd2abbee..fddd5b662 100644
--- a/common/host.c
+++ b/common/host.c
@@ -56,6 +56,19 @@ uint8_t host_keyboard_leds(void)
56 return (*driver->keyboard_leds)(); 56 return (*driver->keyboard_leds)();
57} 57}
58 58
59/* new interface */
60void host_register_key(uint8_t key)
61{
62 host_add_key(key);
63 host_send_keyboard_report();
64}
65
66void host_unregister_key(uint8_t key)
67{
68 host_del_key(key);
69 host_send_keyboard_report();
70}
71
59/* keyboard report operations */ 72/* keyboard report operations */
60void host_add_key(uint8_t key) 73void host_add_key(uint8_t key)
61{ 74{
@@ -158,6 +171,14 @@ void host_send_keyboard_report(void)
158{ 171{
159 if (!driver) return; 172 if (!driver) return;
160 (*driver->send_keyboard)(keyboard_report); 173 (*driver->send_keyboard)(keyboard_report);
174
175 if (debug_keyboard) {
176 print("keys: ");
177 for (int i = 0; i < REPORT_KEYS; i++) {
178 phex(keyboard_report->keys[i]); print(" ");
179 }
180 print(" mods: "); phex(keyboard_report->mods); print("\n");
181 }
161} 182}
162 183
163void host_mouse_send(report_mouse_t *report) 184void host_mouse_send(report_mouse_t *report)
@@ -216,7 +237,6 @@ static inline void del_key_byte(uint8_t code)
216 for (; i < REPORT_KEYS; i++) { 237 for (; i < REPORT_KEYS; i++) {
217 if (keyboard_report->keys[i] == code) { 238 if (keyboard_report->keys[i] == code) {
218 keyboard_report->keys[i] = 0; 239 keyboard_report->keys[i] = 0;
219 break;
220 } 240 }
221 } 241 }
222} 242}