cezanne / usbip-win

USB/IP for Windows
GNU General Public License v3.0
1.91k stars 344 forks source link

Trying to access a USB device filtered in VirtualBox #341

Open Asier-TA opened 1 year ago

Asier-TA commented 1 year ago

I have a Windows 10 host using VirtualBox to run an Ubuntu 18.04 guest. In VirtualBox, I'm filtering some devices so that they are controlled directly by Linux. However, there are some times in which I'd like to use those devices in the Windows host. I haven't managed to get it working. The versions I use are usbip-win 0.3.6, with ude driver, in Windows, and usbip-utils 2.0 in Linux.

If I connect the devices to a Linux in another computer, "usbip attach" from Windows 10 works correctly. Connecting the devices to the Linux guest and calling "usbip attach" from the external Linux also works. Thus, I think there is no problem with the devices bindings and attachings. The problem only happens when I try to do everything in the same computer.

The messages shown by the server in the Linux guest (usbipd -d) are the same when I attach from the external Linux and from the Windows host. In the Windows side, "usbip attach" tells me the device has been attached, and the Device Manager shows a new VirtualBox USB has been detected. On the other side, when I attach the same device connected to an external Linux, a HID keyboard Device is detected.

Does anyone know if it is possible to do what I'm trying to do?

-- Update: --

It seems that when usip attach was called, a new device was "discovered" in Windows, and then passed thoroughto the virtual machine.

I have solved the problem by removing the filter before calling usbip attach in Windows, and creating a new filter after the attach. However, now I have several seconds during which no new USB device is passed through to the virtual machine, and Windows gains control of that device directly without usbip.

Is there any way of not filtering those "newly discovered USB devices", which are just the original devices after being attached to the host system? I need to find how to tell VirtualBox not to filter the devices that are using usbip.

Withe the solution commented above, "vboxmanage list usbhost" shows me 2 similar devices: the differences are in the UUID, port number, USB version, Address and Current State. The main difference is the address: one of them shows the actual usb address, and the other one tells me that it is usbip ("usbip://192.168.56.101:3240:1-2").

I have already tried using global filters, but they didn't solve this problem.