Just askin'...
As I may have mentioned earlier, I'm having to deal with a cluster of UARTs under Linux.
I'd previously set the Baud rate, data bits, and the rest of the usual stuff, using termios.
Thing is: now I gotta do modem control. This involves tty_ioctl. All straightforward, right? This is old stuff?
TTY_IOCTL(4) Linux Programmer's Manual TTY_IOCTL(4)
NAME
tty_ioctl - ioctls for terminals and serial linesSYNOPSIS
#include <termios.h>int ioctl(int fd, int cmd, ...);
. . .
Modem control
TIOCMGET int *argp
get the status of modem bits.TIOCMSET const int *argp
set the status of modem bits.TIOCMBIC const int *argp
clear the indicated modem bits.TIOCMBIS const int *argp
set the indicated modem bits.Bits used by these four ioctls:
TIOCM_LE DSR (data set ready/line enable)
TIOCM_DTR DTR (data terminal ready)
TIOCM_RTS RTS (request to send)
TIOCM_ST Secondary TXD (transmit)
TIOCM_SR Secondary RXD (receive)
TIOCM_CTS CTS (clear to send)
TIOCM_CAR DCD (data carrier detect)
TIOCM_CD see TIOCM_CAR
TIOCM_RNG RNG (ring)
TIOCM_RI see TIOCM_RNG
TIOCM_DSR DSR (data set ready)
Except... <termios.h> doesn't define those constants. They're defined in <asm-generic/ioctls.h> and <asm-generic/termios.h>., and maybe in some other places, possibly valgrind-related and having machine-specific header names. But! The asm-generic version of termios has some sort of incompatible definition that now causes a segfault when I try to use the modern termios functions that worked before.
So I guess I gotta do some digging. Maybe the answer is out there on the 'Net, or maybe I need to find the source code for, e.g., GtkTerm and see how it's handled there.
Update: The actual requirements appear to be
#include <sys/ioctl.h>
#include <termios.h>
At least, the program compiles and doesn't bomb instantly. Now I need to see if it's actually working.
Comments