VMware Cloud Community
timeos
Contributor
Contributor

ESXi 6.5 map USB device to VM via CLI

hello

I am trying to attach USB device connected to ESXi host to VM -  technically to perform USB device passthrough (device is HID-based). I followed all instructions on https://williamlam.com/2020/05/how-to-passthrough-usb-keyboard-mouse-hid-and-ccid-devices-to-vm-in-e... to make this working, but because ESXi doesnt recognize USB device vendor/model, this device is without name and therefore not visible or available for attaching to VM. (I am trying to understand whether defining USB device vendor/model in ESXi is possible in different thread - https://communities.vmware.com/t5/ESXi-Discussions/ESXi-6-5-how-to-edit-etc-vmware-usb-ids/m-p/30104... )

this is that device (from "lsusb" output):

Bus 001 Device 004: ID 3553:a001   <<<======== without name
Bus 002 Device 003: ID 0424:2660 Standard Microsystems Corp. Hub
Bus 001 Device 003: ID 173d:0004 QSENN
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 003 Device 001: ID 0e0f:8001 VMware, Inc. Root Hub
Bus 002 Device 001: ID 0e0f:8002 VMware, Inc. Root Hub
Bus 001 Device 001: ID 0e0f:8002 VMware, Inc. Root Hub

Device details: (from lsusb -v):

Bus 001 Device 004: ID 3553:a001
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor 0x3553
idProduct 0xa001
bcdDevice 0.00
iManufacturer 1 PCsensor
iProduct 2 TEMPerGold
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 66
bNumInterfaces 2
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xa0
(Bus Powered)
Remote Wakeup
MaxPower 100mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 1 Boot Interface Subclass
bInterfaceProtocol 1 Keyboard
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.11
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 65
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0008 1x 8 bytes
bInterval 2
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 1 Boot Interface Subclass
bInterfaceProtocol 2 Mouse
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.10
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 41
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0008 1x 8 bytes
bInterval 10
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0008 1x 8 bytes
bInterval 10
Device Status: 0x0000
(Bus Powered)

Device cannot be attached to VM over GUI as adding USB device is greyed-out from VM HW properties (there is no other USB device available on ESXi host). Again, I assume it is because of empty USB device name.

I see this in log:

/var/log/vmkernel.log:
2024-03-04T19:27:45.472Z cpu21:66096)<6>usb 1-1.4: New USB device found, idVendor=3553, idProduct=a001
2024-03-04T19:27:45.473Z cpu21:66096)<6>generic-usb 0003:3553:A001.0004: input: USB HID v1.11 Keyboard [PCsensor TEMPerGold] on usb-0000:00:1a.0-1.4/input0
2024-03-04T19:27:45.474Z cpu21:66096)<3>generic-usb 0003:3553:A001.0005: claimed by neither input, hiddev nor hidraw
VMB: 59: cmdline: /jumpstrt.gz vmbTrustedBoot=false tboot=0x101b000 installerDiskDumpSlotSize=2560 no-auto-partition CONFIG./USB/quirks=0x3553:0xa001::0xffff:UQ_KBD_IGNORE bootUUID=7fa21681a102cf987b4cb4b2da3d5b7f

/var/log/usb.log

2024-03-04T21:36:48Z usbarb[73413]: DICT usb.quirks.device0 = "0x3553:0xa001 allow"
2024-03-04T21:36:48Z usbarb[73413]: USB: Overwrote device quirks entry for device, only using "0x3553:0xa001 allow"

output "esxcli hardware usb passthrough device list" shows nothing

but output of "esxcli hardware usb passthrough device enable -d 1:4:3553:a001" doesnt produce any error ("echo $?" returns "0") - so I assume it was executed completely (but still cannot see that device in list from command before).

and because I assuming, that device is technially available for USB passthrough, I was wondering to add it to VM via CLI (in order to overcome the problem of empty USB device name). I found that this can be done using following command: 

vim-cmd vmsvc/device.connusbdev <vm_id> "usb_device_path_id"

but the problem is to determine, what to use as "usb_device_path_id". I have tried many various combinations, command always ended up correctly, but VM HW list shows just "USB Device (Disconnected)" in WebGUI for that VM (and after powering-on that VM, all disconnected USB devices get removed from VM HW list later on).

please can anybody explain how to determine "usb_device_path_id" for CLI command "vim-cmd vmsvc/device.connusbdev"?

thank you very much for any help on this.

michal

0 Kudos
0 Replies