usbdetach does not work in VB 5.1.2 as it worked in VB 5.0.24 or 5.0.22 (absolutely not working)

Discussions related to using VirtualBox on Windows hosts.
Post Reply
Shumron
Posts: 5
Joined: 15. Nov 2014, 17:57

usbdetach does not work in VB 5.1.2 as it worked in VB 5.0.24 or 5.0.22 (absolutely not working)

Post by Shumron »

usbdetach does not work in VB 5.1.2 as it worked in VB 5.0.24 or 5.0.22 (absolutely not working)

*** Ticket created: please review it for details -- https://www.virtualbox.org/ticket/15688

Host: Windows 2012 R2 x64, VirtualBox 5.1.2
Guest: Windows XP SP3 x86

I had an USB device that is used in Virtual Machine. Periodically this USB device may "hang" by strange issues (BTW, probably, VB issues). Reattaching device manually (physically) solving all issues - device working fine. So, I had made a solution, to make it possible to do it automatically or even remotely. I just created special .cmd file, that I'm runing. This .cmd file do the following:

Code: Select all

"%VB_PATH%\VBoxManage.exe" list usbhost > _list
Then special script is parsing _list file and founds UUID and Address of required device. Then it do the following:

Code: Select all

"%VB_PATH%\VBoxManage.exe" controlvm "{guidofmy-vmgu-idof-myvm-guidofmyvmxx}" usbdetach "%Address%"
then delay for about 10 seconds

Code: Select all

"%VB_PATH%\VBoxManage.exe" controlvm "{guidofmy-vmgu-idof-myvm-guidofmyvmxx}" usbattach "%UUID%"
This is helped in 100% cases. USB-device were removed and then attached to the system. This worked perfectly remotely on v5.0.24 or 5.0.22. But with v5.1.2 I have a few problems.

1) Previously all entries in _list had UUID and Address fields.

Few samples from different devices that I had used (XXXX - masked by me):

Code: Select all

UUID:               68804297-e43a-49c8-b64f-1de1d3ccd4f4
...
Address:            \\?\usb#vid_XXXX&pid_XXXX#6&79bee0&0&2#{00873fdf-cafe-80ee-aa5e-00c04fb1720b}
Current State:      Captured

UUID:               510524f6-12e4-4bd7-ab91-bb38de307f97
...
Address:            \\?\usb#vid_XXXX&pid_XXXX#5&1cc0e58a&0&11#{00873fdf-cafe-80ee-aa5e-00c04fb1720b}
Current State:      Captured
But the current version if USB devices is hang writes only in the following way... without Address field!

Code: Select all

UUID:               3f46619b-b830-4ae2-ba69-2052408b0cd8
VendorId:           0xXXXX (XXXX)
ProductId:          0xXXXX (XXXX)
Revision:           X.XX (XXXX)
Port:               0
USB version/speed:  2/High
Manufacturer:       XXXXXXXXXXXXXXXXX
Product:            XXXXXXXXXXXXXXXXX
Current State:      Captured
To compare with other devices (BTW, Address field format is changed):

Code: Select all

UUID:               601ca5f7-79f2-4cea-b4ab-799449c4848f
VendorId:           0x152d (152D)
ProductId:          0x0551 (0551)
Revision:           1.0 (0100)
Port:               0
USB version/speed:  3/Super
Manufacturer:       JMicron
Product:            USB to ATA/ATAPI Bridge
SerialNumber:       1331A3FFFFFF
Address:            {36fc9e60-c465-11cf-8056-444553540000}\0015
Current State:      Busy
I think there is a bug, why that Captured devices have no "Address" field? It is an issue #1.

2) Now the main issue: I cannot detach such device and reattach it using software. Only manually (physically by hands :). [GUID is changed]

I had tried to make all commands using UUID (because Address field is not exist) - does not helped!

Code: Select all

VBoxManage.exe controlvm "{guidofmy-vmgu-idof-myvm-guidofmyvmxx}" usbdetach "3f46619b-b830-4ae2-ba69-2052408b0cd8"
VBoxManage.exe: error: USB device with UUID {3f46619b-b830-4ae2-ba69-2052408b0cd8} is not attached to this machine
VBoxManage.exe: error: Details: code E_INVALIDARG (0x80070057), component ConsoleWrap, interface IConsole, callee IUnknown
VBoxManage.exe: error: Context: "DetachUSBDevice(usbId.raw(), dev.asOutParam())" at line 1015 of file VBoxManageControlVM.cpp

VBoxManage.exe controlvm "{guidofmy-vmgu-idof-myvm-guidofmyvmxx}" usbattach "3f46619b-b830-4ae2-ba69-2052408b0cd8"
VBoxManage.exe: error: USB device 'Altair Semiconductor Modem YOTA 4G LTE' with UUID {3f46619b-b830-4ae2-ba69-2052408b0cd8} is busy with a previous request. Please try again later
VBoxManage.exe: error: Details: code E_INVALIDARG (0x80070057), component HostUSBDeviceWrap, interface IHostUSBDevice, callee IUnknown
VBoxManage.exe: error: Context: "AttachUSBDevice(usbId.raw(), captureFilename.raw())" at line 1010 of file VBoxManageControlVM.cpp
So, how to fix that? How to detach that captured USB device and reattach it to VM without physical access to computer/USB device?!

Please fix that USB-issue.

Some information from VBox.log (xxxx:xxxx - VID:PID changed by me)

Code: Select all

23:35:17.511713 VUSB: Detached '00000000043bf780[proxy xxxx:xxxx]' from port 1
42:01:51.128576 VUSB: Attached '00000000043c0080[proxy xxxx:xxxx]' to port 1
44:22:01.948563 GUI: UIMachineLogic: Host-screen available-area changed
44:22:01.948626 GUI: UIMachineLogic: Host-screen count changed
44:22:02.871521 GUI: UIMachineLogic: Host-screen available-area changed
44:22:47.943848 VUSB: Detached '00000000043c0080[proxy xxxx:xxxx]' from port 1
44:22:48.469346 DSound: Stop playback stream 0000000004356520 when closing ERROR_SYSTEM_TRACE 0x88780096
44:22:48.469708 DSound: DirectSound playback is currently unavailable
44:22:48.470161 DSound: DirectSound playback is currently unavailable
44:22:48.470584 DSound: Starting playback failed with E_UNEXPECTED
44:22:48.470671 DSound: DirectSound playback is currently unavailable
50:34:51.291678 GUI: UIMachineLogic: Host-screen count changed
50:34:51.298377 GUI: UIMachineLogic: Host-screen available-area changed
50:34:51.408678 GUI: UIMachineLogic: Host-screen available-area changed
50:34:51.418295 GUI: UIMachineLogic: Host-screen available-area changed
50:34:51.472805 GUI: UIMachineLogic: Host-screen available-area changed
54:26:42.935114 ERROR [COM]: aRC=E_INVALIDARG (0x80070057) aIID={872da645-4a9b-1727-bee2-5585105b9eed} aComponent={ConsoleWrap} aText={USB device with UUID {3f46619b-b830-4ae2-ba69-2052408b0cd8} is not attached to this machine}, preserve=false aResultDetail=0
54:27:26.194557 ERROR [COM]: aRC=E_INVALIDARG (0x80070057) aIID={872da645-4a9b-1727-bee2-5585105b9eed} aComponent={ConsoleWrap} aText={USB device with UUID {3f46619b-b830-4ae2-ba69-2052408b0cd8} is not attached to this machine}, preserve=false aResultDetail=0
54:30:40.386148 ERROR [COM]: aRC=E_INVALIDARG (0x80070057) aIID={872da645-4a9b-1727-bee2-5585105b9eed} aComponent={ConsoleWrap} aText={USB device with UUID {3f46619b-b830-4ae2-ba69-2052408b0cd8} is not attached to this machine}, preserve=false aResultDetail=0
*** Ticket created: please review it for details -- https://www.virtualbox.org/ticket/15688
Post Reply