On Wed, 17 Aug 2011 11:25:59 +0200, Yang Rui Rui <ruirui.r.yang@xxxxxxxxx>
wrote:
On 08/16/2011 06:38 PM, Sebastian Andrzej Siewior wrote:
* Yang Ruirui | 2011-08-16 18:01:54 [+0800]:
diff -uprN a/drivers/usb/gadget/composite.c
b/drivers/usb/gadget/composite.c
--- a/drivers/usb/gadget/composite.c 2011-08-16 17:49:38.813038094
+0800
+++ b/drivers/usb/gadget/composite.c 2011-08-16 17:47:03.716372207
+0800
@@ -603,6 +603,7 @@ static int set_config(struct usb_composi
int result = -EINVAL;
unsigned power = gadget_is_otg(gadget) ? 8 : 100;
int tmp;
+ enum usb_device_speed s = USB_SPEED_LOW;
if (number) {
list_for_each_entry(c,&cdev->configs, list) {
@@ -626,6 +627,14 @@ static int set_config(struct usb_composi
result = 0;
}
+ if (c->fullspeed&& (gadget->speed == USB_SPEED_FULL))
+ s = USB_SPEED_FULL;
+ if (c->highspeed&& (gadget->speed == USB_SPEED_HIGH))
+ s = USB_SPEED_HIGH;
+ if (c->superspeed&& (gadget->speed == USB_SPEED_SUPER))
+ s = USB_SPEED_SUPER;
+ gadget->speed = s;
+
I'm not sure if this is the right way. After all the speed is still HS
we just use FS descriptors. And I'm not sure if changing the speed is a
wise thing to do.
Is this a regression from recent changes in the framework?
What about config_ep_by_speed(), config_buf(), set_config() not assigned
a null pointer in the first place?
Sebastian
Following patch also fix my problem, anyone can explain a bit about the
comment?
Where to set the CONFIG_USB_GADGET_DUALSPEED?
In my case musb gadget set is_dualspeed to 1, but gadget_is_dualspeed
return 0,
so hs_descriptors is not copied.
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index 087f4b9..d9b5bdb 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -548,14 +548,7 @@ static inline struct usb_gadget
*dev_to_usb_gadget(struct device *dev)
*/
static inline int gadget_is_dualspeed(struct usb_gadget *g)
{
-#ifdef CONFIG_USB_GADGET_DUALSPEED
- /* runtime test would check "g->is_dualspeed" ... that might be
- * useful to work around hardware bugs, but is mostly pointless
- */
- return 1;
-#else
- return 0;
-#endif
+ return g->is_dualspeed;
}
CONFIG_USB_GADGET_DUALSPEED is “selected” in Kconfig by a UDC drivers that
are
dual speed. You can do a “git grep -C2 'select USB_GADGET_DUALSPEED'”.
“USB_GADGET_MUSB_HDRC” selets “USB_GADGET_DUALSPEED” though so I'm a bit
confused why it won't kick in.
IIRC, patches some time ago made it possible to compile in several UDC
drivers
so my understanding is that CONFIG_USB_GADGET_DUALSPEED should not be used
any
more since some UDC drivers can be dual speed and others might not. Felipe
will probably be able to confirm or deny.
--
Best regards, _ _
.o. | Liege of Serenely Enlightened Majesty of o' \,=./ `o
..o | Computer Science, Michal "mina86" Nazarewicz (o o)
ooo +-----<email/xmpp: mnazarewicz@xxxxxxxxxx>-----ooO--(_)--Ooo--
--
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