On Mon, Feb 06, 2012 at 03:14:10PM -0500, Alan Stern wrote: > > What is wrong processing one setup packet after the other? > > Suppose the host sends a Set-Interface request, and you delay handling > it. If the delay is too long, the host will time out and cancel the > request. Then the host sends some completely different request, such > as Set-Feature. If your delayed response goes back now, the host will > think you accepted the Set-Feature request and not realize that you > really carried out the Set-Interface. In addition, the response to the > Set-Feature request will remain sitting in the ep0 FIFO and never get > sent, because the host won't ask for it. The prepare status stage for Set-Interface at usb_composite_setup_continue should not be sent to udc at this situation, we should cancel it if we receive another setup packet. Maybe We can add judgement at composite_setup and composite_delayed_setup. At composite_setup If (cdev->delay_status > 0 && !(ctrl->bRequest == USB_REQ_SET_INTERFACE | ctrl->bRequest == USB_REQ_SET_CONFIGURATION)) { /* last one is delayed_one, but current one is non delayed_one. * We should cancel work item for set_interface and set_configuration * handle. */ cdev->delay_status = 0; } At work item composite_delayed_setup if (cdev->delay_status == 0) return; /* do noop */ else (cdev->delay_status == 2) { cdev->delay_status--; return; /* Cancel current delayed setup handle, * will handle the next setup handle. */ } > > 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 > -- Best Regards, Peter Chen -- 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