shithub: riscv

Download patch

ref: 4756cf549a8b0e9a6924713666770045b13dd8b8
parent: d3512f60df5d7a2ea5c4cad3cdef797f1f95a182
author: Sigrid <[email protected]>
date: Wed Apr 1 07:31:19 EDT 2020

devkbd: bits bad! revert repeat/delay, better patches welcome

--- a/sys/src/9/pc/devkbd.c
+++ b/sys/src/9/pc/devkbd.c
@@ -40,7 +40,6 @@
 	Qdir,
 	Qscancode,
 	Qleds,
-	Qrepeat,
 };
 
 static Dirtab kbdtab[] = {
@@ -47,7 +46,6 @@
 	".",		{Qdir, 0, QTDIR},	0,	0555,
 	"scancode",	{Qscancode, 0},		0,	0440,
 	"leds",		{Qleds, 0},		0,	0220,
-	"repeat",	{Qrepeat, 0},		0,	0220,
 };
 
 static Lock i8042lock;
@@ -195,28 +193,6 @@
 	iunlock(&i8042lock);
 }
 
-static void
-setrepeat(int repeat)
-{
-	if(nokbd)
-		return;
-
-	repeat &= 0x7f;
-	ilock(&i8042lock);
-	for(;;){
-		if(outready() < 0)
-			break;
-		outb(Data, 0xf3);		/* `set typematic rate and delay' */
-		if(outready() < 0)
-			break;
-		outb(Data, repeat);
-		if(outready() < 0)
-			break;
-		break;
-	}
-	iunlock(&i8042lock);
-}
-
 /*
  *  keyboard interrupt
  */
@@ -381,6 +357,9 @@
 {
 	char tmp[8+1], *p;
 
+	if(c->qid.path != Qleds)
+		error(Egreg);
+
 	p = tmp + n;
 	if(n >= sizeof(tmp))
 		p = tmp + sizeof(tmp)-1;
@@ -387,12 +366,7 @@
 	memmove(tmp, a, p - tmp);
 	*p = 0;
 
-	if(c->qid.path == Qleds)
-		setleds(atoi(tmp));
-	else if(c->qid.path == Qrepeat)
-		setrepeat(atoi(tmp));
-	else
-		error(Egreg);
+	setleds(atoi(tmp));
 
 	return n;
 }