Adding USB devices in a Virtual Machine

Adding USB Devices in a Windows Virtual Machine with VirtualBox

One of the most confusing things for me when I first experimented with VirtualBox was the question of how to add USB devices.  I run Linux (Ubuntu) as my main OS now, but sometimes I need to dig around in Windows (e.g. work related stuff) so for those cases I run it in a virtual machine.  I recently needed to add a data acquisition device for use in the virtual machine on Windows, so I thought I’d document the procedure here.

Pre-Requisites

You need to have VirtualBox installed on your machine, and a Windows virtual machine set up.  I am going to run Windows XP in a virtual machine on Ubuntu in this tutorial.
You also need Virtual Guest Additions installed in the virtual machine to enable the USB support, amongst other things.  If you’re confused about this aspect, there is plenty of information available if you ‘google’ it.

Sorting out the Group Permissions

The only reason that USB support is confusing at all is that you need to add your user to the VirtualBox group before any USB devices will show up for use.  VirtualBox doesn’t offer any other useful information; it just complains that there are no available devices.  The problem is that VirtualBox is not allowed to share your USB devices, so the next steps will fix this.

First you need gnome-system-tools.  Run the following command in a terminal to install it:

sudo apt-get install gnome-system-tools

Now go to the dashboard and type ‘user’.  You should see an icon for Users & Groups appear.  Select it, and the following window will appear:

Users Settings_002Select ‘Manage Groups’.  The following window will appear:

GroupsSettingsScroll down to ‘vboxusers’ and then select ‘Properties’.  The following window will appear:

Group'vboxusers'PropertiesMake sure your user is ‘ticked’.  It probably won’t be by default.  Then select ‘OK’.

WinXP-Dev-SettingsNow USB should work.  But you have to log out and back in again first.  You should do that now.  When you log back in, open Virtual Box and select the settings for your virtual machine.  Select the USB settings, and make sure USB is enabled.  Now you just need to add the USB device you want to use in your machine.  Make sure it’s connected to your computer, and then select the ‘add’ button.  I’m going to add my National Instruments DAQ device:

selectniNow, when you start your virtual machine, Windows should detect new hardware and install it for you:

installingnidaqFinally, when it’s done, you can test out your hardware.  I am using a DAQ device so I started the software for it and captured an analog signal 🙂

Capture

DONE

That’s it, you’re done.  Any time you need to add more USB devices, you can add them to your virtual machine in the same way.

Good Luck.

 

Brian Hoskins is a 35 year old Electronic Engineer from South Wales in the United Kingdom. He is passionate about Electronics Design, Computing, Programming and Science in general. He works as a Test Development Engineer at an automotive electronics company in South Wales and also carries out electronics design work on personal projects in his spare time. Brian has a BSc with honours in electronics engineering and is a member of the Institution of Engineering & Technology.
Recent Related Posts
This entry was posted in Computing, Computing Blog and tagged . Bookmark the permalink.