Re: [PATCH 1/1] char nvtty: Network Virtual Terminal support

From: Rodolfo Giometti
Date: Mon Jan 10 2011 - 08:31:11 EST


On Mon, Jan 10, 2011 at 01:13:32PM +0000, Alan Cox wrote:
> > By using these devices and a proper compatible server (not included
> > here but you can use sredird) you can get access to a remote tty
> > device as the tty device itself was conneted with your local host.
> > All data and settings are sent and received through the network.
>
> And this is still something that should be done in userspace if necessary
> by fixing up the tty layer to support pty/tty pair modem lines and
> termios change reporting, or some kind of *generic* vt that can also
> expose all the config other net protocols might need.

If I well understood the pty/tty pair modem lines they can be used to
send receive serial data but they cannot be used to set the serial
parameters since the slave doesn't send to the master the serial
settings a userland application does on it, doesn't it?

> > + default:
> > + tty->termios->c_cflag = B0;
>
> This btw is wrong - if you don't recognize the baud rate you want to
> force a new one. Also you shouldn't be writing all of c_cflag here just
> the baud bits, also you shouldn't in fact ever be hand mangling the baud
> bits but using the helpers.

Ok.

>
> > + }
> > +}
> > +#undef TEST_SET_BAUDRATE
> > +
> > +#define TEST_SET_DATASIZE(b) case b: tty->termios->c_cflag |= CS ## b ; break
> > +static void nvtty_set_datasize(struct nvtty_serial *info, unsigned int datasize)
> > +{
> > + struct tty_struct *tty = info->tty;
> > +
> > + nvtty_dbg(info, "datasize=%d", datasize);
> > +
> > + tty->termios->c_cflag &= ~CSIZE;
> > + switch (datasize) {
> > + TEST_SET_DATASIZE(5);
> > + TEST_SET_DATASIZE(6);
> > + TEST_SET_DATASIZE(7);
> > + TEST_SET_DATASIZE(8);
> > + default:
> > + tty->termios->c_cflag = CS5;
>
> Should be |=

Ok.

> > +static void nvtty_set_parity(struct nvtty_serial *info, unsigned int parity)
> > +{
> > + struct tty_struct *tty = info->tty;
> > +
> > + nvtty_dbg(info, "parity=%d", parity);
> > +
> > + tty->termios->c_cflag &= ~(PARENB | PARODD);
>
> Needs to consider the CMSPAR bit.

Ok.

I'm going to fix these issues ASAP.

> Otherwise its a very nice implementation of something I don't think we
> should have implemented in the kernel.

Thanks, but I still don't understand how I can set the serial settings
without a specific tty driver and just using the pty/tty pair modem
lines... :'(

Ciao,

Rodolfo

--

GNU/Linux Solutions e-mail: giometti@xxxxxxxxxxxx
Linux Device Driver giometti@xxxxxxxx
Embedded Systems phone: +39 349 2432127
UNIX programming skype: rodolfo.giometti
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/