Do not forcefully close the write transfer when closing the tty, it needs to

run to completion and drain the tty queue.
This commit is contained in:
thompsa 2009-05-26 17:06:36 +00:00
parent a08e1f64b1
commit daa6d3326c
2 changed files with 7 additions and 21 deletions

View File

@ -589,13 +589,9 @@ usb2_com_cfg_close(struct usb2_proc_msg *_task)
DPRINTF("\n");
if (sc->sc_flag & UCOM_FLAG_LL_READY) {
sc->sc_flag &= ~(UCOM_FLAG_LL_READY |
UCOM_FLAG_GP_DATA);
if (sc->sc_callback->usb2_com_cfg_close) {
sc->sc_flag &= ~UCOM_FLAG_LL_READY;
if (sc->sc_callback->usb2_com_cfg_close)
(sc->sc_callback->usb2_com_cfg_close) (sc);
}
} else {
/* already closed */
}
@ -620,16 +616,11 @@ usb2_com_close(struct tty *tp)
&sc->sc_close_task[0].hdr,
&sc->sc_close_task[1].hdr);
sc->sc_flag &= ~(UCOM_FLAG_HL_READY |
UCOM_FLAG_WR_START |
UCOM_FLAG_RTS_IFLOW);
sc->sc_flag &= ~(UCOM_FLAG_HL_READY | UCOM_FLAG_RTS_IFLOW);
if (sc->sc_callback->usb2_com_stop_read) {
(sc->sc_callback->usb2_com_stop_read) (sc);
}
if (sc->sc_callback->usb2_com_stop_write) {
(sc->sc_callback->usb2_com_stop_write) (sc);
}
}
static int
@ -1005,8 +996,6 @@ usb2_com_outwakeup(struct tty *tp)
/* The higher layer is not ready */
return;
}
sc->sc_flag |= UCOM_FLAG_WR_START;
usb2_com_start_transfers(sc);
}
@ -1028,9 +1017,8 @@ usb2_com_get_data(struct usb2_com_softc *sc, struct usb2_page_cache *pc,
mtx_assert(sc->sc_mtx, MA_OWNED);
if ((!(sc->sc_flag & UCOM_FLAG_HL_READY)) ||
(!(sc->sc_flag & UCOM_FLAG_GP_DATA)) ||
(!(sc->sc_flag & UCOM_FLAG_WR_START))) {
if (tty_gone(tp) ||
!(sc->sc_flag & UCOM_FLAG_GP_DATA)) {
actlen[0] = 0;
return (0); /* multiport device polling */
}
@ -1076,10 +1064,9 @@ usb2_com_put_data(struct usb2_com_softc *sc, struct usb2_page_cache *pc,
mtx_assert(sc->sc_mtx, MA_OWNED);
if ((!(sc->sc_flag & UCOM_FLAG_HL_READY)) ||
(!(sc->sc_flag & UCOM_FLAG_GP_DATA))) {
if (tty_gone(tp))
return; /* multiport device polling */
}
if (len == 0)
return; /* no data */

View File

@ -167,7 +167,6 @@ struct usb2_com_softc {
#define UCOM_FLAG_GONE 0x02 /* the device is gone */
#define UCOM_FLAG_ATTACHED 0x04 /* set if attached */
#define UCOM_FLAG_GP_DATA 0x08 /* set if get and put data is possible */
#define UCOM_FLAG_WR_START 0x10 /* set if write start was issued */
#define UCOM_FLAG_LL_READY 0x20 /* set if low layer is ready */
#define UCOM_FLAG_HL_READY 0x40 /* set if high layer is ready */
uint8_t sc_lsr;