无法在macOS主机上的VirtualBox Guest中访问USB UART [英] Cannot access USB UART in VirtualBox Guest on macos Host

查看:129
本文介绍了无法在macOS主机上的VirtualBox Guest中访问USB UART的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经通过docker-machine创建了一个virtualbox:



$ docker-machine create --driver virtualbox default



在来宾操作系统中,我想访问我的USB串行设备,它是Nordic nRF52840 DevKit,在macOS中列为 /dev/tty.usbmodem144241



不过,virtualbox并未将此设备列为USB设备。我还尝试过按照



如果我将串行端口添加为 .tty-usbmodem 虚拟机将挂在正在启动中,我必须终止所有虚拟机进程或断开串行电缆才能重新启动。如果我使用 .cu-usbmodem ,则虚拟机会启动,但会立即崩溃。



我的构想已不多了这里。我被困在这个问题上,因为Mac的docker不支持没有虚拟机的-devices 映射,对于虚拟机,我以某种方式无法添加



还有其他可以尝试的想法吗?

解决方案

因此,事实证明,virtualbox对于何时实际连接设备非常挑剔,并且无法像使用VMWare那样无缝地正常工作:




  • 我使用的设备实际上只是在USB菜单中显示为 SEGGER J-Link

  • 必须添加作为过滤器(过滤器确实令人困惑,首先我认为它会忽略该设备)

  • 无法动态将设备添加到虚拟箱(使用显示窗口,请参见屏幕快照),必须在虚拟盒启动之前将其连接。

  • 串行选项卡无关紧要,所有这些都通过 USB选项卡处理。





重要的事实是,不得连接设备,直到虚拟箱启动。因此,添加设备的步骤如下:




  • 关闭虚拟机电源

  • 确保USB控制器已启用

  • 将USB /串行设备连接到计算机(主机)

  • 将其添加到虚拟框中的过滤器中



现在,每次要在虚拟机上使用设备时:




  • 确保虚拟机已关闭(例如 docker-machine stop default

  • 断开USB /串行设备的连接从计算机上

  • 启动虚拟机(例如 docker-machine start default

  • Virtualbox现在应该能够拦截该设备并将其在 / dev 下列出,例如,作为 / dev / ttyACM0





解开/插入已过滤的d盒子打开后的提示也可以使用(如果您在启动设备之前忘记断开设备的连接,则不必再次关闭虚拟盒的电源。只需等待盒子装好,拔出插头,插上电源,就可以了。)


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

这篇关于无法在macOS主机上的VirtualBox Guest中访问USB UART的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆