RE: Serial Port (RS-232)

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

 



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 <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

--
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