将 USB 设备转发到虚拟盒时出现问题

将 USB 设备转发到虚拟盒时出现问题

我想连接一个 CAN 到 USB 接口,以便将发动机控制单元编程到 WinXP 虚拟机。但这个设备没有列在虚拟机窗口左下方的小 USB 图标下。

运行 usb-devices 我得到以下信息:

T:  Bus=06 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  3 Spd=12  MxCh= 0
D:  Ver= 1.10 Cls=ff(vend.) Sub=ff Prot=00 MxPS=16 #Cfgs=  1
P:  Vendor=0000 ProdID=0102 Rev=01.00
C:  #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA
I:  If#= 0 Alt= 0 #EPs= 4 Cls=00(>ifc ) Sub=00 Prot=00 Driver=(none)

我的 VM 可以与所有其他 USB 设备(包括一些不常见的设备)配合使用。在我的系统上无法使用的设备在 Mac 上的 VirtualBox 和大学笔记本电脑的 BSD 主机上可以正常工作。

我正在运行 Ubuntu 12.04 和 virtualbox 4.1.18

提前感谢,这确实会使我的工作变得容易很多,而不必一直启动 win :-(

附加信息:

当我插入有问题的设备时发生的情况如下:

udevadm monitor
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent

KERNEL[13416.745162] remove   /devices/system/cpu/cpu0/cpuidle/state0 (cpu)
KERNEL[13416.745212] remove   /devices/system/cpu/cpu0/cpuidle/state1 (cpu)
KERNEL[13416.745236] remove   /devices/system/cpu/cpu0/cpuidle/state2 (cpu)
KERNEL[13416.745265] remove   /devices/system/cpu/cpu0/cpuidle/state3 (cpu)
KERNEL[13416.745287] remove   /devices/system/cpu/cpu1/cpuidle/state0 (cpu)
KERNEL[13416.745309] remove   /devices/system/cpu/cpu1/cpuidle/state1 (cpu)
KERNEL[13416.745330] remove   /devices/system/cpu/cpu1/cpuidle/state2 (cpu)
KERNEL[13416.745352] remove   /devices/system/cpu/cpu1/cpuidle/state3 (cpu)
UDEV  [13416.745782] remove   /devices/system/cpu/cpu0/cpuidle/state0 (cpu)
UDEV  [13416.747609] remove   /devices/system/cpu/cpu1/cpuidle/state1 (cpu)
UDEV  [13416.747653] remove   /devices/system/cpu/cpu0/cpuidle/state1 (cpu)
UDEV  [13416.747680] remove   /devices/system/cpu/cpu1/cpuidle/state2 (cpu)
UDEV  [13416.747705] remove   /devices/system/cpu/cpu0/cpuidle/state3 (cpu)
UDEV  [13416.748618] remove   /devices/system/cpu/cpu1/cpuidle/state0 (cpu)
UDEV  [13416.748830] remove   /devices/system/cpu/cpu1/cpuidle/state3 (cpu)
UDEV  [13416.749363] remove   /devices/system/cpu/cpu0/cpuidle/state2 (cpu)
KERNEL[13416.750026] add      /devices/system/cpu/cpu0/cpuidle/state0 (cpu)
KERNEL[13416.750062] add      /devices/system/cpu/cpu0/cpuidle/state1 (cpu)
KERNEL[13416.750086] add      /devices/system/cpu/cpu0/cpuidle/state2 (cpu)
KERNEL[13416.750115] add      /devices/system/cpu/cpu0/cpuidle/state3 (cpu)
UDEV  [13416.751381] add      /devices/system/cpu/cpu0/cpuidle/state1 (cpu)
UDEV  [13416.751417] add      /devices/system/cpu/cpu0/cpuidle/state3 (cpu)
UDEV  [13416.751443] add      /devices/system/cpu/cpu0/cpuidle/state2 (cpu)
UDEV  [13416.751898] add      /devices/system/cpu/cpu0/cpuidle/state0 (cpu)
KERNEL[13416.753027] add      /devices/system/cpu/cpu1/cpuidle/state0 (cpu)
KERNEL[13416.753050] add      /devices/system/cpu/cpu1/cpuidle/state1 (cpu)
KERNEL[13416.753064] add      /devices/system/cpu/cpu1/cpuidle/state2 (cpu)
KERNEL[13416.753077] add      /devices/system/cpu/cpu1/cpuidle/state3 (cpu)
KERNEL[13416.753091] remove   /devices/system/cpu/cpu0/cpuidle/state0 (cpu)
KERNEL[13416.753105] remove   /devices/system/cpu/cpu0/cpuidle/state1 (cpu)
KERNEL[13416.753118] remove   /devices/system/cpu/cpu0/cpuidle/state2 (cpu)
KERNEL[13416.753132] remove   /devices/system/cpu/cpu0/cpuidle/state3 (cpu)
KERNEL[13416.753145] remove   /devices/system/cpu/cpu1/cpuidle/state0 (cpu)
KERNEL[13416.753158] remove   /devices/system/cpu/cpu1/cpuidle/state1 (cpu)
KERNEL[13416.753171] remove   /devices/system/cpu/cpu1/cpuidle/state2 (cpu)
KERNEL[13416.753184] remove   /devices/system/cpu/cpu1/cpuidle/state3 (cpu)
KERNEL[13416.755131] add      /devices/system/cpu/cpu0/cpuidle/state0 (cpu)
UDEV  [13416.755158] remove   /devices/system/cpu/cpu0/cpuidle/state2 (cpu)
KERNEL[13416.755174] add      /devices/system/cpu/cpu0/cpuidle/state1 (cpu)
UDEV  [13416.755189] add      /devices/system/cpu/cpu1/cpuidle/state1 (cpu)
KERNEL[13416.755203] add      /devices/system/cpu/cpu0/cpuidle/state2 (cpu)
UDEV  [13416.755218] remove   /devices/system/cpu/cpu0/cpuidle/state3 (cpu)
KERNEL[13416.755231] add      /devices/system/cpu/cpu0/cpuidle/state3 (cpu)
UDEV  [13416.755245] add      /devices/system/cpu/cpu1/cpuidle/state0 (cpu)
UDEV  [13416.755260] add      /devices/system/cpu/cpu1/cpuidle/state3 (cpu)
UDEV  [13416.755275] add      /devices/system/cpu/cpu1/cpuidle/state2 (cpu)
UDEV  [13416.755289] remove   /devices/system/cpu/cpu0/cpuidle/state1 (cpu)
UDEV  [13416.755303] remove   /devices/system/cpu/cpu0/cpuidle/state0 (cpu)
KERNEL[13416.755622] add      /devices/system/cpu/cpu1/cpuidle/state0 (cpu)
KERNEL[13416.755643] add      /devices/system/cpu/cpu1/cpuidle/state1 (cpu)
KERNEL[13416.755656] add      /devices/system/cpu/cpu1/cpuidle/state2 (cpu)
KERNEL[13416.755670] add      /devices/system/cpu/cpu1/cpuidle/state3 (cpu)
UDEV  [13416.759319] add      /devices/system/cpu/cpu0/cpuidle/state2 (cpu)
UDEV  [13416.759348] add      /devices/system/cpu/cpu0/cpuidle/state3 (cpu)
UDEV  [13416.759364] remove   /devices/system/cpu/cpu1/cpuidle/state1 (cpu)
UDEV  [13416.759379] remove   /devices/system/cpu/cpu1/cpuidle/state0 (cpu)
UDEV  [13416.759394] add      /devices/system/cpu/cpu1/cpuidle/state1 (cpu)
UDEV  [13416.759409] add      /devices/system/cpu/cpu1/cpuidle/state0 (cpu)
UDEV  [13416.759424] remove   /devices/system/cpu/cpu1/cpuidle/state3 (cpu)
UDEV  [13416.759439] add      /devices/system/cpu/cpu1/cpuidle/state3 (cpu)
UDEV  [13416.759453] remove   /devices/system/cpu/cpu1/cpuidle/state2 (cpu)
UDEV  [13416.759468] add      /devices/system/cpu/cpu1/cpuidle/state2 (cpu)
UDEV  [13416.759482] add      /devices/system/cpu/cpu0/cpuidle/state1 (cpu)
UDEV  [13416.759496] add      /devices/system/cpu/cpu0/cpuidle/state0 (cpu)
KERNEL[13417.205442] add      /devices/pci0000:00/0000:00:1d.0/usb6/6-1 (usb)
KERNEL[13417.208418] add      /devices/pci0000:00/0000:00:1d.0/usb6/6-1/6-1:1.0 (usb)
UDEV  [13417.227113] add      /devices/pci0000:00/0000:00:1d.0/usb6/6-1 (usb)
UDEV  [13417.229757] add      /devices/pci0000:00/0000:00:1d.0/usb6/6-1/6-1:1.0 (usb)

如果我插入正确转发的 Vector 设备,将发生以下情况:

udevadm monitor
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent

KERNEL[13696.085406] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-2 (usb)
KERNEL[13696.465828] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-2/2-2:1.0 (usb)
UDEV  [13696.484915] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-2 (usb)
UDEV  [13696.492091] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-2/2-2:1.0 (usb)

lsusb 的输出:

lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 004: ID 17ef:1004 Lenovo Integrated Webcam
Bus 004 Device 002: ID 08ff:2810 AuthenTec, Inc. AES2810
Bus 004 Device 003: ID 0a5c:2145 Broadcom Corp. Bluetooth with Enhanced Data Rate II
Bus 006 Device 007: ID 0000:0102  
Bus 002 Device 011: ID 1248:1001 

tail -f /var/log/kern.log 包括连接和断开设备:

tp@tp-ThinkPad-R500:~$ tail -f /var/log/kern.log
Jul 15 10:46:53 tp-ThinkPad-R500 kernel: [15135.583561] iwlwifi 0000:03:00.0: Radio type=0x1-0x2-0x0
Jul 15 10:46:53 tp-ThinkPad-R500 kernel: [15135.632544] ADDRCONF(NETDEV_UP): wlan0: link is not ready
Jul 15 10:46:53 tp-ThinkPad-R500 kernel: [15135.633620] tg3 0000:04:00.0: irq 49 for MSI/MSI-X
Jul 15 10:46:53 tp-ThinkPad-R500 kernel: [15135.662314] ADDRCONF(NETDEV_UP): eth0: link is not ready
Jul 15 10:46:55 tp-ThinkPad-R500 kernel: [15137.314088] tg3 0000:04:00.0: eth0: Link is up at 100 Mbps, full duplex
Jul 15 10:46:55 tp-ThinkPad-R500 kernel: [15137.314093] tg3 0000:04:00.0: eth0: Flow control is on for TX and on for RX
Jul 15 10:46:55 tp-ThinkPad-R500 kernel: [15137.315407] ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
Jul 15 10:46:56 tp-ThinkPad-R500 kernel: [15138.477486] input: Logitech Bluetooth Mouse M555b as /devices/pci0000:00/0000:00:1a.1/usb4/4-2/4-2:1.0/bluetooth/hci0/hci0:11/input14
Jul 15 10:46:56 tp-ThinkPad-R500 kernel: [15138.477699] generic-bluetooth 0005:046D:B009.0002: input,hidraw0: BLUETOOTH HID v4.16 Mouse [Logitech Bluetooth Mouse M555b] on 00:24:2C:BF:81:72
Jul 15 10:47:05 tp-ThinkPad-R500 kernel: [15148.080037] eth0: no IPv6 routers present
Jul 15 10:52:03 tp-ThinkPad-R500 kernel: [15445.116070] usb 6-1: new full-speed USB device number 8 using uhci_hcd
Jul 15 10:52:16 tp-ThinkPad-R500 kernel: [15458.488118] usb 6-1: USB disconnect, device number 8

答案1

这可能是 Ubuntu 中 VB usb 支持的问题

按照前面所述安装 USB 2.0 支持https://www.virtualbox.org/wiki/Downloads

但随后将您的用户添加到虚拟盒用户团体https://help.ubuntu.com/community/VirtualBox/USB

在 VB 中,vboxusers 没有 USB 权限是一个常见问题

sudo adduser yourusername vboxusers

遗憾的是,添加到组后,您需要注销并登录,然后重试,VB 应该识别列表中的 USB

(在最后的版本中甚至不需要添加过滤器,您只需在正在运行的虚拟机上打开“USB 设备”菜单并选择设备并将其插入客户端机器即可)

答案2

你必须安装virtualbox extension pack

https://www.virtualbox.org/wiki/Downloads

并且您还想安装guest additions以获取适合您的 VirtualBox 客户端的驱动程序。

答案3

某些 USB 设备可能无法与 Virtual Box 正常配合使用。您的 CAN 转 USB 接口可能存在这种情况,但如果我们让 Virtual Box 访问它,则值得尝试。

为此,我们可能会尝试添加“空的”机器的 USB 设置中的 USB 过滤器:

在此处输入图片描述

这可能已经有助于识别您的设备。我们也可以尝试在右键单击“新文件管理器 1”打开一个设置窗口,其中包含每个条目的一些解释性工具提示:

在此处输入图片描述

另请阅读Virtual Box 使用手册了解这些设置的解释以及如何获取它们。

答案4

您能否确认您已选中Enable USB 2.0 (EHCI) ControllerTakkat 回复中显示的复选标记?此外,当您将 USB 设备插入计算机时,查看其发生的情况可能很有用。考虑到这一点,以下命令可能有助于您开发更多信息

lsusb
udev monitor

您可能需要为设备创建 udev 规则,以确保它属于适当的组。了解更多有关您正在使用的设备的信息可能会有所帮助。

相关内容