add: capslock support
This commit is contained in:
parent
662a75d233
commit
d3aa5af23a
@ -7,20 +7,22 @@
|
|||||||
|
|
||||||
uint8_t terminal_getkey(void)
|
uint8_t terminal_getkey(void)
|
||||||
{
|
{
|
||||||
static bool caps = false;
|
static bool caps_mode = false;
|
||||||
static uint8_t prev_scan_code = 0;
|
static uint8_t prev_scan_code = 0;
|
||||||
uint8_t scan_code;
|
uint8_t scan_code;
|
||||||
|
|
||||||
scan_code = inb(KEYBOARD_PORT);
|
scan_code = inb(KEYBOARD_PORT);
|
||||||
if (scan_code == 0x3A || scan_code == 0x58)
|
if (scan_code == 0x3A || scan_code == 0x58) {
|
||||||
caps = !caps;
|
caps_mode = !caps_mode;
|
||||||
|
outb(0xED, (caps_mode << 2));
|
||||||
|
}
|
||||||
else if (scan_code == KEY_RIGHT_SHIFT || scan_code == KET_LEFT_SHIFT)
|
else if (scan_code == KEY_RIGHT_SHIFT || scan_code == KET_LEFT_SHIFT)
|
||||||
caps = true;
|
caps_mode = true;
|
||||||
else if (scan_code == KEY_RIGHT_SHIFT + 128 || scan_code == KET_LEFT_SHIFT + 128)
|
else if (scan_code == KEY_RIGHT_SHIFT + 128 || scan_code == KET_LEFT_SHIFT + 128)
|
||||||
caps = false;
|
caps_mode = false;
|
||||||
else if (scan_code != prev_scan_code && prev_scan_code != 0) {
|
else if (scan_code != prev_scan_code && prev_scan_code != 0) {
|
||||||
if (scan_code < 128 && keymap[scan_code])
|
if (scan_code < 128 && keymap[scan_code])
|
||||||
kprintf(0, "%c", keymap[scan_code][caps]);
|
kprintf(0, "%c", keymap[scan_code][caps_mode]);
|
||||||
if (scan_code >= KEY_F1 && scan_code <= KEY_F10)
|
if (scan_code >= KEY_F1 && scan_code <= KEY_F10)
|
||||||
terminal_set_screen(scan_code - KEY_F1);
|
terminal_set_screen(scan_code - KEY_F1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user