Re: Linux USB file storage gadget with new UDC

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

 



On Mon, 1 Jul 2013, Victor Yeo wrote:

> Yes, UDC driver has bug. After modifying it, it can receive Set-Config
> request with a config value of 0. However, the "device descriptor test
> - addressed state" still fails.
> 
> Please see the attached log. The Set-Config request with a config
> value of 0 is the second last USB request sent from the host. The last
> USB request is Get-Config, which still returns config value of 1.

This looks like another bug in the UDC driver.  It performs the Status
stage of the Set-Config request before the gadget driver has finished
carrying out the request.

Notice that the USB_REQ_SET_CONFIGURATION case in standard_setup_req()  
returns DELAYED_STATUS.  As a result, fsg_setup() does not call
ep0_queue(), and so usb_ep_queue() doesn't get called.  The UDC driver
is not supposed to ACK the Status stage of an OUT control transfer
until usb_ep_queue() is called.

> In gadget driver, do_set_config(), if new_config is 0, the new_config
> is not processed. So config value of zero will never be saved by
> gadget driver. Isn't it?

Look at do_set_config():

	/* Disable the single interface */
	if (fsg->config != 0) {
		DBG(fsg, "reset config\n");
		fsg->config = 0;
		rc = do_set_interface(fsg, -1);
	}

	/* Enable the interface */
	if (new_config != 0) {
		...
	}
	return rc;

So if new_config is 0, fsg->config remains set to 0 and the 
deconfiguration is processed by the do_set_interface() call.

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




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

  Powered by Linux