I ran into the same issue... the solution is to actually check the devices in the VM using
vim-cmd vmsvc/device.getdevices <vmid>
[...]
(vim.vm.device.VirtualUSB) {
dynamicType = <unset>,
key = 0,
deviceInfo = (vim.Description) {
dynamicType = <unset>,
label = "USB 1",
summary = "USB Ethernet Adapter",
},
backing = (vim.vm.device.VirtualUSB.USBBackingInfo) {
dynamicType = <unset>,
deviceName = "path:2/0/1 version:2",
useAutoDetect = <unset>,
},
[...]
and then use the exact same string as in the output.
~ # vim-cmd vmsvc/device.connusbdev 1 "path:2/0/1 version:2"
~ # vim-cmd vmsvc/device.disconnusbdev 1 "path:2/0/1 version:2"
This does only connect, but not disconnect:
~ # vim-cmd vmsvc/device.connusbdev 1 "path:2/0/1"
~ # vim-cmd vmsvc/device.disconnusbdev 1 "path:2/0/1"
Failed to find the specified USB device.
~ #
HTH a bit,
-ralph