RE: Serial Port (RS-232)

Glynn Clements <[email protected]>
Newsgroups org.kernel.vger.linux-c-programming
Message-ID <[email protected]>
Jaime Garcia wrote:

> > > I am pretty new to Linux programming, I want to start doing something
> > > useful, so I was thinking to start programming the serial port (RS-232)
> > > of my box, so I can read and write data from it, can someone of you give
> > > some feedback about how to start this?
> > 
> > The keyword you are looking for is ``ioctl''.
> 
> Right now I opened man ioctl(2) to start looking for directions on
> this, I appreciate so much your tip, thanks a lot! =-)

You probably don't need to use ioctl() unless you need to treat the
serial port as a general-purpose I/O port (e.g. manually setting the
control lines).

If you just want to talk to another serial device, open()ing one of
the /dev/ttyS* devices and using tcsetattr/tcgetattr will normally
suffice.

If you do need to use ioctl(), the ioctl(2) manpage won't help much,
as ioctl() is a generic interface to device-specific functionality. 
The tty_ioctl(4) manpage has details related to TTY (serial) ioctl()
commands.

-- 
Glynn Clements <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.