RE: Serial Port (RS-232)
"Jaime Garcia" <[email protected]>
| Newsgroups | org.kernel.vger.linux-c-programming |
|---|---|
| Message-ID | <[email protected]> |
Hi Glynn, What I want to do is to read from another device that transmit a string of chars through serial connector, what do you recommend? I would like to know your approach for this. Thank you in advance for your help. Best Regards! > -----Mensaje original----- > De: Glynn Clements [mailto:[email protected]] > Enviado el: Martes, 27 de Enero de 2009 06:57 p.m. > Para: Jaime Garcia > CC: [email protected] > Asunto: RE: Serial Port (RS-232) > > > 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]>