diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2021-02-10 20:08:13 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2021-02-10 20:08:13 +0100 |
commit | 2f28aaac65b4dde059f393222bfd2f939d83f9f5 (patch) | |
tree | 3767e9061c1c2e39860b580005e8e9cdd59e7922 | |
parent | d7ade692c8c3c96bae6828f63afb1b19765b5589 (diff) | |
download | plan9front-2f28aaac65b4dde059f393222bfd2f939d83f9f5.tar.xz |
nusb: don't create rw iso endpoints (by Michael Forney)
There may be two iso endpoints with the same ID if it is asynchronous
or adaptive (one for data, one for feedback), and rw iso endpoints are
unusable (error out with "iso i/o is half-duplex").
-rw-r--r-- | sys/src/cmd/nusb/lib/parse.c | 11 | ||||
-rw-r--r-- | sys/src/cmd/nusb/lib/usb.h | 9 |
2 files changed, 15 insertions, 5 deletions
diff --git a/sys/src/cmd/nusb/lib/parse.c b/sys/src/cmd/nusb/lib/parse.c index 916da0b3e..4b795bf7c 100644 --- a/sys/src/cmd/nusb/lib/parse.c +++ b/sys/src/cmd/nusb/lib/parse.c @@ -111,8 +111,6 @@ parseendpt(Usbdev *d, Conf *c, Iface *ip, Altc *altc, uchar *b, int n, Ep **epp) return -1; } dep = (DEp *)b; - altc->attrib = dep->bmAttributes; /* here? */ - altc->interval = dep->bInterval; type = dep->bmAttributes & 0x03; addr = dep->bEndpointAddress; @@ -145,13 +143,18 @@ parseendpt(Usbdev *d, Conf *c, Iface *ip, Altc *altc, uchar *b, int n, Ep **epp) ep->maxpkt = GET2(dep->wMaxPacketSize); ep->ntds = 1 + ((ep->maxpkt >> 11) & 3); ep->maxpkt &= 0x7FF; - altc->maxpkt = ep->maxpkt; - altc->ntds = ep->ntds; ep->addr = addr; ep->type = type; ep->isotype = (dep->bmAttributes>>2) & 0x03; + ep->isousage = (dep->bmAttributes>>4) & 0x03; ep->conf = c; ep->iface = ip; + if(ep->type != Eiso || ep->isousage == Edata || ep->isousage == Eimplicit){ + altc->attrib = dep->bmAttributes; + altc->interval = dep->bInterval; + altc->maxpkt = ep->maxpkt; + altc->ntds = ep->ntds; + } for(i = 0; i < nelem(ip->ep); i++) if(ip->ep[i] == nil) break; diff --git a/sys/src/cmd/nusb/lib/usb.h b/sys/src/cmd/nusb/lib/usb.h index 6a0f790ad..9abf2a9f4 100644 --- a/sys/src/cmd/nusb/lib/usb.h +++ b/sys/src/cmd/nusb/lib/usb.h @@ -116,6 +116,11 @@ enum { Eadapt = 2, Esync = 3, + /* endpoint isousage */ + Edata = 0, + Efeedback = 1, + Eimplicit = 2, + /* config attrib */ Cbuspowered = 1<<7, Cselfpowered = 1<<6, @@ -209,7 +214,9 @@ struct Ep uchar addr; /* endpt address, 0-15 (|0x80 if Ein) */ uchar dir; /* direction, Ein/Eout */ uchar type; /* Econtrol, Eiso, Ebulk, Eintr */ - uchar isotype; /* Eunknown, Easync, Eadapt, Esync */ + uchar isotype; /* Eunknown, Easync, Eadapt, Esync */ + uchar isousage; /* Edata, Efeedback, Eimplicit */ + int id; int maxpkt; /* max. packet size */ int ntds; /* nb. of Tds per µframe */ |