Exemplo n.º 1
0
static int hvterm_hvsi_tiocmset(struct hvc_struct *hp, unsigned int set,
				unsigned int clear)
{
	struct hvterm_priv *pv = hvterm_privs[hp->vtermno];

	pr_devel("HVSI@%x: Set modem control, set=%x,clr=%x\n",
		 pv->termno, set, clear);

	if (set & TIOCM_DTR)
		hvsilib_write_mctrl(&pv->hvsi, 1);
	else if (clear & TIOCM_DTR)
		hvsilib_write_mctrl(&pv->hvsi, 0);

	return 0;
}
Exemplo n.º 2
0
void hvsilib_close(struct hvsi_priv *pv, struct hvc_struct *hp)
{
	unsigned long flags;

	pr_devel("HVSI@%x: close !\n", pv->termno);

	if (!pv->is_console) {
		pr_devel("HVSI@%x: Not a console, tearing down\n",
			 pv->termno);

		/* Clear opened, synchronize with khvcd */
		spin_lock_irqsave(&hp->lock, flags);
		pv->opened = 0;
		spin_unlock_irqrestore(&hp->lock, flags);

		/* Clear our own DTR */
		if (!pv->tty || (pv->tty->termios->c_cflag & HUPCL))
			hvsilib_write_mctrl(pv, 0);

		/* Tear down the connection */
		hvsi_send_close(pv);
	}

	if (pv->tty)
		tty_kref_put(pv->tty);
	pv->tty = NULL;
}
Exemplo n.º 3
0
void hvsilib_establish(struct hvsi_priv *pv)
{
	int timeout;

	pr_devel("HVSI@%x: Establishing...\n", pv->termno);

	/* Try for up to 200ms, there can be a packet to
	 * start the process waiting for us...
	 */
	for (timeout = 0; timeout < 20; timeout++) {
		if (pv->established)
			goto established;
		if (!hvsi_get_packet(pv))
			maybe_msleep(10);
	}

	/* Failed, send a close connection packet just
	 * in case
	 */
	pr_devel("HVSI@%x:   ... sending close\n", pv->termno);

	hvsi_send_close(pv);

	/* Then restart handshake */

	pr_devel("HVSI@%x:   ... restarting handshake\n", pv->termno);

	hvsi_start_handshake(pv);

	pr_devel("HVSI@%x:   ... waiting handshake\n", pv->termno);

	/* Try for up to 400ms */
	for (timeout = 0; timeout < 40; timeout++) {
		if (pv->established)
			goto established;
		if (!hvsi_get_packet(pv))
			maybe_msleep(10);
	}

	if (!pv->established) {
		pr_devel("HVSI@%x: Timeout handshaking, giving up !\n",
			 pv->termno);
		return;
	}
 established:
	/* Query modem control lines */

	pr_devel("HVSI@%x:   ... established, reading mctrl\n", pv->termno);

	hvsilib_read_mctrl(pv);

	/* Set our own DTR */

	pr_devel("HVSI@%x:   ... setting mctrl\n", pv->termno);

	hvsilib_write_mctrl(pv, 1);

	/* Set the opened flag so reads are allowed */
	wmb();
	pv->opened = 1;
}