Open BruceMok opened 5 years ago
Unfortunately, this is not so simple to reproduce this problem without bare metal XP which hard to find. There is almost no difference between UsbDk for XP and for Win7. Let's collect UsbDk logs: Use https://github.com/daynix/UsbDk/blob/master/Tools/Trace/UsbDkLogman.bat All commands below are for administrator command line: 1) remove the hub of the interest 1) uninstall UsbDk (usbdkcontroller-u) 2) start usbdkLogman.bat in separate admin console in writable directory 3) install UsbDk (usbdkcontroller-i) 4) connect the hub and redirect the device 5) remove the hub, if the remote-viewer stopped responding, wait 2 min 6) hit enter in the console of usbdkLogman.bat and collect the ETL file 7) inform us which release of UsbDk you use.
I use usbdkLogman.bat on XP, an error occurs :
Unknown parameter "-ow" The syntax of the command is incorrect error: Unrecognized whether the passed sample name is a valid VMI data provider
So i delete the parameter "-ow", follow your comment collect UsbDk logs. Meanwhile, i collect a DebugView log. By the way, i connect a U disk on the hub, it can be redirect and work well, when i plug out the hub, remote-viewer stopped responding. Version of UsbDk is 1.0.21.
I'm not able to decode the log with symbols of 1.0.21 Do you run your own compilation or the installation of released usbdk MSI?
Sorry, i run my own compilation yesterday. I run the installation of released usbdk MSI today, but can not decode the log too. UsbDk_Logman_log.zip
I run my own compilation again(no source code be modified), follow the "UsbDk\Documentation\Tracing.txt" and use "UsbDkTrace.bat"catch some debug logs. UsbDk_trace_log2.LOG
Due to unknown reason UsbDk does not receive any indication of hub or device removal. According to the log, the device was redirected at ~ 11:49:47 and from then there is no indication that it (or its hub) was removed. If the device was unplugged, expected surprise removal flow and it does not happen. Do you stop redirection manually in remote-viewer?
I do nothing in remote-viewer. When the device was unplugged at 11:50:13, libusb call the function "UsbDk_StopRedirect" of UsbDkHelper.c. I added some debugging information in this function:
try
{
// if the driver is unaccessible the constructor raises exception
// there is a question whether this check is required and whether this is correct thing to do
// for now we leave it as is with TODO to investigate it in corner case flow
// (for example UsbDk uninstall when there is active redirection)
OutputDebugString(TEXT("UsbDk_StopRedirect 0"));
UsbDkDriverAccess checkDriverAccess;
OutputDebugString(TEXT("UsbDk_StopRedirect 1"));
unique_ptr<REDIRECTED_DEVICE_HANDLE> deviceHandle(unpackHandle<REDIRECTED_DEVICE_HANDLE>(DeviceHandle));
OutputDebugString(TEXT("UsbDk_StopRedirect 2"));
deviceHandle->RedirectorAccess.reset();
//deviceHandle->RedirectorAccess = nullptr;
OutputDebugString(TEXT("UsbDk_StopRedirect 3"));
return TRUE;
}
According to the log, function "UsbDk_StopRedirect" only print three debugging information, not found the fourth(i don't know if this is normal):
00002813 11:50:13 [3724] Driver file operation error. GetOverlappedResult failed (A device attached to the system is not functioning. Error code = 31)
00002814 11:50:13 [3724] Driver file operation error. GetOverlappedResult failed (A device attached to the system is not functioning. Error code = 31)
00002815 11:50:13 [3724] UsbDk_StopRedirect 0 00002816 11:50:13 [3724] UsbDk_StopRedirect 1 00002817 11:50:13 [3724] UsbDk_StopRedirect 2
I tested another connection method, the u disk directly connected to my laptop(Lenovo E49, XP 32 bit). unplug u disk, remote-viewer still work well. UsbDk trace log seems normal: UsbDk_log_trace3.LOG
I am very confused, once i use a hub connect some device and unplug the hub, remote-viewer will stop responding. But if i unplug the device which connected this hub, everything is fine.
I know XP is old but i have this use case so would like to see if it can work.
+-----------------+ UsbDk +-----------------+
spice client is remote-viewer 6.0 version of spice-gtk is 0.34 version of spice protocol is 0.12.13 version of libusb is 1.0.22 version of usbDk is 1.0.21
issue: When i plug in a hub, it work well and redirect. Then i plug out this hub, virt-viewer GUI blocking and have no response. I add some log in libusb source code, it seems to blocking at "windows_usbdk.c":
This issue 100% appears on Windows XP 32bit, but never appears on Win7 or Win10. Log as below: