shithub: riscv

Download patch

ref: c266a31572cdd704a5f9e9092e9447106e19d92c
parent: f9f94d0b52d867042ec57ef574cbe7c5221ed652
author: cinap_lenrek <cinap_lenrek@localhost>
date: Thu May 26 20:41:58 EDT 2011

kbdfs: disable console processing if /dev/kbd is open

--- a/sys/man/8/kbdfs
+++ b/sys/man/8/kbdfs
@@ -171,7 +171,11 @@
 .B Num
 will not change
 the characters already present in the string, but will
-take effect on newly pressed keys.
+take effect on newly pressed keys. Opening the
+.BR kbd
+file disables input processing on the
+.BR cons
+file until it is closed again.
 .PP
 Raw scancodes can be written to the
 .BR kbin
--- a/sys/src/cmd/aux/kbdfs.c
+++ b/sys/src/cmd/aux/kbdfs.c
@@ -605,7 +605,7 @@
 			break;
 
 		case Araw:
-			if(raw){
+			if(raw || kbdopen){
 				s = emalloc9p(UTFmax+1);
 				s[runetochar(s, &r)] = 0;
 			} else {
@@ -620,6 +620,11 @@
 			e = s + strlen(s);
 
 		Havereq:
+			if(kbdopen){
+				free(b);
+				b = nil;
+				break;
+			}
 			while(b && (req = qcons.h)){
 				if((qcons.h = req->aux) == nil)
 					qcons.t = &qcons.h;