Subject: Re: Wskbd
To: anand lalgondar <anandlalgondar@hotmail.com>
From: Eduardo Horvath <eeh@NetBSD.ORG>
List: tech-kern
Date: 08/22/2003 16:14:20
On Fri, Aug 22, 2003 at 10:26:28AM +0530, anand lalgondar wrote:
> Hello,
> 
> Is this possible: Redirecting the output of either the USB Keyboard or the 
> wskbd driver to the serial port Which is acting as console instead of 
> wsdisplay.

I'm sorry, you can't do that.

What you have described here is the classic spit console problem.

> 
> I have this structure declared in my machine dependent driver program:
> /*
> * Routines to use a txsio as a console.
> */
> 
> static struct consdev txsio_cons = {
> 	NULL, NULL, txsio_cngetc, txsio_cnputc, txsio_cnpollc, NULL, NODEV,
> 	     CN_NORMAL
> };
> 
> How can I mention the USB Keyboard/wskbd driver code to pass the decode 
> ascii value to these functions.
> 
> I assume any keyboard input data will be streamed in both noncanonical and 
> canonical form.
>             Non-canonical - For the text console
>             Canonical       - For the shell to accept it as commands.
> So with this in mind, if I redirect the output directly to the serial 
> driver, then it simply displays it as character.
> 
> Well I have this structure also in my driver. Can I use this to overcome 
> the above mentioned issue in any way:
> const struct cdevsw txsio_cdevsw = {
> 	txsioopen, txsioclose, txsioread, txsiowrite, txsioioctl,
> 	txsiostop, txsiotty, txsiopoll, nommap, ttykqfilter, D_TTY
> };

One problem with wscons is that it's an all-or-nothing device: either
it has control of both input and output or it is unusable.  If you have
a wscons-enabled keyboard, you also need a wscons-enabled output device
or the input will go nowhere.

The other situation may be more workable, since you can use userland
programs to feed values into the wscons input stream.

The only thing I can suggest is trying to write a wscons display device
driver that emulates a character-mapped display using some sort of
terminal control sequences (vt100?) that you can then hook up to a 
serial line.  (In other words: termcap in the kernel (UGH)).

Eduardo