Browse Source

Semiworking console.

Garbage on i/o.
cpurc: removed listen1 for comconsole
main.c: added printinit and moved keybinit after ioinit
i8042.c: added addkbdq for right management of keyboard queues
devcons.c: filled consclose and echo has again qproduce.

Signed-off-by: Álvaro Jurado <elbingmiss@gmail.com>
Álvaro Jurado 7 years ago
parent
commit
954ae4708a
4 changed files with 29 additions and 13 deletions
  1. 2 4
      rc/bin/cpurc
  2. 9 8
      sys/src/9/386/i8042.c
  3. 3 1
      sys/src/9/amd64/main.c
  4. 15 0
      sys/src/9/port/devcons.c

+ 2 - 4
rc/bin/cpurc

@@ -75,10 +75,8 @@ if(test -e /cfg/$sysname/cpustart)
 # other /proc files, such as note, so let listen be killed.
 #dontkill '^(ipconfig|factotum|mntgen|venti|fossil|cs|dns|reboot)$'
 
-# From bootfs
-/boot/listen1 -t -v tcp!*!1522  /boot/tty /boot/rc -m /boot/rcmain -i &
-/boot/tty -f'#t/eia0' /boot/rc -m/boot/rcmain -i &
-exec /boot/console /boot/tty /boot/rc -m/boot/rcmain -i
+#aux/listen1 -t -v tcp!*!1522 /bin/aux/pipeconsole /bin/rc -m /rc/lib/rcmain -i &
+#aux/comconsole '#t/eia0' /bin/rc -m/rc/lib/rcmain -i &
 
 echo 'key proto=p9sk1 dom=harvey user=harvey !password=harvey' >/mnt/factotum/ctl
 aux/listen1 -t tcp!*!6666 /bin/cpu -R &

+ 9 - 8
sys/src/9/386/i8042.c

@@ -149,21 +149,21 @@ Rune kbtabaltgr[Nscan] =
 /*
 Rune kbtabctrl[] =
 {
-[0x00]	No,	'', 	'', 	'', 	'', 	'', 	'', 	'', 
+[0x00]	No,	'', 	'', 	'', 	'', 	'', 	'', 	'',
 [0x08]	'', 	'', 	'', 	'', 	'
 ', 	'', 	'\b',	'\t',
 [0x10]	'', 	'', 	'', 	'', 	'', 	'', 	'', 	'\t',
-[0x18]	'', 	'', 	'', 	'', 	'\n',	Ctrl,	'', 	'', 
-[0x20]	'', 	'', 	'', 	'\b',	'\n',	'', 	'', 	'', 
-[0x28]	'', 	No, 	Shift,	'', 	'', 	'', 	'', 	'', 
+[0x18]	'', 	'', 	'', 	'', 	'\n',	Ctrl,	'', 	'',
+[0x20]	'', 	'', 	'', 	'\b',	'\n',	'', 	'', 	'',
+[0x28]	'', 	No, 	Shift,	'', 	'', 	'', 	'', 	'',
 [0x30]	'', 	'', 	'
 ', 	'', 	'', 	'', 	Shift,	'\n',
-[0x38]	Latin,	No, 	Ctrl,	'', 	'', 	'', 	'', 	'', 
+[0x38]	Latin,	No, 	Ctrl,	'', 	'', 	'', 	'', 	'',
 [0x40]	'', 	'', 	'', 	'
-', 	'', 	'', 	'', 	'', 
+', 	'', 	'', 	'', 	'',
 [0x48]	'', 	'', 	'
-', 	'', 	'', 	'', 	'', 	'', 
-[0x50]	'', 	'', 	'', 	'', 	No,	No,	No,	'', 
+', 	'', 	'', 	'', 	'', 	'',
+[0x50]	'', 	'', 	'', 	'', 	No,	No,	No,	'',
 [0x58]	'', 	No,	No,	No,	No,	No,	No,	No,
 [0x60]	No,	No,	No,	No,	No,	No,	No,	No,
 [0x68]	No,	No,	No,	No,	No,	No,	No,	No,
@@ -740,6 +740,7 @@ keybenable(void)
 	if(keybq == nil)
 		panic("keybinit");
 	qnoblock(keybq, 1);
+	addkbdq(keybq, -1);
 
 	ioalloc(Data, 1, 0, "keyb");
 	ioalloc(Cmd, 1, 0, "keyb");

+ 3 - 1
sys/src/9/amd64/main.c

@@ -576,6 +576,7 @@ main(uint32_t mbmagic, uint32_t mbaddress)
 	mmuinit();
 
 	ioinit();
+	keybinit();
 	meminit();
 	confinit();
 	archinit();
@@ -618,6 +619,7 @@ if (1){	acpiinit(); hi("	acpiinit();\n");}
 	print("before mpacpi, maxcores %d\n", maxcores);
 	mpacpi(maxcores);
 	trapinit();
+	printinit();
 	apiconline();
 	/* Forcing to single core if desired */
 	if(!nosmp) {
@@ -631,7 +633,7 @@ if (1){	acpiinit(); hi("	acpiinit();\n");}
 	initimage();
 	links();
 
-	keybinit();
+
 	keybenable();
 	mouseenable();
 

+ 15 - 0
sys/src/9/port/devcons.c

@@ -522,6 +522,8 @@ echo(char *buf, int n)
 		}
 	}
 
+	if(kbdq != nil)
+		qproduce(kbdq, buf, n);
 	if(kbd.raw == 0)
 		putstrn(buf, n);
 }
@@ -716,6 +718,7 @@ consinit(void)
 	 * processing it every 22 ms should be fine
 	 */
 	addclock0link(kbdputcclock, 22);
+	kickkbdq();
 }
 
 static Chan*
@@ -755,7 +758,19 @@ consopen(Chan *c, int omode)
 static void
 consclose(Chan *c)
 {
+	switch((uint32_t)c->qid.path){
+	/* last close of control file turns off raw */
+	case Qconsctl:
+		if(c->flag&COPEN){
+			if(decref(&kbd.ctl) == 0)
+				kbd.raw = 0;
+		}
+		break;
 
+	/* close of kprint allows other opens */
+	case Qkprint:
+		error(Egreg);
+	}
 }
 
 static int32_t