USB on FreeBSD
/Peripherals/Serial /USBPeriphAPI |
Contents
USB is short for Universial Serial BUS. There are currently five variants of USB. The USB stack in FreeBSD -current supports Low-, Full-, High- and Super- speed USB devices in Host- and Device Mode.
- Low Speed USB
- Full Speed USB
- High Speed USB
- Super Speed USB
- Wireless USB (not supported yet)
Debugging USB
If you want very verbose messages, you can set the following variables in loader.conf
hw.usb.ehci.iaadbug=1 hw.usb.ehci.debug=1 hw.usb.xhci.debug=1
usbconfig gives you information on your devices. If you run it with the list argument, or no argument it prints a list of your devices.
$ sudo usbconfig ugen0.1: <0x8086 XHCI root HUB> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=SAVE (0mA) ugen1.1: <Intel EHCI root HUB> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA) ugen1.2: <vendor 0x8087 product 0x8000> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA) ugen0.2: <Microsoft Wired Keyboard 600> at usbus0, cfg=0 md=HOST spd=LOW (1.5Mbps) pwr=ON (100mA) ugen0.3: <VXIS Inc FHD Webcamera> at usbus0, cfg=255 md=HOST spd=SUPER (5.0Gbps) pwr=ON (100mA)
You can get more detailed information on your devices with the dump_all_desc command. Note the addressing after the -d arg, this is the common format for most commands, you can use either ugen0.3, or just 0.3.
$ sudo usbconfig -d 0.3 dump_all_desc ugen0.3: <VXIS Inc FHD Webcamera> at usbus0, cfg=255 md=HOST spd=SUPER (5.0Gbps) pwr=ON (100mA) bLength = 0x0012 bDescriptorType = 0x0001 bcdUSB = 0x0310 bDeviceClass = 0x00ef <Miscellaneous device> bDeviceSubClass = 0x0002 bDeviceProtocol = 0x0001 bMaxPacketSize0 = 0x0009 idVendor = 0x1bcf idProduct = 0x2c99 bcdDevice = 0x0200 iManufacturer = 0x0001 <VXIS Inc> iProduct = 0x0002 <FHD Webcamera> iSerialNumber = 0x0000 <no string> bNumConfigurations = 0x0001
The key take away points here (other than obvious things like the power setting) are:
- The cfg=255 from usbconfig indicates that the device was not initialized correctly.
- idVendor and idProduct (not iProduct) are the vendor and product ids, used in a number of places like setting quirks
HPSUSB FAQ
- Q: I see the following error and USB stops working "Page offset was not preserved!"
- A: Update your sources, this issue is fixed.
- Q: I can't boot my Freesbie using USB2.
- A: Update your sources, this issue is fixed.
- Q: Screen updates in X11 are slow/broken/laggy
- A: Ensure your kernel/world is up to date, old libs removed and the libpciaccess port is rebuilt.
- Q: My mass storage device is not working, what can I do?
- A: If your mass storage device needs a quirk, because it does not conform to the SCSI specification you can add it in the following way:
# 1) Unload "umass" if it is loaded. # 2) Plug your device. # 3) You might have to add a new entry for your device in /sys/dev/usb/usbdevs . # 4) To get the VID+PID for your device you run "usbconfig -u X -a Y dump_device_desc" # where X and Y are the numbers reported by ugen. # For example: usbconfig -u 4 -a 7 dump_device_desc # 5) Try adding an entry in the quirktable in /sys/dev/usb/quirk/usb_quirk.c . # Look at the other quirks for examples.