ref: 742fe500b5dcae2248e5d4d378a8026b8bdbf49b
parent: 1ac9d6ab0e2100fc395af4813b6283e009fd739f
author: cinap_lenrek <cinap_lenrek@localhost>
date: Sat May 21 14:39:13 EDT 2011
fix panic in usbuhci driver, increase max number of endpoints and alt configurations, make usb/audio continue besides some errors
--- a/sys/src/9/pc/usbuhci.c
+++ b/sys/src/9/pc/usbuhci.c
@@ -1107,7 +1107,6 @@
error(iso->err ? iso->err : Eio);
}
iso->state = Qdone;
- assert(iso->tdu != iso->tdi);
for(tot = 0; iso->tdi != iso->tdu && tot < count; tot += nr){
tdu = iso->tdu;
--- a/sys/src/cmd/usb/audio/audio.c
+++ b/sys/src/cmd/usb/audio/audio.c
@@ -358,10 +358,10 @@
if(setrec){
value[0] = i;
if(setcontrol(Record, "channels", value) == Undef)
- sysfatal("Can't set record channels");
+ fprint(2, "%s: can't set record channels\n", argv0);
value[0] = 16;
if(setcontrol(Record, "resolution", value) == Undef)
- sysfatal("Can't set record resolution");
+ fprint(2, "%s: can't set record resolution\n", argv0);
}
}
@@ -368,7 +368,7 @@
getcontrols(); /* Get the initial value of all controls */
value[0] = defaultspeed[Play];
if(endpt[Play] >= 0 && setcontrol(Play, "speed", value) < 0)
- sysfatal("can't set play speed");
+ fprint(2, "%s: can't set play speed\n", argv0);
value[0] = defaultspeed[Record];
if(endpt[Record] >= 0 && setcontrol(Record, "speed", value) < 0)
fprint(2, "%s: can't set record speed\n", argv0);
--- a/sys/src/cmd/usb/audio/audioctl.c
+++ b/sys/src/cmd/usb/audio/audioctl.c
@@ -131,7 +131,7 @@
int
setspeed(int rec, int speed)
{
- int ps, n, no, dist, i;
+ int n, no, dist, i;
Audioalt *a;
Altc *da;
Ep *ep;
@@ -214,15 +214,6 @@
speed = n;
}
dprint(2, " speed now %d Hz;", speed);
- }
- ps = ((speed * da->interval + 999) / 1000)
- * controls[rec][Channel_control].value[0]
- * controls[rec][Resolution_control].value[0]/8;
- if(ps > ep->maxpkt){
- fprint(2, "%s: setspeed(rec %d, speed %d): packet size %d > "
- "maximum packet size %d\n",
- argv0, rec, speed, ps, ep->maxpkt);
- return Undef;
}
dprint(2, "Configuring %s endpoint for %d Hz\n",
rec?"record":"playback", speed);
--- a/sys/src/cmd/usb/lib/fsdir.c
+++ b/sys/src/cmd/usb/lib/fsdir.c
@@ -66,8 +66,6 @@
{
int i, j;
- print("%s: %s\n", argv0, dfs->name);
-
dprint(2, "%s: fsadd %s\n", argv0, dfs->name);
qlock(&fslck);
for(i = 1; i < nfs; i++)
--- a/sys/src/cmd/usb/lib/usb.h
+++ b/sys/src/cmd/usb/lib/usb.h
@@ -13,13 +13,13 @@
enum {
/* fundamental constants */
- Nep = 16, /* max. endpoints per usb device & per interface */
+ Nep = 256, /* max. endpoints per usb device & per interface */
/* tunable parameters */
Nconf = 16, /* max. configurations per usb device */
Nddesc = 8*Nep, /* max. device-specific descriptors per usb device */
Niface = 16, /* max. interfaces per configuration */
- Naltc = 16, /* max. alt configurations per interface */
+ Naltc = 256, /* max. alt configurations per interface */
Uctries = 4, /* no. of tries for usbcmd */
Ucdelay = 50, /* delay before retrying */