implement capslock

This commit is contained in:
Mathieu Maret 2018-11-07 17:47:06 +01:00
parent d95728bbd1
commit b159aa0b50
1 changed files with 6 additions and 3 deletions

View File

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