diff options
author | Dale Rahn <drahn@cvs.openbsd.org> | 2007-02-15 04:34:45 +0000 |
---|---|---|
committer | Dale Rahn <drahn@cvs.openbsd.org> | 2007-02-15 04:34:45 +0000 |
commit | 522acf852402eb457440aea0d901d5f7cc4a23cc (patch) | |
tree | f9346c474e5718edce2cd4f200094067dcc590c3 | |
parent | 6eaf61be172d046c0072644b64be7977d34bb4e2 (diff) |
USB host is not scanning for packets if attached but cdce is not up.
As an initial workaround for this, do not attempt to send any packets
until a packet has been recieved.
-rw-r--r-- | sys/dev/usb/if_cdcef.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/sys/dev/usb/if_cdcef.c b/sys/dev/usb/if_cdcef.c index 49f300e95c7..ed3b6cb4f19 100644 --- a/sys/dev/usb/if_cdcef.c +++ b/sys/dev/usb/if_cdcef.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_cdcef.c,v 1.3 2007/02/13 18:32:56 drahn Exp $ */ +/* $OpenBSD: if_cdcef.c,v 1.4 2007/02/15 04:34:44 drahn Exp $ */ /* * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org> @@ -77,6 +77,7 @@ struct cdcef_softc { int sc_rxeof_errors; int sc_unit; int sc_attached; + int sc_listening; }; int cdcef_match(struct device *, void *, void *); @@ -261,7 +262,6 @@ USB_ATTACH(cdcef) sc->sc_attached = 1; splx(s); - USB_ATTACH_SUCCESS_RETURN; } @@ -281,11 +281,20 @@ cdcef_start(struct ifnet *ifp) if(ifp->if_flags & IFF_OACTIVE) return; + IFQ_POLL(&ifp->if_snd, m_head); if (m_head == NULL) { return; } + + if (sc->sc_listening == 0) { + /* drop packet because reciever is not listening */ + IFQ_DEQUEUE(&ifp->if_snd, m_head); + m_freem(m_head); + return; + } + if (cdcef_encap(sc, m_head, 0)) { ifp->if_flags |= IFF_OACTIVE; return; @@ -368,6 +377,12 @@ cdcef_rxeof(usbf_xfer_handle xfer, usbf_private_handle priv, } sc->sc_rxeof_errors = 0; + /* upon first incoming packet we know the host is listening */ + if (sc->sc_listening == 0) { + sc->sc_listening = 1; + } + + usbf_get_xfer_status(xfer, NULL, NULL, &total_len, NULL); printf("recieved %d bytes\n", total_len); |