If anyone has used ioctl(TIOMIWAIT) I'd appreciate some
help.

My code waits for a pulse-per-second signal on DCD, the code
can be summarised as below, the full code is at 
http://www.aarnet.edu.au/~gdt/misc/shm_splc.c

I get the message "Input/output error" at the perror()
below.  The full output can be seen at
http://www.aarnet.edu.au/~gdt/misc/shm_splc.txt

The RS-232 port has the PPS connected to RS-232 DCD,
the PPS ground to RS-232 SignalGnd.  No other pins
are connected.

I also get the same error if only TIOCM_CAR is
listed or if the port is opened with O_RDWR.

Running Red Hat Linux 9, Linux 2.4.20-20.9 on
Intel Pentium M.  The serial port works for
everything else I've used it for.  Running
statserial repeatedly shows DCD being pulsed.

Any help would be appreciated, I'm a bit at my wit's
end.


int f;
struct termios term;

/* Open and configure */
f = open(name, O_RDONLY|O_NOCTTY);
tcgetattr(f, &term)
(void)cfmakeraw(&term);
term.c_iflag |= IGNBRK;
term.c_iflag &= ~IXON;
term.c_iflag |= IGNPAR;
term.c_cflag &= ~PARENB;
term.c_cflag &= ~CRTSCTS;
term.c_lflag &= ~ISIG;
term.c_lflag &= ~ECHO;
term.c_cflag &= ~CLOCAL;
tcsetattr(f, TCSANOW, &term);

int serial_signal = TIOCM_CAR | TIOCM_CTS | TIOCM_DSR;
status = ioctl(f, TIOCMIWAIT, &serial_signal);
if (status == -1) {
  perror("/dev/ttyS0");
  exit(1);
}


-- 
Glen Turner         Tel: (08) 8303 3936 or +61 8 8303 3936 
Network Engineer          Email: [EMAIL PROTECTED]
Australian Academic & Research Network   www.aarnet.edu.au


-- 
SLUG - Sydney Linux User's Group - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug

Reply via email to