implement capslock

This commit is contained in:
Mathieu Maret 2018-11-07 17:47:06 +01:00
parent d95728bbd1
commit b159aa0b50

View File

@ -61,7 +61,7 @@ const char *scancode[128] = {
/* 55 */ 0, /* 55 */ 0,
/* 56 */ 0, /* left alt*/ /* 56 */ 0, /* left alt*/
/* 57 */ " ", /* 57 */ " ",
/* 58 */ 0, /* 58 */ 0, /* caps Lock */
/* 59 */ "\eOP", /* F1 */ /* 59 */ "\eOP", /* F1 */
/* 60 */ "\eOQ", /* F2 */ /* 60 */ "\eOQ", /* F2 */
/* 61 */ "\eOR", /* F3 */ /* 61 */ "\eOR", /* F3 */
@ -266,6 +266,7 @@ void keyboard_do_irq()
{ {
static int lshift = 0; static int lshift = 0;
static int rshift = 0; static int rshift = 0;
static int capslock = 0;
unsigned char c = 0; unsigned char c = 0;
if (inb(0x60) != c) { if (inb(0x60) != c) {
c = inb(0x60); c = inb(0x60);
@ -278,8 +279,11 @@ void keyboard_do_irq()
case 54: case 54:
rshift = 1; rshift = 1;
break; break;
case 58:
capslock = 1 - capslock;
break;
default: default:
if (lshift || rshift) if ((lshift || rshift) ^ capslock)
printf(scancode_shift[(int)c]); printf(scancode_shift[(int)c]);
else else
printf(scancode[(int)c]); printf(scancode[(int)c]);
@ -292,7 +296,6 @@ void keyboard_do_irq()
break; break;
case 54: case 54:
rshift = 0; rshift = 0;
break;
} }
} }
} }