This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: a question about opening a serial port fax device as a file
- From: Andrew Lunn <andrew at lunn dot ch>
- To: Indra Antonius Simalango <indra at vlsi dot itb dot ac dot id>
- Cc: ecos-discuss at ecos dot sourceware dot org
- Date: Wed, 20 Jul 2005 18:24:57 +0200
- Subject: Re: [ECOS] a question about opening a serial port fax device as a file
- References: <Pine.LNX.4.33.0507201915090.5059-100000@ic.vlsi.itb.ac.id>
On Wed, Jul 20, 2005 at 07:15:36PM +0700, Indra Antonius Simalango wrote:
>
> deal all,
>
> Below are my quote snippet. It would open a serial fax device as a TFILE.
> Returns 0 if OK, 1 if busy, 2 on error.
>
> -------------------------------------------------------------------------
> ...
>
> #define FAXFILE "/dev/ser1"
>
> typedef struct tfilestruct {
> int fd ;
> unsigned char *ip, *iq ;
> unsigned char ibuf [ IBUFSIZE ] ;
> unsigned char *ibitorder, *obitorder ;
> int bytes, pad, lines ;
> int hwfc ;
> time_t start ;
> long mstart ;
> int rd_state ;
> } TFILE ;
>
> int ttyopen ( TFILE *f, char *fname, int reverse, int hwfc )
> {
> int flags, err=0 ;
>
> tinit ( f, open ( fname, O_RDWR | O_NONBLOCK | O_NOCTTY ), reverse, hwfc
> ) ;
>
> if ( f->fd < 0 ) {
> if ( errno == EBUSY ) {
> err = 1 ;
> } else {
> err = msg ( "ES2can't open serial port %s:", fname ) ;
> }
> }
> ...
> --------------------------------------------------------------------------
>
> I set fname = FAXFILE
>
> I've done this by posix-eCos programming.This file has successfully
> compiled and linked. But when it runs, it gives an error return :
>
> :17:20 Error : can't open serial port /dev/ser1: No such entity
>
> I built my eCos on PC-i386 platform. I've also changed FAXFILE to
> /dev/ser0, /dev/ttyS0, but still encountered the same error. Did I miss
> something here?
CYGPKG_IO_SERIAL_DEVICES
Andrew
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss