Re: [iPAQ] [Serial programming]read(fd,buf, 0) doesn't return zero ...

From: Paulo Marques <pmarques.a.t.grupopie.com>
Date: Wed Mar 24 2004 - 09:10:19 EST

Valentin Longchamp wrote:

> Hi,
>
> I'm trying to communicate from the ipaq on the serial port. I can write on it
> and see it on the console, but I can't read from the serial port, and even when
> I call read(fd, answ, 0) which should return zero according to the read man
> page, the read call is blocking and nevers stops ???
>

The read should return 0 only if the file descriptor is open using O_NONBLOCK or
if you use fcntl to set O_NONBLOCK afterwards.

If you don't specify non-blocking I/O, the default is blocking.

Also if you want the serial port "raw", i.e. without any character conversion,
echo, etc. etc. take a look at the "cfmakeraw" library function.

Anyway, make absolutely shure that no one else is using the serial port. All
versions of Familiar that I know of use the serial port for the console.

I hope this helps,

-- 
Paulo Marques
Software Development Department - Grupo PIE, S.A.
Phone: +351 252 290600, Fax: +351 252 290601
Web: www.grupopie.com
"In a world without walls and fences who needs windows and gates?"
Received on Wed Mar 24 14:12:16 2004

This archive was generated by hypermail 2.1.8 : Tue May 04 2004 - 09:45:09 EDT