From: Sundara Vardhan <svardhan () siwest ! cts ! com>
To: tru64-unix-managers
Subject: Serial Ports
Date: Thu, 08 Feb 1996 15:07:24 +0000 [thread overview]
Message-ID: <96076329121211.tru64-unix-managers.marc@archive.invalid> (raw)
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
next reply other threads:[~1996-02-08 15:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-02-08 15:07 Sundara Vardhan [this message]
-- strict thread matches above, loose matches on Subject: below --
2000-02-24 18:18 Serial ports
1996-01-29 4:27 Serial Ports Tom
1995-03-16 21:46 smcclain
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox