- 1. General Information
- 1.1 USB emulated
- 1.2 PVUSB
- 2 details
- 2.1 Specifying a USB host device
- 2.2 Host-USB en xl
- 2.3 USB host in xm/xend
- 2.3.1 USB Emulator in xm/xend
- 2.3.2 PVUSB en xm/xend
- 2.3.3 PVUSB en xl/libxl
- 3 More information
- Support for 3.1 PVUSB in Xen 4.0 and newer versions
There are two general methods for forwarding individual host devices to a guest. The first is through an emulated USB device driver; the second is PVUSB.
Also, there are two ways to add USB devices to a guest: via the configuration file at domain creation time, and via hot plugging while the VM is running.
Another popular way to pass USB devices, especially for gaming rigs, is to usePCI passpass all USB host driver. This results in the lowest overhead and the best feature support. However, it does mean that you can't allow the guest to select individual USB devices on a controller - it's all or nothing. This is suitable for PV and HVM guests.
There are also non-Xen solutions likeIP USB, in which USB devices are shared over the network.
With emulated USB, the device model (qemu) presents an emulated USB driver to the guest. The device model process then takes control of the device from domain 0 and forwards USB commands between the guest operating system and the host USB device.
This method is only available for HVM domains and is not available for domains running withDevice model stub domains.
PVUSB uses a paravirtualized front-end/back-end interface similar to traditional Xen-PV disk and network protocols. To use PVUSB, you need usbfront on your guest OS and usbback on dom0 or usb backend on qemu (or your USB controller domain).
Unfortunately, kernel support for the PVUSB protocol is currently not very good. The next section provides links to more information about PVUSB driver support.
Also, to simply use PVUSB, you need support in the tooltack for the two sides to talk to each other. (Alternatively, you can write a script to manually communicate with frontends and backends via xenstore - see the section below for more information.)
PVUSB currently supports USB 1.1 and USB 2.0. PVUSB supports both PV and HVM guests.
As of Xen 4.4, PVUSB is only supported by the xm/xend tool stack.
Starting with Xen 4.7, PVUSB support for the XL/libxl tooltack is introduced. For PVUSB in xl, the USB backend can be usbback in dom0 or the USB backend in qemu, called “qusb”. Later one is still in progress.
Specify a USB host device
USB devices are primarily identified by their bus address (in the form
device.bus) or its device tag (in the form
Vendor ID: Device ID).
Each type of specification has its advantages:
- Specifying by device tag always retrieves the same device, regardless of where the device ends up in the USB bus topology. However, if there are two identical devices, you cannot specify which one.
- When specifying by bus address, you can always select a specific device, even if you have duplicates. However, the bus address may change depending on the port you have connected the device to and possibly also after a reboot.
You can use
subTo list the USB devices on the system:
Bus 001 Dispositivo 003: ID 0424:2514 Standard Microsystems Corp. USB 2.0 HubBus 003 Dispositivo 002: ID f617:0905 Bus 001 Dispositivo 001: ID 1d6b:0002 Linux Foundation 2.0 root hubBus 001 Dispositivo 004: ID 0424:2640 Standard Microsystems Corp. USB 2.0 HubBus 001 Dispositivo 005: ID 0424:4060 Standard Microsystems Corp. Ultra Fast Media ReaderBus 001 Dispositivo 006: ID 046d:c016 Logitech, Inc. Ratón óptico con rueda
For example, for Logitec hover, you can specify both
use: lsusb lists the bus and device number with leading zeros, but you must remove them when specifying the device in xl. (The leading zeros cause xl to interpret the number as octal.)
host usb en xl
As of Xen 4.6, xl only supports emulated USB from the configuration file.
Enable the emulated USB hub with
USB = 1. Then specify the devices in the device list in the config file along with other emulated devices using
Host: USB ID. For example:
The default USB driver created by qemu is USB 1.1. For some devices this is not enough. For this reason, you can also specify the USB driver version from 4.6
usb version. However, this is not supported at this time.
usb device, and is therefore only useful in connection with Spice USB Redirection. This option is not available for qemu-traditional.
Xen 4.7 introduces support for xl PVUSB and hot plugging.
Include USB drivers and USB host devices in the configuration file
usbdev. For example:
usbctrl=['type=pv,version=2,ports=4', 'type=pv,version=1, ports=4', ]usbdev=['hostbus=2, hostaddr=1, driver=0,port= 1', ]
Use commands to hot plug a PVUSB device
usb-disconnect. For example:
#xl usbctrl-attach test_vm version=1 ports=8 This will create an 8 port USB 1.1 version USB controller. #xl usb-list test_vmThis shows all USB controllers and USB devices in the domain. #xl usbdev-attach test_vm hostbus=1 hostaddr=2 This finds the first available controller:port in the domain and adds a USB device whose busnum:devnum is 1:2. You can also specify <code>controller</code> and <code>port</code>. #xl usbdev-detach test_vm 0 1This detaches the USB device under port 1 of controller 0. #xl usbctrl-detach test_vm dev_idThis detaches the USB controller with the specified dev_id and all USB devices below it.
USB host in xm/xend
xmit has been deprecated since 4.2 and was removed from Xen 4.5.
xendsupports both emulated USB and PVUSB.
Note, however, that the emulated USB and PVUSB use different command sets, both for hotplug and in the configuration file, and the naming scheme is not very obvious.
USB emulator in xm/xend
To use emulated USB, you need to enable it in the configuration file
USB = 1.
You can specify a device in the configuration file; but unfortunately the
usb deviceit only allows you to specify a single USB device of any type:
Fortunately, you can also hot plug and unplug devices after boot:
Add usb xm domain host: xx.yy
xm usb-del Domänenhost: xx.yy
xendonly supports USB 1.1 like xm/xend only supports qemu-dm-traditional. USB 2.0 and USB 3.0 are only supported by qemu-upstream and XL.
PVUSB en xm/xend
PVUSB uses the following hot plug commands:
PVUSB can also be specified in the configuration file via the
Please take a look...
xm.cfgmanual pages for more information.
PVUSB en xl/libxl
Support for PVUSB in xl/libxl has been introduced since Xen 4.7, including the configuration file PVUSB device and the hot plug/unplug PVUSB device. It is currently backwards compatible with USB 1.1 and USB 2.0.
Include USB drivers and USB host devices in the configuration file
usbdev. For example:
usbctrl=['type=qusb, version=2, ports=4', 'type=qusb, version=1, ports=4', ]usbdev=['hostbus=2, hostaddr=1, driver=0, port= 1', ]
typeyou can specify
Auto(Default: xl tries to choose the most suitable type),
Era(paravirtualized qemu based backend, must be specified for pvUSB used by HVM domains),
p.v.(kernel-based paravirtualized backend, not compatible with current Linux standard), or
device model(qemu emulated USB driver, not supported yet).
You can also specify
usbdevjust for example:
usbdev=['hostbus=2, hostaddr=1, ]
Then an 8-port version 2.0 USB controller will be created automatically and the USB device will be connected to the first port of this new controller.
Use commands to hot plug and unplug a PVUSB device
usbdev-detach. For example:
#xl usbctrl-attach test_vm version=1 puertos=8
This creates an 8-port USB 1.1 USB controller.
#xl Lista USB test_vm
This will show all USB controllers and USB devices in the domain.
#xl usbdev-attach test_vm hostbus=1 hostaddr=2
This will find the first available controller:port in the domain and connect a USB device whose busnum:devnum is 1:2. You can also specify
#xl usbdev-detach test_vm 0 1
This will disconnect the USB device under port 1 of controller 0.
#xl usbctrl-separar test_vm dev_id
This will remove the USB controller with the specified dev_id and all USB devices below it.
PVUSB support in Xen 4.0 and newer versions
PVUSB is a new high-performance USB transfer method from dom0 to guests, backwards compatible with USB 2.0 and USB 1.1 devices. PVUSB does not use Qemu-dm. PVUSB can be used with both HVM and PV domU, but requires special pvusb drivers in the dom0 kernel (xen-usbback) and frontend driver (xen-usbfront) in the VM.
presentation slides via PVUSBXenCumbres(contains usage examples and syntax):
- February 2009 PVUSB:http://www.xen.org/files/xensummit_oracle09/PVUSB.pdf
- PVUSB Update November 2009:http://www.xen.org/files/xensummit_intel09/PVUSBStatusUpdate.pdf
Links to PVUSB:
- A script to make it easier to use PVUSB with Xen:http://www.neobiker.de/wiki/index.php?title=XEN-PVUSB
- Delivery of PVUSB drivers to Xen, help of use, etc.:http://lists.xensource.com/archives/html/xen-devel/2009-03/msg01084.html
- PVUSB-Updates 10/2009:http://lists.xensource.com/archives/html/xen-devel/2009-10/msg00257.html
- PVUSB xm/xend compatibility:http://lists.xensource.com/archives/html/xen-devel/2009-12/msg00478.htmlYhttp://xenbits.xen.org/xen-unstable.hg?rev/2e5032921b07
- PVUSB mailing list discussions:http://article.gmane.org/gmane.comp.emulators.xen.devel/70980,http://old.nabble.com/anyone-using-pvusb--td25273516.html
Xen Linux kernel with PVUSB support included:
- linux-2.6.18-xen contains the backend and frontend PVUSB drivers.http://xenbits.xen.org/linux-2.6.18-xen.hg
- The PVUSB drivers are currently being ported to the pvops kernel (2.6.32). RFC patch available at:http://lists.xensource.com/archives/html/xen-devel/2011-01/msg00354.html(http://members.iinet.net.au/~nathanael/pvusb.diff).
- Novell/SuSe SLES11 SP1 kernel-xen (2.6.32) has backend and frontend PVUSB drivers.
- SuSe SLES12 kernel-xen (3.x) has backend and frontend PVUSB drivers.
- OpenSuSe also has PVUSB drivers.
- Linux 3.x pvops PVUSB-Parches:http://lists.xen.org/archives/html/xen-devel/2012-02/msg00576.htmlYhttp://lists.xen.org/archives/html/xen-devel/2012-02/msg00571.html.
- Since Linux 5.17, the PVUSB driver is generally available.
Learn more about the different kernel versions and the drivers they contain:
- List of various kernel trees supported by Xen dom0 for Linux:XenDom0Kernel:
- List of Xen features in different Linux kernel trees:Features of XenKernel:
Windows Xen PVUSB-Treiber (interfaces):
- James Harper's Xen Windows GPLPV drivers include an older version of the PVUSB front controller.
- Discussion of the initial GPLPV usbfront implementation:http://lists.xensource.com/archives/html/xen-devel/2009-09/msg00491.html
How do I map a USB port to a Hyper V virtual machine? ›
Go to the settings of your VM and click on SCSI controller. Add the type "HardDrive" Go to the newly create harddrive in the Hyper-V settings menu and click on the option Physical harddrive. You should be able to select the USB drive.Does Hyper-V allow USB passthrough? ›
Hyper-V supports four different methods of USB passthrough you can use to directly access USB devices from a VM: network-level redirection, server-side redirection by attaching the device as a SCSI drive, client-side redirection via the Enhanced Session Mode, and RDP connection.How do I transfer files from USB to virtual machine? ›
- Click to open the virtual machine.
- Select the decompressed. VMX file.
- Start the VM.
- Select you have copied this VM.
Insert the flash drive into a USB port on your computer. You should find a USB port on the front, back, or side of your computer (the location may vary depending on whether you have a desktop or a laptop). Depending on how your computer is set up, a dialog box may appear. If it does, select Open folder to view files.How do I make my USB accessible? ›
- Right-click on the inaccessible USB drive and choose Properties.
- Select the Security Tab.
- Under Group or user names, choose your account name to check if you have permission to access the USB drive.
- Select the files you want to get back and then click Recover.
- Click the Start button and type "device manager" or "devmgmt. ...
- Click "Universal Serial Bus controllers" to see a list of USB ports on the computer.
- Right-click each USB port, then click "Enable." If this does not re-enable the USB ports, right-click each again and select "Uninstall."
1. USB Settings. The USB section in a virtual machine's Settings window enables you to configure Oracle VM VirtualBox's sophisticated USB support. Oracle VM VirtualBox can enable virtual machines to access the USB devices on your host directly.Is USB passthrough useful? ›
USB passthrough is a super helpful feature that generally comes standard on higher end gaming keyboards. The USB passthrough makes plugging in additional USB devices breeze, especially devices with a shorter cable. If you're gaming, you can plug a standing microphone straight into your keyboard.How do I get my virtual machine to recognize my USB? ›
Within settings, browse to the USB tab and click the Add button on the very right of the window. Select the USB device that you wish to use from the list. Once done, click OK to save changes and exit. Now go back into your VM window, and from the Host options, select Device > Usb Devices > “your USB device.”How to detect USB drive in Hyper-V? ›
Connect your phone to the USB port of your machine. Then start RDC and go to Options . From there go to Local Resources and at the bottom Local devices and resources . Click the More button and then check the box for `Other supported Plug and Play (PnP) devices.
How do I get my virtual machine to read USB? ›
Launch VirtualBox on your system. Right-click on the Windows virtual machine and then select Settings options from the context menu. Click on the USB option present in the vertical menu. You will notice that the Enable USB Controller option is auto-checked.How do I map a drive to a virtual machine? ›
- Start Windows Explorer.
- Navigate to My Computer or Computer.
- Run the command to map a network drive. Option. Description. Windows Vista, Windows 7, Windows 8, Windows 10. Click Map Network Drive. ...
- Select a drive to map.
- In the Folder field, type \\vmware-host\Shared Folders\ .
- Click Finish.