On Wed, 2003-01-15 at 08:58, Greg KH wrote:
> On Wed, Jan 15, 2003 at 01:54:22AM +0000, oliverthered wrote:
> > 
> > 
> > On Wed, 2003-01-15 at 01:33, Greg KH wrote:
> > > On Tue, Jan 14, 2003 at 11:58:04PM +0000, oliverthered wrote:
> > > > 
> > > > Any comments?
> > > 
> > > Your patch is line wrapped, mind fixing your mailer and trying again?
> > see attached.
> > (If anyone knows how to turn line wrap off in evolution let me know.) 
> 
> Ok, a few comments.  It looks like you are trying to do multiple things
> with this patch.  Mind sending a few different ones, one per change?
> 
> Also, the formatting of the for loops and the if statements at the end
> of the patch is all wrong, please clean that up.
> 
> thanks,
> 
> greg k-h

Ok, i've split the patches, and fixed & used  usb_epnum_to_ep instead of
putting all the code in proc_submiturb.


Three patches attached (i'll find a mail client that doesn't wrap lines)

usb.c.epnumto.patch:
This patch insures that usb_epnum_to_ep uses act_setting when looking
for an endpoint.

devio.c.findintfep.patch
This patch insures that findintfep uses act_setting when looking for an
endpoint.

devio.c.submiturb.patch
This patches proc_submiturb so that the interval for ISO urb's is taken
from the requested urb endpoint.


Changes to usb_epnum_to_ep and usb_epnum_to_ep will break drivers that
require an alt_setting other than 0 but fail to call setinterface.


changes to usb_epnum_to_ep will unpredictable results if the patch to
usb_epnum_to_ep isn't applied and there are ISO alt_settings with
different intervals.
--- linux-2.5.54/drivers/usb/core/devio.c	2003-01-02 03:22:02.000000000 +0000
+++ /usr/src/linux/drivers/usb/core/devio.c	2003-01-15 13:25:13.000000000 +0000
@@ -405,7 +405,7 @@
 
 static int findintfep(struct usb_device *dev, unsigned int ep)
 {
-	unsigned int i, j, e;
+	unsigned int i, e;
         struct usb_interface *iface;
 	struct usb_host_interface *alts;
 	struct usb_endpoint_descriptor *endpt;
@@ -414,14 +414,13 @@
 		return -EINVAL;
 	for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++) {
 		iface = &dev->actconfig->interface[i];
-		for (j = 0; j < iface->num_altsetting; j++) {
-                        alts = &iface->altsetting[j];
-			for (e = 0; e < alts->desc.bNumEndpoints; e++) {
-				endpt = &alts->endpoint[e].desc;
-				if (endpt->bEndpointAddress == ep)
-					return i;
-			}
+                alts = &iface->altsetting[iface->act_altsetting];
+		for (e = 0; e < alts->desc.bNumEndpoints; e++) {
+			endpt = &alts->endpoint[e].desc;
+			if (endpt->bEndpointAddress == ep)
+				return i;
 		}
+		
 	}
 	return -ENOENT; 
 }
--- linux-2.5.54/drivers/usb/core/devio.c	2003-01-02 03:22:02.000000000 +0000
+++ /usr/src/linux/drivers/usb/core/devio.c	2003-01-15 13:24:21.000000000 +0000
@@ -854,6 +854,10 @@
 			return -EINVAL;
 		}
 		uurb.buffer_length = totlen;
+		if(!(ep_desc = usb_epnum_to_ep_desc(ps->dev, uurb.endpoint)))
+			return -ENOENT;
+		interval = ep_desc->bInterval;
+		
 		break;
 
 	case USBDEVFS_URB_TYPE_INTERRUPT:
--- linux-2.5.54/drivers/usb/core/usb.c	2003-01-02 03:22:04.000000000 +0000
+++ /usr/src/linux/drivers/usb/core/usb.c	2003-01-15 02:21:46.000000000 +0000
@@ -256,16 +256,17 @@
 	int i, j, k;
 
 	for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++)
-		for (j = 0; j < dev->actconfig->interface[i].num_altsetting; j++)
-			for (k = 0; k < dev->actconfig->interface[i]
-				.altsetting[j].desc.bNumEndpoints; k++)
-				if (epnum == dev->actconfig->interface[i]
-						.altsetting[j].endpoint[k]
-						.desc.bEndpointAddress)
-					return &dev->actconfig->interface[i]
-						.altsetting[j].endpoint[k]
-						.desc;
-
+	{
+	j=dev->actconfig->interface[i].act_altsetting;
+		for (k = 0; k < dev->actconfig->interface[i]
+			.altsetting[j].desc.bNumEndpoints; k++)
+			if (epnum == dev->actconfig->interface[i]
+					.altsetting[j].endpoint[k]
+					.desc.bEndpointAddress)
+				return &dev->actconfig->interface[i]
+					.altsetting[j].endpoint[k]
+					.desc;
+	}
 	return NULL;
 }
 

Reply via email to