usb: gadget: udc: core: fix uvc gadget disconnect issue

This patch fix the issue that users fail to do a logical
disconnection from the USB Host via the kernel node:

/sys/class/udc/<udc>/soft_connect

Fixes: 3099e13bdb ("usb: gadget: f_uvc: support uvc and adb use independently")
Change-Id: I2a19f72dc0a5dc34e430d384f5b475b488731311
Signed-off-by: William Wu <william.wu@rock-chips.com>
This commit is contained in:
William Wu
2019-06-12 15:04:06 +08:00
committed by Tao Huang
parent 3b6867a5a9
commit 20fe938d82

View File

@@ -682,11 +682,9 @@ int usb_gadget_disconnect(struct usb_gadget *gadget)
goto out;
}
if (!gadget->uvc_enabled) {
ret = gadget->ops->pullup(gadget, 0);
if (!ret)
gadget->connected = 0;
}
ret = gadget->ops->pullup(gadget, 0);
if (!ret)
gadget->connected = 0;
out:
trace_usb_gadget_disconnect(gadget, ret);
@@ -713,7 +711,7 @@ int usb_gadget_deactivate(struct usb_gadget *gadget)
if (gadget->deactivated)
goto out;
if (gadget->connected) {
if (gadget->connected && !gadget->uvc_enabled) {
ret = usb_gadget_disconnect(gadget);
if (ret)
goto out;