wm: teppich

Download patch

ref: 102af13743e15535c93005d77d4ba2bbcdd35eff
parent: 9e35e814941b08fe29871f7cc8e925bf19ff5f7f
author: mkf <mkf@cloud9p.org>
date: Fri Nov 24 03:49:33 EST 2023

kern/ps2: add shift code

--- a/pc/ps2.c
+++ b/pc/ps2.c
@@ -5,15 +5,16 @@
 uint8
 ps2_read_status(void)
 {
-	return inb(KB_CTR);
+	return inb(KBC);
 }
 
 void
 ps2_init()
 {
-	int a = 256 - 3; // 11111100
-	outb(0x64, SET_RATE);
-	outb(0x64, a);
+	int a = 256 - 3; /* 11111100 */
+	outb(KBC, SET_RATE);
+	outb(KBC, a);
+	/* kbstate = 0; */
 }
 
 char
@@ -20,15 +21,24 @@
 ps2_getc()
 {
 	char c;
+	int state;
+	
+	state = 0;
 	while(1)
 	{
 		if(!(ps2_read_status() & 1))
 			continue;
 
-		c = inb(KB);
+		c = inb(KBD);
 		if(c & 0x80)
 			continue;
 
-		return keymap[c];
+		/* made shift */
+		if((c == 0x2A) || (c == 0x36))
+		{
+			state = 1;
+			continue;
+		}
+		return keymap[state][c];
 	}
 }