Skip to content

Commit fa2e365

Browse files
committed
Reorder FLAG_STRING | FLAG_CTRL lines
this means that the test for FLAG_CTRL together with FLAG_STRING is not needed. Instead, the FLAG_STRING | FLAG_CTRL row, when encountered earlier, will automatically take precedence.
1 parent 1983dda commit fa2e365

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

supervisor/shared/usb/host_keyboard.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,13 @@ STATIC struct keycode_mapper keycode_to_ascii[] = {
136136
"/\0" "*\0" "-\0" "+\0" "\n\0" CURSOR_END SEP CURSOR_DOWN SEP CURSOR_PGDN SEP CURSOR_LEFT SEP NOTHING SEP CURSOR_RIGHT SEP CURSOR_HOME SEP CURSOR_UP SEP CURSOR_PGDN SEP CURSOR_INS SEP CURSOR_DEL},
137137
{ HID_KEY_KEYPAD_DIVIDE, HID_KEY_KEYPAD_DECIMAL, 0, 0, "/*-+\n1234567890." },
138138

139+
{ HID_KEY_INSERT, HID_KEY_ARROW_UP, 0, FLAG_STRING | FLAG_CTRL, CTRL_INS SEP CTRL_HOME SEP CTRL_PGUP SEP CTRL_DEL SEP CTRL_END SEP CTRL_PGDN SEP CTRL_RIGHT SEP CTRL_LEFT SEP CTRL_DOWN SEP CTRL_UP},
139140
{ HID_KEY_INSERT, HID_KEY_ARROW_UP, 0, FLAG_STRING, CURSOR_INS SEP CURSOR_HOME SEP CURSOR_PGUP SEP CURSOR_DEL SEP CURSOR_END SEP CURSOR_PGDN SEP CURSOR_RIGHT SEP CURSOR_LEFT SEP CURSOR_DOWN SEP CURSOR_UP},
140-
{ HID_KEY_PAUSE, HID_KEY_PAUSE, 0x1a, 0, },
141+
{ HID_KEY_F1, HID_KEY_F12, 0, FLAG_STRING | FLAG_CTRL, CTRL_F1 SEP CTRL_F2 SEP CTRL_F3 SEP CTRL_F4 SEP CTRL_F5 SEP CTRL_F6 SEP CTRL_F7 SEP CTRL_F8 SEP CTRL_F9 SEP CTRL_F10 SEP CTRL_F11 SEP CTRL_F12},
141142
{ HID_KEY_F1, HID_KEY_F12, 0, FLAG_STRING, F1 SEP F2 SEP F3 SEP F4 SEP F5 SEP F6 SEP F7 SEP F8 SEP F9 SEP F10 SEP F11 SEP F12},
143+
144+
{ HID_KEY_PAUSE, HID_KEY_PAUSE, 0x1a, 0, },
142145
{ HID_KEY_PRINT_SCREEN, HID_KEY_PRINT_SCREEN, 0, FLAG_STRING, PRINT_SCREEN},
143-
{ HID_KEY_INSERT, HID_KEY_ARROW_UP, 0, FLAG_STRING | FLAG_CTRL, CTRL_INS SEP CTRL_HOME SEP CTRL_PGUP SEP CTRL_DEL SEP CTRL_END SEP CTRL_PGDN SEP CTRL_RIGHT SEP CTRL_LEFT SEP CTRL_DOWN SEP CTRL_UP},
144-
{ HID_KEY_F1, HID_KEY_F12, 0, FLAG_STRING | FLAG_CTRL, CTRL_F1 SEP CTRL_F2 SEP CTRL_F3 SEP CTRL_F4 SEP CTRL_F5 SEP CTRL_F6 SEP CTRL_F7 SEP CTRL_F8 SEP CTRL_F9 SEP CTRL_F10 SEP CTRL_F11 SEP CTRL_F12},
145146

146147
};
147148

@@ -288,9 +289,6 @@ STATIC void process_event(uint8_t dev_addr, uint8_t instance, const hid_keyboard
288289
if (mapper->flags & FLAG_CTRL && !ctrl) {
289290
continue;
290291
}
291-
if (!(mapper->flags & FLAG_CTRL) && ctrl && (mapper->flags & FLAG_STRING)) {
292-
continue;
293-
}
294292
if (mapper->flags & FLAG_STRING) {
295293
const char *msg = skip_nuls(mapper->data, keycode - mapper->first);
296294
send_bufz(msg);

0 commit comments

Comments
 (0)