This is the mail archive of the
cygwin@sourceware.cygnus.com
mailing list for the Cygwin project.
RE: Using tty code for serial Ports
- To: "sos at prospect dot com dot ru" <sos at prospect dot com dot ru>, "'Mike Bernson'" <mike at mbsun dot mlb dot org>
- Subject: RE: Using tty code for serial Ports
- From: Sergey Okhapkin <sos at prospect dot com dot ru>
- Date: Thu, 17 Jul 1997 10:53:15 +0400
- Cc: "gnu-win32 at cygnus dot com" <gnu-win32 at cygnus dot com>
- Encoding: 42 TEXT
Mike Bernson wrote:
> I would like to use the tty code for serial ports.
>
> What I was hoping for a way the serial port could attach
> to a tty code allowing callbacks for reading, write, ioctl.
>
It's easy to attach serial ports to tty code for the first cygwin
application runned in the console. First, all three standard handles must
be redirected to the port on application startup (the tty master attaches
himself to a device pointed by stderr). Second, modify
hinfo_vec::init_std_file_from_handle() (hinfo.cc) something like this:
if (FlushConsoleInputBuffer (handle))
{
bin = 0;
if (use_tty)
name = "/dev/tty";
else
name = "/dev/conin";
}
+ if (GetCommState(handle, &dcb)) // the handle is a serial port
+ {
+ bin = 1;
+ if (use_tty)
+ name = "/dev/tty";
+ else
+ name = "com1";
+ }
}
MARK();
stdin/stdout/stderr of an application will be conected to tty code, whose
master side is connected to a serial port. All the childs of the process
inherits the connection.
getty/login should work fine:-) I've designed tty code with serial handling
in mind :-)
--
Sergey Okhapkin, http://www.lexa.ru/sos
Moscow, Russia
Looking for a job
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".