Re: [Query] Composite gadget: Issues with interface order

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 1 Feb 2011, Maulik Mankad wrote:

> On Mon, Jan 31, 2011 at 8:27 PM, Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:
> >>
> >> Since RNDIS is disabled by default the Configuration descriptor also
> >> shows UMS as the first interface.
> >
> > That sounds like a bug.  The gadget should know what its own interfaces
> > are!  Is the UMS interface number 0 or number 2?
> 
> UMS is assigned interface number 2 from usb_interface_id().
> 
> > What value does the bNumInterfaces field have in the config descriptor?
> 
> bNumInterfaces field shows 2 interfaces only which is correct(UMS and
> ADB) since RNDIS is disbaled.
> But RNDIS is also assigned interface id even though its disabled. This
> seems to be creating problems.

This appears to be a bug in composite.c.  If a function fails to bind, 
the interface numbers it has allocated are not released.

Does this patch help?

Alan Stern



Index: usb-2.6/drivers/usb/gadget/composite.c
===================================================================
--- usb-2.6.orig/drivers/usb/gadget/composite.c
+++ usb-2.6/drivers/usb/gadget/composite.c
@@ -106,13 +106,17 @@ int usb_add_function(struct usb_configur
 
 	/* REVISIT *require* function->bind? */
 	if (function->bind) {
+		unsigned	old_id = config->next_interface_id;
+
 		value = function->bind(config, function);
 		if (value < 0) {
 			list_del(&function->list);
 			function->config = NULL;
+			config->next_interface_id = old_id;
+			goto done;
 		}
-	} else
-		value = 0;
+	}
+	value = 0;
 
 	/* We allow configurations that don't work at both speeds.
 	 * If we run into a lowspeed Linux system, treat it the same

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux