diff options
| author | Poul-Henning Kamp <phk@FreeBSD.org> | 2008-12-14 20:03:46 +0000 |
|---|---|---|
| committer | Poul-Henning Kamp <phk@FreeBSD.org> | 2008-12-14 20:03:46 +0000 |
| commit | da8fce5a73b64e64ce594cbfa8054532aa97ca08 (patch) | |
| tree | 8a5f84a74e23f04302d88ec9780ff23c8fd94fce /sys | |
| parent | 54ebdd631db8c0bba2baab0155f603a8b5cf014a (diff) | |
Notes
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/dev/usb/ucom.c | 39 | ||||
| -rw-r--r-- | sys/dev/usb/ucomvar.h | 1 |
2 files changed, 23 insertions, 17 deletions
diff --git a/sys/dev/usb/ucom.c b/sys/dev/usb/ucom.c index 7496d404331a..3a283d899fb7 100644 --- a/sys/dev/usb/ucom.c +++ b/sys/dev/usb/ucom.c @@ -700,11 +700,30 @@ ucomstartread(struct ucom_softc *sc) return (USBD_NORMAL_COMPLETION); } +void +ucomrxchars(struct ucom_softc *sc, u_char *cp, u_int32_t cc) +{ + struct tty *tp = sc->sc_tty; + + /* Give characters to tty layer. */ + while (cc > 0) { + DPRINTFN(7, ("ucomreadcb: char = 0x%02x\n", *cp)); + if (ttydisc_rint(tp, *cp, 0) == -1) { + /* XXX what should we do? */ + printf("%s: lost %d chars\n", + device_get_nameunit(sc->sc_dev), cc); + break; + } + cc--; + cp++; + } + ttydisc_rint_done(tp); +} + static void ucomreadcb(usbd_xfer_handle xfer, usbd_private_handle p, usbd_status status) { struct ucom_softc *sc = (struct ucom_softc *)p; - struct tty *tp = sc->sc_tty; usbd_status err; u_int32_t cc; u_char *cp; @@ -737,22 +756,8 @@ ucomreadcb(usbd_xfer_handle xfer, usbd_private_handle p, usbd_status status) device_get_nameunit(sc->sc_dev), cc); goto resubmit; } - if (cc < 1) - goto resubmit; - - /* Give characters to tty layer. */ - while (cc > 0) { - DPRINTFN(7, ("ucomreadcb: char = 0x%02x\n", *cp)); - if (ttydisc_rint(tp, *cp, 0) == -1) { - /* XXX what should we do? */ - printf("%s: lost %d chars\n", - device_get_nameunit(sc->sc_dev), cc); - break; - } - cc--; - cp++; - } - ttydisc_rint_done(tp); + if (cc > 0) + ucomrxchars(sc, cp, cc); resubmit: err = ucomstartread(sc); diff --git a/sys/dev/usb/ucomvar.h b/sys/dev/usb/ucomvar.h index 0fcd7f36bc35..4433a1aeb431 100644 --- a/sys/dev/usb/ucomvar.h +++ b/sys/dev/usb/ucomvar.h @@ -166,3 +166,4 @@ void ucom_attach_tty(struct ucom_softc *, char*, int); int ucom_attach(struct ucom_softc *); int ucom_detach(struct ucom_softc *); void ucom_status_change(struct ucom_softc *); +void ucomrxchars(struct ucom_softc *sc, u_char *cp, u_int32_t cc); |
