Subject: Serial Line Weirdness/Bug?
To: None <current-users@netbsd.org>
From: Feico Dillema <feico@dillema.net>
List: current-users
Date: 07/13/2000 15:49:59
Hi,

A friend of mine tries to talk to some device on the serial port on
NetBSD, and ran into something strange. TRying to open() the
/dev/tty00 doesn't return, and he needed the code below to get things
to work. I thought maybe `stty clocal' or something like that might be
needed to get the regular open() to return, but when that is tried
`stty -a' doesn;t even show anything different. This behaviour is
seen on NetBSD-1.4ZD machines and NetBSD-1.5ALPHA. Is this known
behaviour or a known bug?

Feico.

#include <sys/fcntl.h>
void
main () {
int portfd, n;
#if 1
        portfd = open("/dev/tty00", O_RDWR|O_NDELAY);
        if (portfd >= 0){
                /* Cancel the O_NDELAY flag. */
                n = fcntl(portfd, F_GETFL, 0);
                (void) fcntl(portfd, F_SETFL, n & ~O_NDELAY);
        }
#else
        portfd = open("/dev/tty00", O_RDWR);
#endif
}