Page 1 of 1

[Solved] Connecting a USB Mobile Broadband Dongle to a VM

PostPosted: 9. May 2013, 18:18
by mpack
People in the past have asked about problems connecting USB mobile broadband dongles to a VM. It just so happens that I've been struggling myself for the past couple of days trying to get one of these working. I finally succeeded, so I thought I would document the issues for others.

In my case the device was a Huawei E3131 USB Broadband (3G) dongle.

Note that there are two levels to this problem. The first is generic USB stuff, i.e. the problems that newbies always encounter because they haven't read the documentation or previous answers to similar problems ("USB device is busy with a previous request"). In the next message I will give a quick summary of how to attach any USB device, but I don't intend to labor over this subject.

However, even if you correctly connect the E3131 to the VM, you'll probably find what I did: it doesn't work, you can't get an internet connection. The third message describes what I did to solve this problem.

Also, my expertise is mainly with Windows as both host and guest. In the interests of clarity I will unabashedly address that specific scenario, however I'm sure the ideas can easily be extended to other hosts and guests if necessary.

Re: [Solved] Connecting a USB Mobile Broadband Dongle to a VM

PostPosted: 9. May 2013, 18:19
by mpack
General advice for connecting any USB device to a guest

The steps I use to connect any USB device to a VM are as follows.
(Note VBox4 users: if it's a USB3 device then it will only be supported on Windows hosts in a USB2 port - other hosts won't support it at all).
(USB3 support was added in VirtualBox v5.0, but remember that the guest OS has to support it too, so e.g. that excludes XP, while Win7 will require the non-native Intel driver).

  1. Install the extension pack. This is not the same as the Guest Additions! The extension pack is installed on the host and adds a number of closed source special features to the otherwise open source VirtualBox software. The closed source features include support for a virtual USB 2.0/3.0 host controller, which allows connection of most current USB devices. The VirtualBox v4.x extension pack only supported USB2 devices. The extension pack version must match that of the main VirtualBox application.

  2. Enable the "USB Controller", "USB 2.0 (EHCI) Controller", and "USB 3.0 (xHCI)" options in the VM settings as appropriate. If these were previously disabled then I like to boot up the VM at this point so that the guest OS can auto-detect the virtual USB controller and install drivers for it. I then shut the guest down again. At this point the guest has only seen the controller - no actual USB devices were connected. This step ensures that when I later get the "New hardware found" dialog then I will not get confused over what hardware has been found.

  3. In the VM settings USB | filters panel, add a filter to match the USB dongle. A blank filter (not recommended!) will match anything, which is good if the device appears as a composite, i.e. presents as a number of different devices all connected at once. However the danger of a blank filter is the potential to grab the wrong device, e.g. you do not want to grab the hosts USB keyboard and assign it to the guest! If you have a problem with the wrong device being grabbed then you'll need to add just enough information to the filter so that it matches your device only. But don't define the filter too narrowly, as that can lead to problems too. In the case of my Huawei dongle I created a filter in which only the vendor ID field (Huawei) was filled in. This prevents most problems provided I continue to only use one Huawei device on my PC.

  4. Now with the USB device unplugged, start up the VM. Wait until the guest OS is finished booting up (e.g. you reach the desktop in a Windows guest, and disk activity has stopped), then plug the USB device into a host port. On Windows hosts a "New hardware found" dialog box will appear. Don't let this fool you: this dialog is not the guest detecting your USB device, this prompt actually comes from VirtualBox on your host, and it's asking if it can install the USB filter driver, i.e. the VirtualBox driver that intercepts USB messages from this device to your host and redirects them to the VM. You need to allow this to happen, so click "Not at this time" to the internet search question, then "Install the software automatically" to the driver location choice.
    WARNING: on some hosts the protection level will be set so high that attempts to install the USB filter driver are automatically blocked without even prompting you. You'll never get USB working on such a host; you must have the host configured to at least prompt you when asked to install a device driver.

  5. Once the host filter driver has been installed, I like to unplug the USB device and plug it back in again. Now the guest should grab the device smoothly and you should be ready to rock 'n roll.
The procedure outlined above works best with generic USB mass storage devices, because all modern guest OS's' have native support for these and hence doesn't need you to install any further drivers. I suggest that you practice these steps with a USB thumb drive, and get the procedure down pat before you tackle devices that need additional drivers, such as the Huawei E3131.

Re: [Solved] Connecting a USB Mobile Broadband Dongle to a VM

PostPosted: 9. May 2013, 18:21
by mpack
Connecting a USB Broadband Dongle (Huawei E3131)

To date I have experimented with exactly one USB mobile broadband dongle, not a very good statistical population! However I'm hoping that what I've learned will put others on the right path.

Ok, I followed the generic procedure described in the previous message and I found what others before me had found: the broadband dongle worked in the host, but not in the guest. It also looked like there should be no need to install drivers, because the host just worked. So why did the guest have a problem?

The clue was in the quick start guide which came with the E3131: "If the computer does not start the USB stick's installation automatically, find the AutoRun.exe file in the USB Stick's root directory, and double-click the file to run it".

However when I checked the USB stick's root directory I saw nothing except an empty 2GB sdcard that I had installed in the device. It seems that when the USB stick is first plugged in it presents as a virtual CD drive (5MB) containing the drivers which autorun installs. On subsequent connections of the device this virtual CD drive is not provided, so you have no way to install the drivers in later attempts. Unfortunately somewhere in the juggling having to do with connecting a new USB device to a VM for the first time, the E3131 gets confused and stops offering that virtual CD drive - so no drivers, and no internet access.

It's possible the drivers can be downloaded from some online site, but I couldn't find them. What I did instead was plug the device into another physical host in which I knew that autoplay was disabled. I was able to see the virtual CD and copy off the contents, which I placed in a shared folder accessible to the VM. I then ran that AutoRun.exe program from inside the guest, then tried the USB dongle again... and hey presto it worked! (in fact I'm using it right now).

Re: [Solved] Connecting a USB Mobile Broadband Dongle to a V

PostPosted: 9. May 2013, 18:54
by tigary
Hi Mpack. I'm new to the forum and my issue is in the same vein but with differnt devices. I am running a W8 host with a W7 guest, and my problem is with an iphone. I've got the extension pack and guest additions installed. Mouse transfer between devices works like a charm (USB or bluetooth). With the iphone, the host (W8) grab it when it is plugged in, and then I get the "is busy" message when I try to open it in the W7 guest. It is clearly recognized by the guest, and no matter how much I try to change the Virtual box USB settings (it pre-populates with all of the iphone infomation), or change the remote all setting, I cannot get W8 to release the iphone to W7. Ive tried removing some information from the USB "apple" device, tried installing "two" apple devices, and change the remote/all setting to without success.

So...the guest can "see" the device (iphone) but it cannot grab it or share it. If you think I should post this somewhere else I will be happy to do so. Thanks

Re: [Solved] Connecting a USB Mobile Broadband Dongle to a V

PostPosted: 9. May 2013, 19:00
by mpack
Hi Tigary. I'm afraid that yes, I do think you should take that conversation elsewhere, because I want to keep this discussion about mobile broadband, not let it become a sprawling thread about connecting USB devices in general, repeating the same old stuff a zillion times because nobody will ever read the early messages. I outlined my full USB procedure above, so if that doesn't work then there isn't really anything else I can say. I have no experience with the iPhone, but I will say that your symptoms sound typical of those when device specific drivers have not been installed, as indeed was the case with my 3G dongle, i.e. the guest could see that a USB device existed, but without the correct software it had no idea how to use that device other than for its secondary role as mass storage.

Re: [Solved] Connecting a USB Mobile Broadband Dongle to a V

PostPosted: 10. May 2013, 13:30
by mpack
Thanks to a helpful message by Tigary in another thread, I'm obliged to him for passing along a tip: to consider whether your device is USB 3.0 based - mine wasn't, but yours might be. VirtualBox does not currently support USB 3.0, so if the device in question can be configured to run in USB 2.0 mode, or if it'll work when plugged into a USB 2.0 port, then either of those things might be worth trying.

[Edit] VirtualBox 4.3.0 added support for USB 2.0 devices plugged into USB 3.0 Windows host ports.
[Edit2] VirtualBox 5.0 added full support for USB 3.0 devices. The gotcha is of course that the guest OS must have USB3 support too, otherwise you must continue to use the old workarounds (plug device into USB2 port or hub). XP has no USB3 support for a chipset you can use in a VM. Win7 has no native support for USB3, but Intel xHCI drivers are easily found online. I've never needed them myself, so I don't have a download link.
[Edit3]You can now access USB3 devices from XP guests, using the Renesas drivers. See USB 3.0 support in XP guests.

Re: [Solved] Connecting a USB Mobile Broadband Dongle to a V

PostPosted: 14. Nov 2013, 13:49
by mpack
Information contributed by user "gwardell". Original thread here.

gwardell wrote:Hi,

Just thought I'd share this now that I got it working.

I previously had my USB setup according to this tutorial. Actually I had it setup before reading but I verified that it was all correct with the tutorial.

I found I was able to connect to the phone using MyPhoneExplorer when running a guest session for the local desktop but not when running a desktop from a remote machine, which is the way I like to work since it provides a better experience.

After some research I found that the behavior is somewhat by design, that is you can't access some local devices from an RDP connection.

But there is a way around it. By adding the /admin switch to the RDP client it connects like the user is local. This is primarily for administrative purposes. The shortcut looks like this:

C:\Windows\System32\mstsc.exe /v:win7-delphi-xe5 /admin

Where the /v: parameter specifies the network machine name.

Once the RDP window is open you can pin a shortcut to the task bar or the start menu and it will continue to use the /admin switch to connect.

Hope this helps someone.