Serial Ports

From: Sundara Vardhan <svardhan_at_siwest.cts.com>
Date: Wed, 7 Feb 96 13:37:28 PST

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...
r
Ronald Sean Jordan
Systems Integreated
rjordan_at_siwest.cts.com
Received on Thu Feb 08 1996 - 00:41:03 NZDT

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:46 NZDT