Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4787067b authored by Pavankumar Kondeti's avatar Pavankumar Kondeti Committed by Mayank Rana
Browse files

usb: gadget: composite: Fix a bug in delayed status handling



The SET_CONFIGURATION control request's status phase is delayed
till the new config change is handled by the file-storage thread.
If the cable is disconnected or the bus is reset before the
previous config is handled, then composite driver is not notified
about the delayed status. As a result of which, the delayed_status
field of composite device structure remains non-zero.  The status
phase of next SET_CONFIGURATION control request is not sent.
This makes the gadget unusable.

Calling usb_composite_setup_continue() after the disconnect or reset
does not make any sense. If the host sends another control request
before the status phase of the previous control request is sent, the
delayed_status must be reset to zero.  This is not straight forward
as the UDC handles some control requests without delegating them to
the composite driver.  A simple fix would be resetting the delayed
status value after the disconnect/reset.

CRs-Fixed: 501527
Change-Id: I67c832afc88c9e7d025247e539b7223fd83644d7
Signed-off-by: default avatarPavankumar Kondeti <pkondeti@codeaurora.org>
parent 5c9280cd
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1997,6 +1997,10 @@ void composite_disconnect(struct usb_gadget *gadget)
		reset_config(cdev);
	if (cdev->driver->disconnect)
		cdev->driver->disconnect(cdev);
	if (cdev->delayed_status != 0) {
		INFO(cdev, "delayed status mismatch..resetting\n");
		cdev->delayed_status = 0;
	}
	spin_unlock_irqrestore(&cdev->lock, flags);
}