VMware USB autoConnect blacklisting? - usb

Is there a way to stop VMware (Workstation 12 Player) from automatically connecting a USB device?
When I wake up my Surface (Win 10 x64) it connects the Type Cover to the running Linux (Ubuntu 14.04.3, 4.3 kernel) guest, which doesn't seem to know how to handle it. I then have to use the touch screen to manually disconnect the device (= attach it to the Windows host) to be able to move my cursor or type again.
I'm sure there is an option to ignore a device in the .vmx config file...?
Edit: Note that I don't want to generally disable usb.autoConnect, because I need it for another device (an Arduino Micro that must be quickly reattached in bootloader mode...)

You can either stop Mware USB Arbitration Service
or
try to uncheck "Automatically connect new USB devices" in "VM Setting ->USB controller panel" and check "do not show this hint again".

Related

How to emulate USB-device as "alive" on VM?

Step by step:
My PC has connected printer via USB (I know VID:XXXX and PID:YYYY)
I took image of my PC and put inside virtual machine (VMWare)
Of course image on my VM doesn't has connected USB-printer (because real printer is connected to my real USB-port on my real PC).
One program is running and checking accessibility of printer by check connection with the printer via USB (I don't know how exactly - maybe via WMI, maybe via other way).
Results:
a) on my real PC this program works
b) on image doesn't work
QUESTION: is possible to emulate on VM-side that USB-port (VID:XXXX and PID:YYYY) is alive?
Thanks.
P.S. I don't want to install USB-redirect-via-TCP or similar approach.
You should switch to the QEMU emulator and to Linux to do that. VMWare probably doesn't support this of thing especially in a Windows environment.
If you are already on Linux, QEMU has hardware emulation of the xHCI and you can assign the host USB devices to KVM (read here: https://www.linux-kvm.org/page/USB_Host_Device_Assigned_to_Guest).
On Windows, I don't think this will be possible.

Cannot access USB UART in VirtualBox Guest on macos Host

I've created a virtualbox via docker-machine:
$ docker-machine create --driver virtualbox default
Within the Guest-OS I'd like to access my USB-Serial device, which is a Nordic nRF52840 DevKit, which is listed in macos as /dev/tty.usbmodem144241.
However, this device is not listed as USB device by virtualbox. I've also tried adding the devices as a Serial Port with the Port Mode "Host-Device" as described in this link, but without any success:
If I add the Serial Port as .tty-usbmodem the virtualbox will hang in 'Starting', I have to kill all virtualbox processes or disconnect the serial cable in order to start again. If I use .cu-usbmodem the virtualbox starts up but immediately crashes.
I'm running out of ideas here. I'm stuck at this issues since docker for mac does not support the --devices mapping without virtual machine, and for the virtual machine I somehow can't manage to add the port.
Any ideas on what else I could try?
So as it turns out virtualbox is quite picky about when a device is actually connected and does not work as seamlessly as I'm used from using VMWare:
The device I was using really just shows up as SEGGER J-Link in the USB menu
It must be added as filter (filter is really confusing > first I thought it would ignore the device)
The device cannot be added to the virtualbox 'on the fly' (using the USB-icon in the 'Show' window, see screenshot), it must not be connected before the virtualbox starts up.
The serial-tab is irrelevant > it's all handled via the USB tab.
The important fact is that the device must not be connected wenn the virtualbox fires up. So the steps to add a device are the following:
Power down the virtualbox
Make sure the USB controller is enabled
Connect the USB/serial device to the computer (host)
Add it to the filter in the virtual box
Now every time you want to use the device with the virtualbox:
Make sure the virtualbox is down (e.g. docker-machine stop default)
Disconnect the USB/serial device from the computer
Start up the virtualbox (e.g., docker-machine start default)
Virtualbox should now be able to "intercept" the device and list it under /dev, e.g., as /dev/ttyACM0
Un-/Plugging a filtered device once the box is up also works (you don't have to power down the virtualbox again if you forgot to disconnect the device before starting it up. Just wait for the box to be up, unplug, plug in, should be good).

Qubes OS: No networking?

I am using a Lenovo T420 machine having Cubes OS 3.2 freshly installed. On the upper right corner where the system tray icons reside appears no entry that allows me to connect to my home wifi. I tried to reboot the system several times without change. Right before the install I had an up-to-date Ubuntu installation and networking was no problem at all.
Somewhere on the web I read about weird interference about networking in cubes having wifi enabled or ethernet plugged in during the install. Furthermore I read about Cubes OS having trouble sometimes with Lenovo systems that have to hardware wifi toggle.
As my Lenovo Thinkpad T420 has such hardware toggle this inspired me to do the following:
Having Cubes OS booted without any networking icon in the system tray
Toggle the hardware switch to disable the wifi
Reboot the whole system
Directly after the restart my networking has been recognized by Cubes OS showing up the icon in the system tray. After toggling the hardware wifi switch again to enable it, available wifi networks have been listed and I were able to connect. Since then my networking works fine. Indeed I have not tested out yet if a cable connection would still work out. But it doesn't matter for me for now.

How to control removable usb devices with VMware vmrun

I have VMware workstation 9 and 10, and I am wanting to use that to run some integration tests.
Using the vmrun utility, I can copy scripts to and run them on the virtual machine guests. However, some of the integration tests will require interfacing with USB devices.
Is there any way using vmrun, or any of the vmware API's to programmatically control the "Removable Devices" to connect and disconnect USB devices to virtual machines?
I have tried looking at the readVariable and writeVariable commands, however I cannot find any useful information on that subject.
vmrun has no facility to passthrough USB devices from the host to the guest and vice versa (source, VMware employee). There are though 2 options to achieve this behavir
A) Use autoconnect: look here and here on how to modify the .VMX file to auto connect the USB device to the guest VM. Basically you need to add usb.autoConnect.device0 = "vid:XXXX pid:XXXX" to it.
B) Use askConnection: When you plugged in the device to the host, and the VM is powered on, you can select to connect the device to the VM and remember the choice. Then the next time when you pluggin the device again, the device will be automatically connected to the remembered VM. Also, you can configure in Edit > Preferences > USB for other choices. Currently, this feature only works when you plug in the device.

How to emulate USB devices?

The rest of my team will make for my application a simple non-standard USB microphone, but until they finish it I will have to emulate it, for integration testing purposes.
Is there any risk in a physical loopback? Yes there is
Will a physical loopback work? Only with a USB bridge
There is any way to create a logical loopback? (MSDN has something about this)
There is any general purpose USB emulator software?
In case there is many options available I'd rather work it .NET/Matlab/Python solutions.
Edit: Proof of concept here
I strongly recommend this project, USB IP. It is a way of connecting USB devices over the network. There is a Windows client.
What this means is, you install the client on your Windows computer.
This device then expects to talk to a USB device connected to a Linux computer, the server:
What you now do, is either create a fake device driver for Linux, that looks like is connected to a physical USB device, but in reality is just logic pretending to be your USB device. There are tutorials for writing USB drivers for Linux. Or you create your own stub driver for the Device Control Manager (see picture above). This stub driver could run on Windows or Linux, it wouldn't matter. It could even run on the same Windows machine which is the USB client.
The DSF USB Loopback Device mentioned in the question itself, would be the same kind of solution as a stub driver for the Device Control Manager, but taking Linux out of the picture altogether.
You can write virtual USB device using QEMU.
You can duplicate already existing device, like the dev-serial.c found in this QEMU repository and change it for your needs.
After you write and compile your USB device you can simply attach it to your VM using the QEMU command line interface.