This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: Non-blocking mode read from serial port
- From: Nick Garnett <nickg at ecoscentric dot com>
- To: "Ali Rodgo" <alirodgo at web dot de>
- Cc: "JonathanLarmour" <jifl at eCosCentric dot com>, ecos-discuss at sources dot redhat dot com
- Date: 24 Feb 2004 09:41:05 +0000
- Subject: Re: [ECOS] Non-blocking mode read from serial port
- References: <200402240906.i1O96lQ10969@mailgate5.cinetic.de>
"Ali Rodgo" <alirodgo@web.de> writes:
> Thanks a lot, but all of that means that i should use VTIME=0 and
> VMIN=0 to work propertly or should i change something (the bug
> explained below) in the termiostty.c in order to use VMIN >0?If that
> doesn't work how could i read only one byte to one byte from the
> serial port?
>
I'm not sure what you are trying to do. If you want to read a single
byte, then read a single byte: read(fd,buf,1). If you want the read to
block while you do it, that is the default. If you want to also wait
for a timeout then do a select(), then read the byte. If you don't
want to block then set the O_NONBLOCK flag, select() will still block
but the read()s won't. Ignore the VTIME/VMIN stuff entirely.
--
Nick Garnett eCos Kernel Architect
http://www.ecoscentric.com The eCos and RedBoot experts
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss