diff options
author | imp <imp@FreeBSD.org> | 2008-09-05 20:49:45 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2008-09-05 20:49:45 +0000 |
commit | e4872726d92d1195a80cddb76ae6b056b38b1cc6 (patch) | |
tree | e3ae86a359190e595046871c396c326b1a251535 | |
parent | 52a83317514e5746c314daf7fd2177f9e07e4645 (diff) | |
download | FreeBSD-src-e4872726d92d1195a80cddb76ae6b056b38b1cc6.zip FreeBSD-src-e4872726d92d1195a80cddb76ae6b056b38b1cc6.tar.gz |
Keep track of the active buffer on output. For the moment, panic if
the device indicates that it wasn't able to write all the data in the
buffer out.
Ed Schouten doesn't like the idea of a panic here. I think for
production code, we need something better. For right now, while we're
trying to assess the impact of this issue, a panic is OK. So complain
to me, not him if this is hit.
-rw-r--r-- | sys/dev/usb/ucom.c | 4 | ||||
-rw-r--r-- | sys/dev/usb/ucomvar.h | 1 |
2 files changed, 5 insertions, 0 deletions
diff --git a/sys/dev/usb/ucom.c b/sys/dev/usb/ucom.c index 29c11ec..04efc27 100644 --- a/sys/dev/usb/ucom.c +++ b/sys/dev/usb/ucom.c @@ -587,6 +587,7 @@ ucomtty_outwakeup(struct tty *tp) sc->sc_state &= ~UCS_TXBUSY; return; } + sc->sc_obufactive = cnt; DPRINTF(("ucomtty_outwakeup: %zu chars\n", cnt)); usbd_setup_xfer(sc->sc_oxfer, sc->sc_bulkout_pipe, @@ -661,6 +662,9 @@ ucomwritecb(usbd_xfer_handle xfer, usbd_private_handle p, usbd_status status) /* convert from USB bytes to tty bytes */ cc -= sc->sc_opkthdrlen; + if (cc != sc->sc_obufactive) + panic("Partial write of %d of %d bytes, not supported\n", + cc, sc->sc_obufactive); sc->sc_state &= ~UCS_TXBUSY; #if 0 diff --git a/sys/dev/usb/ucomvar.h b/sys/dev/usb/ucomvar.h index 7a35a0a..32d7c04 100644 --- a/sys/dev/usb/ucomvar.h +++ b/sys/dev/usb/ucomvar.h @@ -140,6 +140,7 @@ struct ucom_softc { u_int sc_obufsize; /* write buffer size */ u_int sc_opkthdrlen; /* header length of output packet */ + u_int sc_obufactive; /* Active bytes in buffer */ struct ucom_callback *sc_callback; void *sc_parent; |