RE: Serial Port (RS-232)
"Jaime Garcia" <[email protected]>
| Newsgroups | org.kernel.vger.linux-c-programming |
|---|---|
| Message-ID | <[email protected]> |
I'll give a try to this, thank you so much for the reply Glynn! Regards! > > Jaime Garcia wrote: > > > 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. > > First, open() the device. > > Then configure the line settings with e.g.: > > struct termios t; > tcgetattr(fd, &t); > t.c_lflag &= ~ICANON; > tcsetattr(fd, TCSANOW, &t); > > The ICANON flag controls the use of "canonical mode" (line buffering, > processing of control codes, etc). For a device other than a terminal, > you would normally disable this flag. Exactly how the line is > configured depends upon the device; see the termios(3) manpage for a > list of settings. > > Finally, just read() data. > > -- > Glynn Clements <[email protected]> > -- > To unsubscribe from this list: send the line "unsubscribe linux-c- > programming" in > the body of a message to [email protected] > More majordomo info at http://vger.kernel.org/majordomo-info.html