Odd ESX behavior on USB pass-through

I ran across an interesting problem recently with the (relatively) new USB passthrough feature on some ESXi 4.1 and 4.1 Update 1 machines.

For some reason, I would get into a situation where I couldn’t add any USB devices to any VMs. After digging around a bit it seems that you can produce this behavior by removing a USB device from a VM that is attached to an external hub. I was using an 8 port Trust hub that has two hubs internally. I’ve used the map/unmap function before with other systems without any difficulty, but in those cases, the USB peripheral was being connected directly to the ESX server rather than going through an external hub. As far as I can tell, the hub seems to be a contributing factor.

I would assign a USB device and then remove it. Immediately thereafter, it would claim that there were no USB devices available, even other devices that had not previously been assigned to a VM. Plugging in a new device made no difference and was not made available either.

When I went onto the command line, a “lsusb” would show me that all of the devices were in fact still seen by the ESX server. Disconnecting, reconnecting, restarting the server, restarting the usbarbitrator service made no difference. Once it got into this state it was impossible to map a USB device. Every time you go into Edit Settings > Add the USB Device option was greyed out.

Finally, a call to VMware support with some digging on their part revealed an internal tech note that recommended restarting the hostd service resets the state so that you can assign devices. There is a caveat though as ALL devices become available in the add USB device wizard, even devices that are currently mapped to VMs, so be careful to not double map a device.