RE: Serial Port (RS-232)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <glynn@xxxxxxxxxxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Assembler]     [Git]     [Kernel List]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [C Programming]     [Yosemite Campsites]     [Yosemite News]     [GCC Help]

  Powered by Linux