Passthrough USB devices from ESXi to VM

Recently I was asked to look into an issue with passing USB devices from an ESXi host to a Guest Virtual Machine running Windows.

When the USB device was plugged into a USB port on a vSphere 6.5 host, the device was available in the vSphere client to add to the Guest VM (Edit Settings > Add Device > USB Device)

However, when the VM was powered on, the USB device was removed from the VM automatically.

In this case, the USB device was a USB Smart Card Reader, the ones you use for banking authentication.


Allow CCID

First, the Virtual Machine configuration needs the following advanced setting applied:

usb.generic.allowCCID = TRUE

You might need to use the below instead, depending on the type of device you are trying to passthrough:

usb.generic.allowHID = "TRUE"

USB Quirks

Second, I discussed this issue with William Lam on Slack and he suggested adding the following additional configuration to the VM:

usb.quirks.device0 = "0xPID:0xDID allow"
PID is the PID of the USB device
DID is the Device ID of the USB device
The quotes are important to keep too
You can find the PID and DID after inserting the USB device into the ESXi host by opening up an SSH session and typing:

This will return something like this:

Bus 001 Device: 006: ID 0123:4567 DeviceDescription
The PID is to the left of the colon  (0123) and the DID is to the right (4567)
This means for the usb.quirks.device0 option you would need to enter:
usb.quirks.device0 = "0x0123:0x4567 allow"

USB Controller

Ensure that you have a USB controller created for the VM before you try to add a USB Device to the VM.

Attaching the USB device

After these three things have been configured, simply:
  1. Ensure the USB device is connected to the ESXi host’s USB port
  2. Validate that the VM is located on that same host
  3. Power off the VM
  4. Edit the settings of the VM & add a USB device to the hardware. You will see the USB device which you connected to the ESXi host available
  5. Power on the VM and you should see it listed in device manager

Leave a Response

This site uses Akismet to reduce spam. Learn how your comment data is processed.