mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 10:58:48 +09:00
usb: gadget: configfs: send connect detective event when get descriptor
In current code, the connect detective event will be send before the connect state of controller change. The event is sent when receive the first setup packet and the connect state of controller is changed when receive set address command. So if disconnect interrupt trigger between the first setup packet and set address command, the disconnect process will not be done, while the application state has been changed and keep in connected. As a result, the UI may still show the USB connect option event if the device has been disconnect from PC. This patch send the connect uevent when get descriptor of configuration which follow set address command to make sure the application state change after controller. Change-Id: Icf2124327db93687b4b644672edb0dbecc8f127a Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com>
This commit is contained in:
@@ -1487,7 +1487,8 @@ static int android_setup(struct usb_gadget *gadget,
|
||||
struct usb_function_instance *fi;
|
||||
|
||||
spin_lock_irqsave(&cdev->lock, flags);
|
||||
if (!gi->connected) {
|
||||
if (c->bRequest == USB_REQ_GET_DESCRIPTOR &&
|
||||
(c->wValue >> 8) == USB_DT_CONFIG && !gi->connected) {
|
||||
gi->connected = 1;
|
||||
schedule_work(&gi->work);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user