USBFilter not working on 2 digit portnumbers

Discussions related to using VirtualBox on Windows hosts.
fantinel
Posts: 7
Joined: 12. Dec 2022, 14:29

USBFilter not working on 2 digit portnumbers

Post by fantinel »

Hi everyone, this is my first post here, so if i did anything wrong, please let me know...

i've been using virtualbox to host some windows VM's for testing purposes. The application running on those boxes requires a pinpad plugged to the machine to work properly so i'm using VirtualBox USB Filter to automatically map those devices for each VM.
To explain better, here is the actual scenario:

5x Windows virtual machines running on a single Windows host with VirtualBox 6.1.38
5x USB pinpads(all the same model, with same Vendor ID, Product ID, Revision) for credit card operations on those VMS
Each VM has a USB filter with the pinpad details and port number mapped

The USBFilter configuration works fine

Soooo...whats the problem?

Well, the USBFilter configuration ONLY works if the port i'm mapping to the guest is a port number with only one digit(like usb port 1, 2 ... 8, 9). But i have other usbports on my host that i would like to use(10, 11, 12 and 13) and the USBFilter doesn't work on those portnumbers. If i open the guest machine and manually map the device it works fine...but the usb filter doesn't.

Here is what i've tried so far:

Check if there's any duplicated usb filter port configuration
Change from USB 3.0 to USB 2.0
Check if the device automatically maps properly on other USB ports
Try with other USB devices
Test the USBFilter on another host
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, Linux

Re: USBFilter not working on 2 digit portnumbers

Post by scottgus1 »

Whoa, you actually have ports up to 13? That's unusual. The highest I've ever seen is 7.

How do you discover the port numbers? VirtualBox's method is with the command:
vboxmanage list usbhost

If the two-digit port numbers show in 'list usbhost' but don't work in the filter, then this could be a bug.

Please post the outputs of the commands in step 8 of USB basics and troubleshooting as text, not screenshots, so we can check what you've got. Zip and post the logs step 8 call for, using the forum's Upload Attachment tab.
fantinel
Posts: 7
Joined: 12. Dec 2022, 14:29

Re: USBFilter not working on 2 digit portnumbers

Post by fantinel »

Seems weird but i do! :lol:
I've got some really powerfull hosts for those VM's with a nice amount of usb ports(i'm not using any hubs btw)

Answering your first question, yes i've used vboxmanage list usbhost to get the usbport number, on the ZIP file i've attached an output from one of my hosts... thanks in advance :wink:
VboxHostLogs.zip
(43.49 KiB) Downloaded 67 times
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, Linux

Re: USBFilter not working on 2 digit portnumbers

Post by scottgus1 »

Thanks for the info!

The two-digit port number does show in "list usbhost". The ports shown are 1, 4, 5, 9, and 13.

Curiously, the "showvminfo" does not show the port number in the info listing.

The posted log shows the device coming in:
00:00:42.884825 VUSB: Attached '0000000006246620[proxy 079b:0028]' to port 2 on RootHub#1 (FullSpeed)
00:02:09.272937 VUSB: Detached '0000000006246620[proxy 079b:0028]' from port 2 on RootHub#1
Was this the port 13 VM?
fantinel
Posts: 7
Joined: 12. Dec 2022, 14:29

Re: USBFilter not working on 2 digit portnumbers

Post by fantinel »

Was this the port 13 VM?
Yes, it is. I've attached a usb device on port 13 for the test and tried to map into this guest.

I believe that the 'showvminfo' has no output in the "Currently Attached USB Devices:" because i executed these commands right after the vm powering up with the USBFilter active(and the filter does not seem to work with port 13, so nothing is mapped into the guest)

If i manually attach the usb device(using the same port 13) on the virtualbox gui, here's the output of showvminfo:

Code: Select all

Currently Attached USB Devices:

UUID:                        5deae70f-8b70-413d-aca9-db1423c98c80
VendorId:                    0x079b (079B)
ProductId:                   0x0028 (0028)
Revision:                    0.0 (0000)

Address:                     \\?\usb#vid_80ee&pid_cafe#5&3a377e6&0&13#{00873fdf-cafe-80ee-aa5e-00c04fb1720b}
About the VUSB: Attached/Detached logs, i've followed the steps on the troubleshooting page and manually attached and detached the usb device after 1 min...i believe the output you've seen was from this procedure
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, Linux

Re: USBFilter not working on 2 digit portnumbers

Post by scottgus1 »

fantinel wrote:
scottgus1 wrote:Was this the port 13 VM?
Yes, it is.
Interesting. In this case, the USB device did go into the VM:
scottgus1 wrote:The posted log shows the device coming in:
00:00:42.884825 VUSB: Attached '0000000006246620[proxy 079b:0028]' to port 2 on RootHub#1 (FullSpeed)
00:02:09.272937 VUSB: Detached '0000000006246620[proxy 079b:0028]' from port 2 on RootHub#1
Look for "VUSB: Attached" in the VM's log while the VM is running.

Since using the on-the-fly USB settings works, hmmm. Could be a bug, but I'm not certain where else to look. Forum gurus are free to weigh in....
fth0
Volunteer
Posts: 5690
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: USBFilter not working on 2 digit portnumbers

Post by fth0 »

scottgus1 wrote:Forum gurus are free to weigh in....
Coming ... :D

If you ever wondered why the VirtualBox Manager displays the port number with leading zeros in the USB filter, it's because all numeric fields are in hex. So I'd suggest to try "000D" for port 13. ;)
fantinel
Posts: 7
Joined: 12. Dec 2022, 14:29

Re: USBFilter not working on 2 digit portnumbers

Post by fantinel »

If you ever wondered why the VirtualBox Manager displays the port number with leading zeros in the USB filter, it's because all numeric fields are in hex. So I'd suggest to try "000D" for port 13.
I've had the same idea, tried some different ways to pass the usb port number, but none of them actually worked...about the hex value, the port number field in GUI do not let me insert letters or other symbols in it, only numbers :?
Also checked on the "vboxmanage usbfilter add" command, but i don't seem to find a parameter for the port number.

I might be missing something here, but i really don't know what
fth0
Volunteer
Posts: 5690
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: USBFilter not working on 2 digit portnumbers

Post by fth0 »

fantinel wrote:I've had the same idea, tried some different ways to pass the usb port number, but none of them actually worked...about the hex value, the port number field in GUI do not let me insert letters or other symbols in it, only numbers :?
Please try the following:

Ensure that no VirtualBox component is running on the host (e.g. reboot the host), open the TTFENIXSJP02VM.vbox file with your favorite text editor and replace the port number "0013" by "000d" (*). Save the file and try if it works.

(*) Since you're using snapshots, make sure to replace the last occurrence of the port number in the file.

AFAIU, the port number is a newer addition to the USB Device Filters and not represented in the VBoxManage commands. It also has the special property that unlike the other fields, it is not a property of the USB device.
fantinel
Posts: 7
Joined: 12. Dec 2022, 14:29

Re: USBFilter not working on 2 digit portnumbers

Post by fantinel »

IT WORKED :lol: :lol:

I tested editing the vbox file directly and the USB device was captured properly on the VM startup!

Even tought i consider this not to be the definitive solution, it will do the job while i wait for a newer version that improves this.

Thank you very much scottgus1 and fth0 for the help!
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, Linux

Re: USBFilter not working on 2 digit portnumbers

Post by scottgus1 »

fth0 in for the win! :D

I had wondered about the 0-padded port number. So it's hex, eh? I'd be curious, fantinel, what does the port number say in the USB Filter in the VM's USB settings, now that you have the 'd' in place in the .vbox file?

Sounds like a bit of code in the Filter portion to properly convert higher-than-one-digit port numbers correctly is needed.
fantinel
Posts: 7
Joined: 12. Dec 2022, 14:29

Re: USBFilter not working on 2 digit portnumbers

Post by fantinel »

It gives me the value directly inserted on the .vbox file... But as expected, if i try to erase this value using the graphical interface, is not possible to save the hex value again.

If i want to mess with USB ports numbers bigger than 9, i have to shut down all VM's and Virtual Box proccesses > edit the .vbox file of each VM > bring everything up again.
Attachments
portusbfilter.PNG
portusbfilter.PNG (6.41 KiB) Viewed 3935 times
fth0
Volunteer
Posts: 5690
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: USBFilter not working on 2 digit portnumbers

Post by fth0 »

scottgus1 wrote:So it's hex, eh?
Yes, it's an input field for a hexadecimal number where you're only allowed to enter decimal digits. ;)
scottgus1 wrote:I'd be curious, fantinel, what does the port number say in the USB Filter in the VM's USB settings, now that you have the 'd' in place in the .vbox file?
The USB Device Filter dialog in the VirtualBox Manager and the .vbox file will both show "000d" eventually.
scottgus1 wrote:Sounds like a bit of code in the Filter portion to properly convert higher-than-one-digit port numbers correctly is needed.
I see two possible solutions:

The easiest fix would be to change the set of allowed input characters just for this field, with the disadvantage that users must be told to enter a hexadecimal number, which could be regarded as inconvenient. The more expensive fix would be to allow the input field to be interpreted as a decimal number instead of a hexadecimal number (the USB Device Filter dialog doesn't have any decimal number fields yet).
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, Linux

Re: USBFilter not working on 2 digit portnumbers

Post by scottgus1 »

Shutting down all Virtualbox processes to edit a .vbox file is expected: the Virtualbox background service VboxSVC.exe needs to die off, or the manual edit to the .vbox file may be overwritten by the service.

Interesting that the 'd' shows and the manual edit works! So we need a Bugtracker ticket explaining the hexadecimal display of the port number, and the inability to enter decimal port numbers higher than 9, or to enter hexadecimal equivalent of 10-or-higher port numbers. Would you like to have the honor, Fantinel, to make the ticket?

As fth0 mentions above, there should be a solution that can be added to allow decimal only input of all port numbers including above 9, and to keep the hex hidden in the source code.
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, Linux

Re: USBFilter not working on 2 digit portnumbers

Post by scottgus1 »

I added some instructions on this port number quirk to USB basics and troubleshooting: Distinguish multiple identical USB devices, Caveat C. Please let me know what you think.
Post Reply