2

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:

USB devices in VirtualBox Serial Port in VirtualBox

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?

martin
  • 591
  • 1
  • 8
  • 17

1 Answers1

1

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.

Virtualbox grays out the device - it was connected before powering up the box

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

Device is connected!

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

martin
  • 591
  • 1
  • 8
  • 17