git: 9front

Download patch

ref: ae1d0ce792d696af5fcd15deb8ea4b782524f6a3
parent: dc1b5fa377e97bf78bb21cd394d0e9a463b6ac02
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Fri Oct 24 22:05:44 EDT 2014

rio: dont serve a kbd file per window when we didnt got one from the environment

9vx doesnt provide a /dev/kbd file and rio faking one
up causes problems with vncv. (issue #223)

--- a/sys/src/cmd/rio/dat.h
+++ b/sys/src/cmd/rio/dat.h
@@ -337,6 +337,7 @@
 int		nwindow;
 int		snarffd;
 int		gotscreen;
+int		servekbd;
 Window	*input;
 QLock	all;			/* BUG */
 Filsys	*filsys;
--- a/sys/src/cmd/rio/fsys.c
+++ b/sys/src/cmd/rio/fsys.c
@@ -365,6 +365,8 @@
 		return 1;
 	if(gotscreen && strcmp(name, "screen")==0)
 		return 1;
+	if(!servekbd && strcmp(name, "kbd")==0)
+		return 1;
 	return 0;
 }
 
--- a/sys/src/cmd/rio/rio.c
+++ b/sys/src/cmd/rio/rio.c
@@ -1340,6 +1340,9 @@
 	if((kfd = open("/dev/kbd", OREAD)) >= 0){
 		close(fd);
 
+		/* only serve a kbd file per window when we got one */
+		servekbd = 1;
+
 		/* read kbd state */
 		while((n = read(kfd, buf, sizeof(buf))) > 0)
 			chanprint(c, "%.*s", n, buf);
--