Expose USB device to guest

5,705 views
Skip to first unread message

Paulo Borges

unread,
Mar 26, 2013, 1:38:11 PM3/26/13
to vagra...@googlegroups.com
Hi,

I'm pretty new to vagrant and I need to use an USB device from the host to the guest. Is that possible?

Cheers,
Paulo Borges

Paulo Borges

unread,
Mar 27, 2013, 9:55:04 PM3/27/13
to vagra...@googlegroups.com
Hi, let me elaborate a little more:

I have a Bluetooth USB dongle plugged in my host and I want to use it in my guest OS (which is based on the precise32 basic box provided in the Getting Started session)

My provider is the default VirtualBox. I've searched how to do it using VirtualBox but I only find answers using the VirtualBox GUI. How can I do that using vagrant? (maybe through Vagrantfile?)

Can anyone help me?

PS: sorry about the creepy english.

jeff.l...@rewardloop.com

unread,
Mar 29, 2013, 4:05:50 PM3/29/13
to vagra...@googlegroups.com
Hi Paulo

Seeing your question again I notice you were actually asking about doing this with VirtualBox. Again, I haven't tried this myself, but you could try the following:

1. Get the USB address in VirtualBox's format:
  VBoxManage list usbhost

2. Copy the Address of your device (like "p=0x0262;v=0x05ac;s=0x0000191d9766c26c;l=0x1d182000") below:

In Vagrantfile:
  config.vm.provider :virtualbox do |vb|
    vb.customize ["controlvm", :id, "usbattach", "p=0x0262;v=0x05ac;s=0x0000191d9766c26c;l=0x1d182000"]
  end

References:
  VBoxManage controlvm


Jeff

On Thursday, March 28, 2013 7:31:08 PM UTC-7, jeff.l...@rewardloop.com wrote:
Hi Paulo

I have not tried this myself, but I've played around with VMware USB options before and I'd suggest the following:

- determine the device's USB vendor ID (eg: 0xA000) and product ID (eg: 0xB000)
- add a vmware provider configuration block like the following to your Vagrantfile:

config.vm.provider :vmware_fusion do |v|
  v.vmx["usb.autoConnect.device0"]  = "0xA000:0xB000"
  v.vmx["usb.autoConnect.device1"]  = "..."    # for another device
end

References:
  VMware KB: Automatically connecting USB devices at virtual machine power on (1648)

  Vagrant: VMX CUSTOMIZATION

Good luck,
Jeff

Mikhail Titov

unread,
Jan 27, 2015, 9:43:03 PM1/27/15
to vagra...@googlegroups.com
On Saturday, June 8, 2013 at 7:10:10 PM UTC-5, Nuno Job wrote:
Hi,

Cause this on the internet. While trying to make this work I found the following error:


Any idea on what you might be doing that is different?

Is there a way to add usb filter rule only once? Unconditional vb.customize ['usbfilter', 'add', '0' ... adds filter every time VM is brought up. I tried to unconditionally remove a filter first and catching possible Vagrant::Errors::VBoxManageError , but it doesn't seem like begin/rescue/end work in this case.

Reply all
Reply to author
Forward
0 new messages