Filtering USB devices when using usbip

This is for discussing general topics about how to use VirtualBox.
Post Reply
Asier-TA
Posts: 1
Joined: 6. Mar 2023, 12:41

Filtering USB devices when using usbip

Post by Asier-TA »

Hello all,

VirtualBox version: 7.0.6 r155176, with Oracle VM VirtualBox Extension Pack.
Host system: Windows 10 (64-bit). 16GB
Guest system: Ubuntu 18.04 (64-bit). Guest additions installed. 4GB RAM.

I want to use usbip inside my computer. Ideally, when any USB device is connected, Linux should take control of it, execute "usbip bind" and then tell Windows to attach that device; Windows would then execute "usbip attach" and take the control back. I know it is quite a weird use of usbip, but this is the solution I'm working with at this moment.

In order to get Linux take control of all devices, I create a filter: vboxmanage usbfilter add 0 --target 192.168.56.101 --name "All devices".

My problem is that when I execute "usbip attach" in the Windows host, the Linux guest takes control of the USB device again.

The only solution I have found is removing the filter before attaching the device and creating a new filter after the USB device is correctly attached to the host system. However, now the whole "usbip inside my computer" system is disabled during that time, which can be several seconds when attaching a USB pendrive. That means that new connections during that time will not go through the guest system (even though the device will be controlled directly by Windows).

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.

When I disable the usbfilter for a while and end up with the USB device correctly attached to Windows, "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. Or maybe I didn't do it correctly...

Thanks you in advance,

Asier
Post Reply