How to use FreeBSD, VirtualBox and USB2.0 Devices

Posted by Benjamin Close on March 1, 2012 under FreeBSD | 3 Comments to Read

This page explains how to use a USB2.0 device in VirtualBox with a FreeBSD 8+ as a hostOS

Recently I got around to converting my last Linux box over to FreeBSD. The change over for almost everything was smooth except for one thing. A windows virtual machine. I have a number of applications which sadly are Windows only applications, one is accounting package.

One requirement of this package is the need to print. This worked under Linux so I think twice when I finally nuked the Linux partition. Sadly I soon found that my USB printer did not work under the VirtualBox VM under FreeBSD. 
It was crazy. I’d followed the guide about enabling USB support under FreeBSD with virtual box at  http://wiki.freebsd.org/VirtualBox and other USB devices worked fine. FreeBSD was able to see the device (usbconfig) showed it clearly. Even Virtual Box was able to see the device. The crazy thing was even Windows was able to see the device. However, no matter how much driver updating, plugging, replugging I did windows would show the printer existed but kept putting a yellow triangle next to it indicating it needed ‘Trouble Shooting’.  I was lost.

I left things this way for over a month. Until I had no choice but to print. Hence I had to fix the issue. 

I tried lots of things:

  • Different USB Ports
  • Hubs
  • Resetting the printer
  • Reinstalling the drivers
  • Deleting the driver
  • upgrading the driver

At one point I even noticed that the printer was being recognised by the FreeBSD ulpt driver and I thought that could be a problem so tried to disable that. Alas nothing.

It wasn’t until I noticed that USB2.0 was deselected in Virtualbox that it all made sense. I clicked the tick box and got a dialog complaining that USB2.0 could not be enabled due to a missing extension pack. A look at Virtual box’s website indicated there was one for all platforms.. it didn’t work on FreeBSD. A quick google search revealed it’s got native binaries that don’t work under FreeBSD.

Hence I was again at a loss. Then it occurred to me, could I force the printer to negotiate at usb1 or usb1.1 speeds? A lot of google searching revealed nothing, I looked at using usbconfig, usbdevs all proved pointless until I found this post.

My printer was definitely running USB2, usbconfig confirmed it:

ugen4.3: <Samsung CLP-500 Series SAMSUNG ELECTRONICS CO., LTD> at usbus4, cfg=255 md=HOST spd=HIGH (480Mbps) pwr=ON

It’s from the writer of the Virtualbox FreeBSD usb driver (and also the FreeBSD usb maintainer as well). Turns out that USB2/2.0 devices may not work without the Virtualbox Extension pack hence the following sysctl needs to be run in order to convert USB2 devices to 1.1

sysctl hw.usb.ehci.no_hs=1

This converted my printer to a USB1.1 device (or a FULL speed device ) after replugging and windows was all happy!
You can confirm the device change using the command usbconfig 

ugen2.4: <Samsung CLP-500 Series SAMSUNG ELECTRONICS CO., LTD> at usbus2, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON

So if you find yourself using FreeBSD and have a device that doesn’t seem to work correctly, give the above a shot and see if it solves your issue too!



Donations keep this site alive

  • Using USB under FreeBSD / VirtualBox « Thinking too much said,

    […] the rescue, many hours of googling by this kind soul. Turns out if FreeBSD’s kernel recognises the device as USB 2.0, the pass-through to […]

  • Julien said,

    How can I turn back sysct to its original state?

  • Update The Belkin Router Firmware said,

    The software will automatically find USB devices shared by VirtualHere USB Servers on the network. Available USB devices will be displayed in a tree. Right click on the device you want to use and select Use. It will then appear to be directly connected to your machine and can be used just like a local device!

Add A Comment

*