uncategorized

Passthrough USB Keyboard and Mouse to VM on ESXi

My kids are still pretty young-ish so we make do with a mix of laptops and ipads.

I do have a couple Windows VMs that are setup as gaming machines with dedicated GPUs via hardware passthrough. The issues earlier have been concerning with providing physical keyboard, mouse and steering wheel support.

The current setup is to passthrough one of the USB buses to a dedicated always-on VM and expose any attached USB devices via a virtual USB server. The reason behind doing this is that HID devices (Human Interaction) are hidden by default by ESXi and requires quite some fiddling and remains either statically mapped or randomly assigned device-id. Passing the entire USB bus will make any USB device plug & play and can easily be passed to any other client.

VirtualHere

VirtualHere allows USB devices to be used remotely over a network just as if they were connected locally!

I’ve chosen the VirtualHere software due to it being actively developed and supported by a single individual. Other choices come from companies who pretty much overcharge imho. Currently I have printers, keyboards, mice and a steering wheel up and running using this setup.

I also use it for hooking up mobile devices to an automated build and test pipeline.

VirtualHere maintains a list of instances where people use VirtualHere in different scenarios.

Passthrough USB controller

Since the ESXi Web Client (stand alone) is still under heavy development, the passthrough features weren’t always working, so using the VMWare Client is a safe option.

The trick is to choose the correct USB controller. As I use a USB boot stick for ESXi, selecting the wrong one is kind of fatal.

Figuring out which USB controller to passthrough

A tip is to attach a USB device to the chosen USB port, and then list attached USB devices to see with USB host controller they are using.

SSH into the ESXi host and list USB devices:

*lsusb -v | grep -e Bus -e iSerial*

Attached devices are listed first and then the USB buses.

  1. This is my USB boot device, which is attached to Bus 005

  2. Bus 005 is attached to controller 00.14.0 which I do not want to passthrough

  3. Either one of these are fine to passthrough. Just need to find the physical ports on the machine which maps to these. The id:s are either 00:1d.0 or 00:1a.0.

Exporting connected USB devices as virtual USB devices

All the machines are connected using Ethernet, although Wifi is possible where latency is not an issue.

The Client connects to the USB hub and reserves a device.

When a USB device is in use, it is exclusively locked.