RE: [PATCH 07/10] usb: gadget: Add Android Composite Gadget driver

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

 



On Tuesday, March 27, 2012 12:49 PM Andrzej Pietrasiewicz wrote:

> Subject: [PATCH 07/10] usb: gadget: Add Android Composite Gadget driver
> 
> From: Mike Lockwood <lockwood@xxxxxxxxxxx>
> 

<snip>

> +static void android_unbind_config(struct usb_configuration *c)
> +{
> +	struct android_dev *dev = _android_dev;
> +
> +	android_unbind_enabled_functions(dev, c);

+
+ usb_ep_autoconfig_reset(dev->cdev->gadget);

> +}
> +

I noticed that if I enable/disable the gadget a number of times (I used
adb, ptp and mass_storage) no USB endpoints are available any more
and binding the configuration fails, that is, after each sequence:

$ echo 0 > /sys/class/android_usb/android0/enable
$ echo 1 > /sys/class/android_usb/android0/enable

the gadget keeps claiming new endpoints instead of re-using previously
claimed.

I solved the problem by adding usb_ep_autoconfig_reset as shown
above because android_unbind_config is eventually called after
storing 0 in /sys/class/android_usb/android0/enable
(enable_store=>reset_usb=>usb_remove_config=>
...(composite stuff)....=>android_unbind_config).

I would like to ask all, who are more knowledgeable in the usb matters:
Is this a good solution? Will it play nicely if there are multiple
configurations in the gadget?

Thanks,

Andrzej


--
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