diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2017-07-24 23:47:55 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2017-07-24 23:47:55 +0200 |
commit | a397bfd48c9b0f2f0d335752cb52f286afcf1ad7 (patch) | |
tree | d44e80fbb3ea9506b35fb580f31ba47a62485b3e /sys/src/cmd/nusb | |
parent | 0b4ace02c469484c9f2a42fdc79ffe1d123d04d8 (diff) |
usb: fix wrong pollival calculation in setmaxpkt()
Diffstat (limited to 'sys/src/cmd/nusb')
-rw-r--r-- | sys/src/cmd/nusb/lib/dev.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/sys/src/cmd/nusb/lib/dev.c b/sys/src/cmd/nusb/lib/dev.c index cd9d15a38..f7bcc04ae 100644 --- a/sys/src/cmd/nusb/lib/dev.c +++ b/sys/src/cmd/nusb/lib/dev.c @@ -45,11 +45,6 @@ openep(Dev *d, int id) return nil; } ep = ud->ep[id]; - mode = "rw"; - if(ep->dir == Ein) - mode = "r"; - if(ep->dir == Eout) - mode = "w"; snprint(name, sizeof(name), "/dev/usb/ep%d.%d", d->id, id); if(access(name, AEXIST) == 0){ dprint(2, "%s: %s already exists; trying to open\n", argv0, name); @@ -60,6 +55,11 @@ openep(Dev *d, int id) } return epd; } + mode = "rw"; + if(ep->dir == Ein) + mode = "r"; + if(ep->dir == Eout) + mode = "w"; if(devctl(d, "new %d %d %s", id, ep->type, mode) < 0){ dprint(2, "%s: %s: new: %r\n", argv0, d->dir); return nil; @@ -79,13 +79,6 @@ openep(Dev *d, int id) else dprint(2, "%s: %s: ntds %d\n", argv0, epd->dir, ep->ntds); - /* - * For iso endpoints and high speed interrupt endpoints the pollival is - * actually 2ⁿ and not n. - * The kernel usb driver must take that into account. - * It's simpler this way. - */ - if(ac != nil && (ep->type == Eintr || ep->type == Eiso) && ac->interval != 0) if(devctl(epd, "pollival %d", ac->interval) < 0) fprint(2, "%s: %s: openep: pollival: %r\n", argv0, epd->dir); |