Subject: keyboard/mouse demux
To: None <port-sparc@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: port-sparc
Date: 08/11/2001 15:39:53
I don't expect anyone to care that much about this.  But I wanted it;
someday someone else may, and having this message in the archives may
help.  And besides, my expectation may be wrong. :-)

I have a dual-haeded machine, and wanted to run completely independent
stuff on the two heads.  But I didn't want to have to burn the serial
ports on hooking up another keyboard and mouse.  (It's easy enough to
do; you just need level shifters, and maybe inverters depending on
whether the level shifter inverts - I find an ICL232 and a 7404, plus a
+5V supply, is all I need.)

So I hacked in a software switching layer.  Depending on which side of
it you look at, it's a multiplexer or a demulitplexer.

Instead of

	kbd0    at zs1 channel 0
	ms0     at zs1 channel 1

I now have

	kmmux0  at zs1 channel 0
	kmmux1  at zs1 channel 1
	kbd0    at kmmux0
	ms0     at kmmux1
	kbd1    at kmmux0
	ms1     at kmmux1
	kbd2    at kmmux0
	ms2     at kmmux1

and by default the hardware is connected to kbd0 and ms0.  There's a
keystroke sequence (ctrl-F1 followed by a digit) for switching it to
another kbd/ms pair; as far as userland can tell, I have three
keyboards and mice on my machine.  (And I'm learning all about how much
stuff blindly assumes /dev/kbd and /dev/mouse are the right things;
fortunately, they've been pretty easy to fix so far.)

I consider this alpha-quality code at the moment, but as I'm going to
be using it reasonably heavily myself, I expect it to get burnt in
pretty fast.  As always, drop me a line if you're interested.

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B