DM USB: modify disconnecting logic to support Windows 10

The Windows 10 feeds back quicker than Linux OS when error occured
due to device disconnecting, it will quickly reset the xHCI controller
before the DM starts to emulate disconnect event and it may cause some
unexpected errors such as crash.

This patch will do one more check when error happens, if the error
is induced by device disconnecting, the DM will not report error and
just wait until the disconnect event is reported to the guest. This
change could produce the correct hehavior as we expected.

Tracked-On: #3628
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
This commit is contained in:
Xiaoguang Wu
2019-09-11 00:07:37 +08:00
committed by wenlingz
parent 06781b37e9
commit e9211514e7
3 changed files with 23 additions and 0 deletions

View File

@@ -181,6 +181,20 @@ usb_native_is_port_existed(uint8_t bus_num, uint8_t port_num)
return 1;
}
int
usb_native_is_device_existed(struct usb_devpath *path)
{
char _path[128];
int ret = 0;
if (path) {
snprintf(_path, sizeof(_path), "%s/%s", NATIVE_USBSYS_DEVDIR,
usb_dev_path(path));
ret = (access(_path, F_OK) == 0);
}
return ret;
}
void usb_parse_log_level(char level)
{
switch (level) {