From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1014db,267113743ad1ea9b,start X-Google-Attributes: gid1014db,public X-Google-Thread: 10b612,267113743ad1ea9b,start X-Google-Attributes: gid10b612,public X-Google-Thread: 11035d,267113743ad1ea9b,start X-Google-Attributes: gid11035d,public X-Google-Thread: 1164f8,267113743ad1ea9b,start X-Google-Attributes: gid1164f8,public From: "Richard W. Franzen" Subject: Raw Serial Port Date: 1996/10/22 Message-ID: <326CDFC7.41C6@dba-sys.com>#1/1 X-Deja-AN: 191268009 distribution: inet cc: richf@dba-sys.com content-type: text/plain; charset=us-ascii organization: FLORIDA ONLINE, Florida's Premier Internet Provider mime-version: 1.0 newsgroups: comp.lang.c,comp.unix.solaris,comp.sys.dec,comp.unix.ultrix x-mailer: Mozilla 3.0 (X11; I; OSF1 V4.0 alpha) Under the old SunOS 4.x.x, one could obtain a raw serial device (no os interceptions of data between device and application) using ioctl() calls and the sgttyb structure: status = ioctl(fd, TIOCGETP, &mygtty); .. mygtty.sg_flags |= RAW; mygtty.sg_flags &= ~(ECHO); .. status = ioctl(fd, TIOCSETP, &mygtty); Now there is the new & better & standard & Posix & @$%@#^% termios infrastructure. None of the documentation I can find states, "here is how you have the goshdarn os leave serial data alone", so we are trying to translate the above using then information in the termios man page. So far, we have: status = tcgetattr(fd, &myAttr); .. myAttr.c_iflag &= (IXOFF | IXANY); myAttr.c_oflag &= ~(OPOST); myAttr.c_cflag &= ~(PARENB | PARODD | CSTOPB); myAttr.c_cflag |= (CS8 | CLOCAL); myAttr.c_lflag &= ~(XCASE | ICANON | ISIG); myAttr.c_lflag &= ~(ECHO); .. myAttr.c_cc[VMIN] = 1; myAttr.c_cc(VTIME] = 0; .. status = tcsetattr(fd, TCSANOW, &myAttr); which, unfortunately, does not work as we would like. Certain characters from the device still get eaten by the os. The serial protocol we use was designed a long time ago, assuming pure binary data could be passed between Unix and the device. It is extremely likely that we are not setting\clearing something which we should be. Unfortunately, it is not clear what. Six months ago we solved the problem by giving up on the new way and using the Solaris -> SunOS compatibility stuff (including and ), which allowed the use of the sgttyb stuff. This works fine. Now we are porting to Digital Unix 4.0, which obviously does not bother with SunOS backwards compatibility. (They do document BSD compatibity methods for code using sgttyb, but it is not the same as Sun implemented it.) The "right" way to go should be to use the new Posix termios method for controlling the serial port. So, if anyone knows the magic Posix incantation to have Unix not do any filtering of serial data--period--please share the spell. Thanks, Rich =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Rich Franzen richf@dba-sys.com (work) Staff Scientist rfranzen@digital.net (home) DBA Systems, Inc. 407/727-0660 x2294 (voice) 1200 S. Woody Burke Rd. 407/727-7019 (fax) Melbourne, FL 32901 {`DBA' != "doing business as"}