#9: Distinguish multiple identical USB devices
Virtualbox can tell apart "identical" USB devices and pass the desired device into the correct guest, as long as the identical devices appear on different USB "Port" numbers in 'vboxmanage list usbhost'.
This feature was experimentally used at least as of 5.2.20 and 6.0.0, and was officially documented starting in 6.1.0.
A discussion topic for using identical USB devices is here:
Discussion
How to do it:
- Get each USB device to successfully go into the guest(s) using the above tutorial steps 1-8.
- Run 'vboxmanage list usbhost' with none of the devices plugged in, to get a baseline view of the host's present USB devices.
- Insert one of the devices and let the host fully recognize it.
- Run 'vboxmanage list usbhost' again, noting the new device and what port number it is on.
- Repeat steps 3 and 4, inserting another of the identical USB devices in a different USB port.
- On each guest's USB filter, add the port number for the desired USB device. See Caveat C below if the port number is greater than 9. (Note that the number you enter will be leading-0-padded to display as 4 digits when you open the filter in the future: you enter 2, it will show later as 0002. In my tests this was not a problem.)
- Eject the USB devices from the host and reinsert them. Each port-filtered identical sibling should go in its desired guest or remain on the host if no filters match.
Caveats:
A. The USB devices must be inserted into the same physical USB ports on the host each time to go where they are supposed to go in Virtualbox. Plug into the wrong port and the results won't be as planned.
B. 'Vboxmanage list usbhost' must show different port numbers for each identical USB device. It could be possible, due to the layout of the USB subsystem in the host (built-in or added USB root hubs?), that there may be more than one physical USB port that will show the same 'port number' in 'vboxmanage list usbhost'. You may have to experiment with which USB device gets plugged in where, or shift other USB devices around, to get different port numbers in 'vboxmanage list usbhost' for each identical device.
C. In VirtualBox versions before 6.1.42 and 7.0.6, configuring USB port numbers greater than 9 need special considerations.
(See
viewtopic.php?f=6&t=108063 credit to 'fantinel' and 'fth0' for discovering and developing a workaround for this situation.)
When you enter a USB port number in the Port field of a USB Device Filter, the number is erroneously interpreted as a hexadecimal number. This creates a problem for port numbers greater than 9. For example, if you enter the digits "10", the filter will match port 16, because the hexadecimal number "10" equals the decimal number "16". Because the Port field only accepts digits, and the decimal numbers from 10 to 15 are equivalent to the hexadecimal numbers "a" to "f", you cannot create a filter to match those port numbers. As a workaround, you can manually edit the VM's .vbox file to enter the hexadecimal value for the greater-than-9 port number:
- Make a USB filter in the VM with a temporary 0-9 regular port number, to get the XML for the filter recorded in the VM's .vbox file.
- Restart the host so no Virtualbox processes are running. (The background VboxSVC service must not be running when manually editing a .vbox file.)
- Open the VM's .vbox file in a text editor. (Linux-like hosts should be able to use any text editor; for Windows hosts, Wordpad works well instead of Notepad.)
Find the XML section for the USB filter:
Code: Select all
<USB>
<Controllers>
...
</Controllers>
<DeviceFilters>
<DeviceFilter name="Filter Name" active="true" vendorId="xxxx" productId="yyyy" port="000#" remote="0"/>
</DeviceFilters>
</USB>
You're looking for the port="000#", where # is the single digit you entered.
- Change the "000#" to the hexadecimal letter for the 10-or-above port number you need:
- 10: 000a
- 11: 000b
- 12: 000c
- 13: 000d
- 14: 000e
- 15: 000f
- port numbers above 16 are untested, but 16 could be 0010, 27 would be 001b, etc...
- Save the .vbox file as text only.
- Start Virtualbox, and check that the hexadecimal value for the port number shows in the USB filter.