Exemple #1
0
/* 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;
}
Exemple #2
0
int tty_dcd(void)
{
    return !!(modem_ioctl(TIOCMGET,0) & TIOCM_CD);
}
Exemple #3
0
int tty_ri(void)
{
    return !!(modem_ioctl(TIOCMGET,0) & TIOCM_RI);
}
Exemple #4
0
int tty_dsr(void)
{
    return !!(modem_ioctl(TIOCMGET,0) & TIOCM_DSR);
}
Exemple #5
0
int tty_cts(void)
{
    return !!(modem_ioctl(TIOCMGET,0) & TIOCM_CTS);
}
Exemple #6
0
void tty_td(int on)
{
    modem_ioctl(on ? TIOCSBRK : TIOCCBRK,0);
}
Exemple #7
0
void tty_rts(int on)
{
    modem_ioctl(on ? TIOCMBIS : TIOCMBIC,TIOCM_RTS);
}
Exemple #8
0
void tty_dtr(int on)
{
    modem_ioctl(on ? TIOCMBIS : TIOCMBIC,TIOCM_DTR);
}