setting sio to even parity failed
Bernd Walter
ticso at cicely12.cicely.de
Fri Oct 10 11:14:00 PDT 2003
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 at bwct.de info at bwct.de
More information about the freebsd-hackers
mailing list