Cannot access USB UART in VirtualBox Guest on macos Host - usb

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).

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.

Phone connected to adb via Wi-Fi disconnects immediately when USB cable is pulled [duplicate]

I develop on my tablet using android studio.
The tablet is connected to the computer by wifi using
adb connect <ip_andress>:5555
My application contains listeners for USB devices attached/detached.
But unfourtunately, when I connect/disconnect usb device to/from the tablet, the adb connection is getting killed, and I can no longer see the device under "adb devices".
It is not a adb-connection-by-wifi what gets killed. It is just that USB enumerations affect the sys.usb.* system properties which on many devices is causing restart of adbd regardless whether it's being used over USB or tcpip.
Do grep "stop adbd" /init*rc to see what I mean.
You could either comment out those stop adbd lines or just disconnect the USB cable before running your adb connect command.
I was never able to connect my cellphone with my computar through wi-fi.
I had already given up. I followed all the instructions and tips, and nothing worked.
Finally, I did what no one said to do.
I've connected the phone to the WiFi network provided by the cable modem itself and not to some (not all) additional networks that are included in the router.
At home I use one of these networks, because I use a Deco Tp-Link router, which propagates the signal to my entire house, but this network is NOT compatible with ADB. It does not identify it as belonging to the same network.
After this, I use the normal procedure described here.
a) Connect cellphone with a USB cable
b) Find the IP_Phone depends on system in the cell phone. Here I use Settings, About Phone, Status and IP address.
c) Run the following adb commands in Command Prompt (Windows) or Terminal (Linux), where IP_Phone is the IP above mentioned. Normally adb.exe is an executable stored in computer path. adb is already included in Android Studio package.
adb tcpip 5555
adb connect IP_Phone
d) Now disconnect USB cable and it's ready. The cellphone model continues to appear in the status line in the top of Android Studio.
-/-
The best wifi is that defined in Cable Modem. It, unlike an any account defined in my router, answers to a ping command.
ping IP_Phone
Disconnect the usb cable just before running adb connect <*ip_address_of_your_phone*>

VMware USB autoConnect blacklisting?

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".

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.

WCF on PocketPC, not connecting to host machine

I'm working with a PocketPC vm for development over here.
I can get the virtual device to connect to the internet, but I can't get it to connect to a web service on my local (host) machine.
I've tried the machine name and my IP address, different ports, but no luck.
Anyone else have this issue?
EDIT: I have an actual device at my machine as well. When docked I don't have this problem with the real device, just the emulated one.
I have not had the specific issue. But, the best way I've found to deal with these issues when using WCF is to enable tracing and see what the error messages are.
If you are connected via ActiveSync, you can connect to the name "ppp_peer".
This name will always resolve to the machine connected via active sync.
Figured it out when I read this article:
http://www.betterthaneveryone.com/archive/2008/08/31/getting-network-access-on-the-windows-mobile-emulator.aspx
The device has to be docked. You need to use the Device Emulator Manager to dock the device. Also note: you can only have one device docked at a given time.
Once the device is docked, you should see the Windows Mobile Device Center display. Find the running device (look for the green arrow), right-click and select Cradle. Remember, only one device can be cradled/docked at a time. If you have a real device that is cradled already, you cannot cradle an emulator.
In Windows Mobile Device Center -> Mobile Device Settings -> Connection Settings: Check "Allow connections to one of the following:" and select DMA in the dropdown.
On the emulator: File->Configure->Network. Make sure a valid network device is selected.
From the emulated OS: Start Menu -> Settings -> Connections -> Connections -> Advanced -> Select Networks. Make both drop-downs My ISP.
That should be it. To test, load Internet Explorer, browse to StackOverflow.com. Next, browse to a web page on your local machine.