From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21974 invoked by alias); 26 Jul 2005 04:00:36 -0000 Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Received: (qmail 21944 invoked by uid 22791); 26 Jul 2005 04:00:30 -0000 Received: from mx1.itb.ac.id (HELO mx1.itb.ac.id) (167.205.23.6) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Tue, 26 Jul 2005 04:00:30 +0000 Received: from antivirus.itb.ac.id (antivirus.itb.ac.id [167.205.108.137]) by mx1.itb.ac.id (Postfix) with SMTP id 3E422C13C0 for ; Tue, 26 Jul 2005 11:00:18 +0700 (WIT) Received: from vlsi.itb.ac.id (ic.vlsi.itb.ac.id [167.205.65.54]) by mx1.itb.ac.id (Postfix) with SMTP id E8EEEC0FEE for ; Tue, 26 Jul 2005 11:00:17 +0700 (WIT) Received: (qmail 15852 invoked by uid 4061); 26 Jul 2005 04:00:14 -0000 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 26 Jul 2005 04:00:14 -0000 Date: Tue, 26 Jul 2005 04:00:00 -0000 From: Indra Antonius Simalango To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: [ECOS] how to use flag O_NDELAY and O_NONBLOCK in eCos serial port programming X-SW-Source: 2005-07/txt/msg00261.txt.bz2 dear all, Below are my quote snippet. It would open a serial fax device as a file. It returns the file descriptor on success or -1 on error. ------------------------------------------------------------------------- #include #include #include #include #include #include int main(void) { int fd; fd = open("/dev/ser1", O_RDWR | O_NOCTTY | O_NDELAY); if (fd == -1) { perror("open_port: Unable to open /dev/ser1 - "); } else fcntl(fd, F_SETFL, 0); return (fd); } ------------------------------------------------------------------------ I've got an error message while compiling and linking it : testserial.c:11: 'O_NDELAY' undeclared (first use in this function) testserial.c:11: (Each undeclared identifier is reported only once testserial.c:11: for each function it appears in.) I've read some "Posix Serial Communication", and then try to replace O_NDELAY by O_NONBLOCK. There's no error message after compile and link. But when executing on my target pci386, it got an error message : open_port : Unable to open /dev/ser1 - Invalid argument Is flag O_NONBLOCK really an invalid argument to open a serial port on eCos? Or maybe there's another way to do this. Thank you. -- regards, IndrA on 18:49, Jul 20 http://ic.ee.itb.ac.id/~antonius -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss