int xf86SetSerialModemState(int fd, int state) { int ret; int s; if (fd < 0) return -1; /* Don't try to set parameters for non-tty devices. */ if (!isatty(fd)) return 0; #ifndef TIOCMGET return -1; #else if (!osStateMask) osStateMask = getOsStateMask(); state = xf2osState(state); SYSCALL((ret = ioctl(fd, TIOCMGET, &s))); if (ret < 0) return -1; s &= ~osStateMask; s |= state; SYSCALL((ret = ioctl(fd, TIOCMSET, &s))); if (ret < 0) return -1; else return 0; #endif }
int xf86SetSerialModemState(int fd, int state) { ULONG s; if (fd < 0) return -1; /* Don't try to set parameters for non-tty devices. */ if (!isatty(fd)) return 0; if (!osStateMask) osStateMask = getOsStateMask(); state = xf2osState(state); if (_get_modem_state(fd,&s) != 0) return -1; s &= ~osStateMask; s |= state; return _set_modem_state(fd,s,0x03); }