All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jaime Garcia" <jgarcia@vali.com.mx>
To: 'Glynn Clements' <glynn@gclements.plus.com>
Cc: linux-c-programming@vger.kernel.org
Subject: RE: Serial Port (RS-232)
Date: Wed, 28 Jan 2009 18:14:01 -0600	[thread overview]
Message-ID: <005401c981a6$7cd4b9c0$767e2d40$@com.mx> (raw)
In-Reply-To: <18816.37793.803089.202815@cerise.gclements.plus.com>

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


      reply	other threads:[~2009-01-29  0:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-27 15:59 Serial Port (RS-232) Jaime Garcia
2009-01-27 16:20 ` Jai Sharma
2009-01-27 16:46   ` Jaime Garcia
2009-01-27 16:35 ` Tiago Maluta
2009-01-27 17:13 ` Michael Iatrou
2009-01-27 17:33   ` Jaime Garcia
2009-01-28  0:56     ` Glynn Clements
2009-01-28 15:16       ` Jaime Garcia
2009-01-28 17:19         ` Glynn Clements
2009-01-29  0:14           ` Jaime Garcia [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='005401c981a6$7cd4b9c0$767e2d40$@com.mx' \
    --to=jgarcia@vali.com.mx \
    --cc=glynn@gclements.plus.com \
    --cc=linux-c-programming@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.