Re: RS232

From: Michele Andreoli ([email protected])
Date: Thu Mar 28 2002 - 09:35:29 CET


On Wed, Mar 27, 2002 at 11:51:11PM -0700, Daniel Webb wrote:
> > Method 1)
> > -----------
> >
> > It is only matter to open the special device /dev/ttyS0 (COM1)
> > or /dev/ttyS1 (COM2):
> >
> > int fd;
> > fd = open("/dev/ttyS0",O_RDWR)
>
> For this method, do you have to set the serial port up first using
> setserial? What determines the baud rate?

You can define speed in your C code, using ioctl(), with standard
POSIX sintax:

        
                tty.sg_ospeed = speed; /* Set new speed */
                   tty.sg_ispeed = speed; /* Set new speed */
                ioctl(fd, TIOCSETP, &tty);

I got that from the miterm.c source.

Michele

-- 
I keep trying to locate a meeting of Quantum Physicists. But everytime
they set a meeting time, the location changes. And vice versa -- Anonymous
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


This archive was generated by hypermail 2.1.6 : Sat Feb 08 2003 - 15:27:21 CET