Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Oct 2003 20:13:49 +0200
From:      Bernd Walter <ticso@cicely12.cicely.de>
To:        freebsd-hackers@freebsd.org
Subject:   setting sio to even parity failed
Message-ID:  <20031010181349.GG13791@cicely12.cicely.de>

next in thread | raw e-mail | index | archive | help
void
opensio(char* devname) {
        struct termios buf;
        int val;
  
        fd = open(devname, O_RDWR);
        if (fd < 0) {
                printf("open serial %s failed: %s\n",
                    devname, strerror(errno));
                exit(1);
        }       
        val = fcntl(fd, F_GETFL, 0);
        fcntl(fd, F_SETFL, val | O_NONBLOCK);
        if (tcgetattr(fd, &buf) < 0) {
                printf("tcgetattr failed: %s\n", strerror(errno));
                exit (1);
        }
        cfmakeraw(&buf);
        buf.c_iflag |= IGNBRK;
        buf.c_cflag &= ~(CSIZE | PARODD);
        buf.c_cflag |= CS8 | CLOCAL | PARENB;
        if (tcsetattr(fd, TCSAFLUSH, &buf) < 0) {
                printf("tcsetattr failed: %s\n", strerror(errno));
                exit (1);
        }
}

If I do PARENB or not doesn't change anything in the output pattern.
However it does change handling in receiving characters.
The OS is a real old -current from 8th Feb 2003.
Unfortunately it's a RS485 application and I can't easily test the
situation on a system with a more recent version and I can't easily
update the given system.

-- 
B.Walter                   BWCT                http://www.bwct.de
ticso@bwct.de                                  info@bwct.de



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031010181349.GG13791>