diff options
author | dzwdz | 2022-07-05 20:22:31 +0200 |
---|---|---|
committer | dzwdz | 2022-07-05 20:22:31 +0200 |
commit | 60d099a65ccd9e1eb431f61b8009e7f8cec15a0f (patch) | |
tree | d71b21332c1403309bdf5545e70368bab77697b3 /src/init/driver/ps2.c | |
parent | 331f63bc7e8e80e914bb8fb93ef48381bc737feb (diff) |
init/ps2: support inserting special characters with ctrl, tty style
Diffstat (limited to 'src/init/driver/ps2.c')
-rw-r--r-- | src/init/driver/ps2.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/init/driver/ps2.c b/src/init/driver/ps2.c index a05ae61..5623b98 100644 --- a/src/init/driver/ps2.c +++ b/src/init/driver/ps2.c @@ -35,13 +35,17 @@ static handle_t fd; static bool keys[0x80] = {0}; static void parse_scancode(uint8_t s) { + bool ctrl = keys[0x1D]; bool shift = keys[0x2A] || keys[0x36]; bool down = !(s & 0x80); + char c; s &= 0x7f; keys[s] = down; - char c = shift ? keymap_upper[s] : keymap_lower[s]; - if (down) ring_put1b((void*)&backlog, c); + c = shift ? keymap_upper[s] : keymap_lower[s]; + if (ctrl && keymap_upper[s] >= 'A' && keymap_upper[s] <= 'Z') + c = keymap_upper[s] - 'A' + 1; + if (down && c) ring_put1b((void*)&backlog, c); } static void main_loop(void) { |