NetBSD-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Getty on USB serial port
On Fri, Sep 15, 2017 at 11:16:31AM -0400, William D. Jones wrote:
> > Intercepting the console with a program is another method. This still
> > causes early messages to be sent to the serial port, but that is seen by
> > ppp as line noise and filtered out.
> Yes, basically this is my concern. I don't know how well ppp will cope with
> random bursts of text. Just out of curiosity, I assume I need to write this
> program myself; how might I go about doing that? I know I need to `dup2` to
> redirect, but the problem is getting the correct fd to redirect so processes
> writing text to the console "see" my altered fd.
You redirect console to some terminal with the TIOCCONS ioctl. I.e.
something like
fd = open("/dev/ttyU0", O_RDONLY);
ioctl(fd, TIOCCONS);
close(fd);
Redirects console output to /dev/ttyU0.
xconsole uses a pseudo-tty instead, so that it can read the output
and render it into a window.
Again, that's the "higher level" console. When the kernel enters DDB
or shuts down, the lowlevel console will be used again.
Greetings,
--
Michael van Elst
Internet: mlelstv%serpens.de@localhost
"A potential Snark may lurk in every tree."
Home |
Main Index |
Thread Index |
Old Index