Sometimes (e.g You are developing an IoT Project), you need to connect you board to Virtual Machine via USB Port. This post will show you steps to connect USB port from Virtual Machine using Vagrant and Virtual Box.
At the first, you have to make sure that the USB device was connected to your computer with command:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
VBoxManage.exe list usbhost Host USB Devices: UUID: 7c078866-a1ef-43fc-a67c-df06ae84e4ac VendorId: 0x04f2 (04F2) ProductId: 0xb40a (B40A) Revision: 105.100 (105100) Port: 0 USB version/speed: 2/High Manufacturer: Chicony Electronics Co., Ltd Address: {36fc9e60-c465-11cf-8056-444553540000}\0008 Current State: Busy UUID: dec2a0f4-33db-4a42-9af7-ee7beb034c77 VendorId: 0x13d3 (13D3) ProductId: 0x3362 (3362) Revision: 0.1 (0001) Port: 0 USB version/speed: 1/Full Manufacturer: Atheros Communications Product: Bluetooth USB Host Controller SerialNumber: Alaska Day 2006 Address: {e0cbf06c-cd8b-4647-bb8a-263b43f0f974}\0000 Current State: Busy UUID: 2f9068df-3345-477b-8de9-d0272bbbaf15 VendorId: 0x1a86 (1A86) ProductId: 0x7523 (7523) Revision: 2.84 (0284) Port: 0 USB version/speed: 1/Full Manufacturer: QinHeng Electronics Product: USB2.0-Serial Address: {4d36e978-e325-11ce-bfc1-08002be10318}\0001 Current State: Busy |
The output above shows the USB Device has VendorID is 0x1a86
and ProductId is 0x7523
. So we add the lines below to Vagrantfile:
1 2 |
vb.customize ["modifyvm", :id, "--usb", "on"] vb.customize ['usbfilter', 'add', '0', '--target', :id, '--name', 'ESP', '--vendorid', '0x1a86', '--productid', '0x7523'] |
Finally, starting your Virtual Machine:
1 |
vagrant up |
In your Linux Virtual Machine, type lsusb
to check the result.