This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: non-blocking read with tty
- From: "Sicheri Marco" <m dot sicheri at ctsgroup dot it>
- To: "Nicolas Brouard" <nicolas dot brouard at silicomp dot ca>, "eCos Discussion" <ecos-discuss at ecos dot sourceware dot org>
- Date: Tue, 23 Nov 2004 08:51:54 +0100
- Subject: Re: [ECOS] non-blocking read with tty
- Organization: CTS electronics
- References: <MFENKKFPNAKOOKBAEHLHKEKACEAA.nicolas.brouard@silicomp.ca>
- Reply-to: "Sicheri Marco" <m dot sicheri at ctsgroup dot it>
Hi Nicolas,
I had like problem with cyg_io_read()
This is my solution:
[...]
err = cyg_io_lookup("/dev/ser0", &ctsUartHandle[uartID]);
[...]
if (cyg_io_select(ctsUartHandle[uartID], CYG_FREAD, uartInfo) == false)
return (CPSRC_UART_NOTREADY);
else
{
if (cyg_io_read(ctsUartHandle[uartID], &uartCharAUX, &uartBufLenAUX))
return (CPSRC_UART_NOTREADY);
else
(*charD) = uartCharAUX;
}
Bye and good work!
dS,
MS
Ossequi, (Best Regards/Obrigado)
Marco SICHERI
CTS electronics - R&D Department
phone: +39 0125 235637, +39 0125 235630
e-mail: m.sicheri@ctsgroup.it
http://www.ctsgroup.it
----- Original Message -----
From: "Nicolas Brouard" <nicolas.brouard@silicomp.ca>
To: "eCos Discussion" <ecos-discuss@ecos.sourceware.org>
Sent: Monday, November 22, 2004 9:25 PM
Subject: [ECOS] non-blocking read with tty
> Hi,
> Is it possible to use a non-blocking read (key
> CYG_IO_SET_CONFIG_READ_BLOCKING, val = 0) with a tty-mode serial device
> driver?
> Because tty_read function returns ENOERR only if a '\n' is reached. In
> non-blocking mode, the function cyg_io_read almost always returns a value
> different from ENOERR (because there is no character input). So tty_read
> returns an error and in the application, I always have the character '\n'
> (none other character).
>
> Everything is ok if I don't use tty but directly the serial driver
> ("/dev/ser1") in non-blocking mode.
>
> Is there a way to use tty in non-blocking mode?
>
> Thanks in advance.
>
> Nicolas Brouard
>
>
> --
> Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
> and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss