From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <96076329121211.tru64-unix-managers.marc@archive.invalid> From: Sundara Vardhan Date: Thu, 08 Feb 1996 15:07:24 +0000 To: tru64-unix-managers Subject: Serial Ports X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=96076329121211 I have a DEC AlphaStation 200 running OSF1 V3.2 and am trying to monitor the state of a simple device attached to the serial port. The device has two rocker switches both of which can be in one of three positions. Using DTR as input, the device turns DCD high when switch 1 is up, DSR high when switch 1 is down, CTS high when switch 2 is up, and RI high when switch 2 is down. My problem is that I'm not able to detect when ring indicator is high (switch 2 down). The other three bits go high when expected but not TIOCM_RI. Following is a code snippet from a test driver: --- int modem_ctl_mask = TIOCM_DTR; int modem_ctl_state = 0; /* Open */ serialPort_fd = open( "/dev/tty00", O_RDWR | O_SYNC, 0666 ); if ( serialPort_fd == -1 ) exit( -1 ); /* Init (set DTR high) */ if ( ioctl( serialPort_fd, TIOCMSET, &modem_ctl_mask) == -1 ) { perror( "ioctl" ); exit( -1 ); } /* Read */ while ( ioctl(serialPort_fd, TIOCMGET, &modem_ctl_state) != -1 ) { printf("data terminal ready %d\n", (modem_ctl_state & TIOCM_DTR) ? 1 : 0); printf("carrier detect %d\n", (modem_ctl_state & TIOCM_CD) ? 1 : 0); printf("data set ready %d\n", (modem_ctl_state & TIOCM_DSR) ? 1 : 0); printf("clear to send %d\n", (modem_ctl_state & TIOCM_CTS) ? 1 : 0); printf("ring %d\n", (modem_ctl_state & TIOCM_RI) ? 1 : 0); } --- Response from DEC tech support has been painfully slow (over a week and counting). Any ideas how I can detect when ring indicator is high? (This is definitely not a hardware problem.) Any tips would be appreciated... TIA Vardhan