On Wed, 28 Dec 2005, tom wrote: > Hi all, > > I am working on gadget file storage and i notice that in file_storage.c , it > seems haven't handle perfectly in SET_CONFIGURATION, that means if the host > set wrong configuration on it , let say 2, the gadget wouldn't know to STALL > the endpoint in order to tell the host that it didn't not support this > configuration. The gadget will ignore this request but the host is still > waiting for the finish of status stage. So , is this file storage of gadget > be implemented more perfectly ?
I don't understand your question. Let's suppose the host sends g_file_storage a Set-Configuration request with an invalid configuration number, like 2. In standard_setup_req(), under the USB_REQ_SET_CONFIGURATION case, the code will see that w_value is 2 and hence is not equal to CONFIG_VALUE (1) or to 0. So the code will avoid setting fsg->new_config and will not call raise_exception. Instead it will break from the "switch" statement and return value = -EOPNOTSUPP. This value will be returned to the controller driver. Seeing a negative return code from the setup handler, the driver will STALL the status stage of the control transfer. So what needs to be changed? Alan Stern ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel