Add functionality to share whole USB hubs with VMs
To make use of some old hardware that's not supported by Linux or any modern OS, I've attempted to use a Windows XP VM. The problem is that some of the USB devices I was working with get disconnected and then reconnected. Unfortunately, the VM has lost the capture, and the program that expected the "new" device to appear has probably timed out.
Linux' USBDEVFS_CLAIM_PORT
allows sufficiently privileged applications to claim a whole port on a hub, rather than a device, which should make it easier to deal with those sort of devices (in my case, it's a serial device for which we upload a temporary firmware, the firmware will be forgotten if the device is unplugged):
Original Linux kernel patch: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7cbe5dca399a50ce8aa74314b1d276e2fb904e1b
Test program: https://marc.info/?l=linux-usb&m=124345857431452&w=2
A quick search shows that qemu might already be using this functionality.