/* ugly modem control command completement, convert to ioctl */ static ssize_t modem_write(struct file *filp, const char __user *buffer, size_t count, loff_t *offset) { if (down_interruptible(&modem_downlock) != 0) return count; if(count >= 5 && !strncmp(buffer, "renum", 5)) modem_ioctl(filp, IOCTL_LINK_RENUM_MODEM, 0); if(count >= 4 && !strncmp(buffer, "main", 4)) modem_ioctl(filp, IOCTL_LINK_MAIN_MODEM, 0); if(count >= 5 && !strncmp(buffer, "reset", 5)) modem_ioctl(filp, IOCTL_LINK_RESET_MODEM, 0); if(count >= 2 && !strncmp(buffer, "on", 2)) modem_ioctl(filp, IOCTL_LINK_ON_MODEM, 0); if(count >= 3 && !strncmp(buffer, "off", 3)) modem_ioctl(filp, IOCTL_LINK_OFF_MODEM, 0); up(&modem_downlock); return count; }
int tty_dcd(void) { return !!(modem_ioctl(TIOCMGET,0) & TIOCM_CD); }
int tty_ri(void) { return !!(modem_ioctl(TIOCMGET,0) & TIOCM_RI); }
int tty_dsr(void) { return !!(modem_ioctl(TIOCMGET,0) & TIOCM_DSR); }
int tty_cts(void) { return !!(modem_ioctl(TIOCMGET,0) & TIOCM_CTS); }
void tty_td(int on) { modem_ioctl(on ? TIOCSBRK : TIOCCBRK,0); }
void tty_rts(int on) { modem_ioctl(on ? TIOCMBIS : TIOCMBIC,TIOCM_RTS); }
void tty_dtr(int on) { modem_ioctl(on ? TIOCMBIS : TIOCMBIC,TIOCM_DTR); }