On Fri, 28 Jun 2013, victor yeo wrote: > Hi, > > >> g_file_storage gadget: ep0-setup, length 8: > >> 00000000: 00 09 01 00 00 00 00 00 > >> g_file_storage gadget: set configuration > > > > Yes, that is a Set-Config request with configuraiton value 1. You > > probably got hold of the wrong part of the log. Elsewhere there should > > be a Set-Config request with a config value of 0. > > No, i don't see that (Set-Config request with a config value of 0) Well, then I don't know where the problem is, but obviously the problem occurred before the gadget driver was involved. Either the host sent a wrong packet, or more likely the UDC received the packet incorrectly. > >> g_file_storage gadget: ep0-setup, length 8: > >> 00000000: 80 08 00 00 00 00 01 00 > >> g_file_storage gadget: get configuration > >> g_file_storage gadget: ep0-in, length 1: > >> 00000000: 01 > > > > This is the correct response following the request above. > > > > You can test the gadget's behavior with a Linux host. To send a > > Set-Config request with value N, do > > > > echo N >/sys/bus/usb/devices/.../bConfigurationValue > > > > where the "..." part is replaced with the gadget's device path. > > When i use "echo 0 > /sys/bus/usb/devices/.../bConfigurationValue", > there is no activity in gadget and UDC driver, and the gadget > disappear from Linux host. There must have been _some_ activity, unless the UDC hardware handled the request by itself without telling the driver. More likely, the UDC driver did see the request and ignored it. The gadget didn't disappear from the Linux host. If it did disappear, the /sys/bus/usb/devices/.../bConfigurationValue file would be removed, so you wouldn't be able to write a 1 back to it. > If i use "echo 1 > /sys/bus/usb/devices/.../bConfigurationValue", the > gadget is re-enumerated and re-appear in Linux host. The gadget is not re-enumerated; it is re-configured (it goes from the Address state to the Configured state). > I also observe in gadget driver, there is only one config descriptor > with bConfigurationValue of 1. Is bConfigurationValue of 0 meant to > disble the device? 0 doesn't disable the device; it de-configures the device (puts the device back in the Address state). See sections 9.1.1.4, 9.1.1.5, 9.2.3, and 9.4.7 in the USB 2.0 spec. Alan Stern -- 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