MirBSD manpage: uhub(4), usb(4)

USB(4)                     BSD Programmer's Manual                      USB(4)


     usb - introduction to Universal Serial Bus support


     uhci*   at pci? dev ? function ?
     ohci*   at pci? dev ? function ?
     usb*    at uhci? flags 0x00
     usb*    at ohci? flags 0x00
     uhub*   at usb?
     uhub*   at uhub? port ? configuration ? interface ? vendor ?

     #include <dev/usb/usb.h>
     #include <dev/usb/usbhid.h>


     OpenBSD provides machine-independent bus support and drivers for Univer-
     sal Serial Bus (USB) devices.

     The OpenBSD usb driver has three layers (like scsi(4) and pcmcia(4)): the
     controller, the bus, and the device layer. The controller attaches to a
     physical bus (like pci(4)). The USB bus attaches to the controller and
     the root hub attaches to the controller. Further devices, which may in-
     clude further hubs, attach to other hubs. The attachment forms the same
     tree structure as the physical USB device tree. For each USB device there
     may be additional drivers attached to it.

     The uhub device controls USB hubs and must always be present since there
     is at least one root hub in any USB system.

     The flags are used to specify if the devices on the USB bus should be
     probed early in the boot process. If the flags are specified with a value
     of 1, the USB bus will be probed when the USB host device is attached in-
     stead of waiting until kernel processes start running. This is useful for
     USB console keyboards so that the keyboard is attached before getting the
     root prompt on "boot -a".


     OpenBSD includes machine-independent USB drivers, sorted by device type
     and driver name:

Storage devices

             USB Mass Storage Devices, e.g., external disk drives.

Ethernet adapters

             ADMtek AN986 / ADM8511 Pegasus family USB Ethernet interfaces.
             ASIX Electronics AX88172 USB Ethernet interfaces.
             CATC USB-EL1201A-based Ethernet interfaces.
             Kawasaki LSI KL5KUSB101B-based Ethernet interfaces.
             Realtek RTL8150L-based Ethernet interfaces.
             WaveLAN/IEEE, PRISM 2-3 and Spectrum24 802.11DS wireless network

Serial and parallel interfaces

             Belkin serial adapters.
             Serial port-like devices.
             FTDI FT8U100AX-based serial adapters.
             USB Printers.
             MCT USB-RS232 serial adapters.
             USB Modems.
             Prolific PL-2303 serial adapters.
             SUNTAC Slipper U VS-10U serial adapters.

Audio devices

             Audio devices.
             USB MIDI devices.
             Diamond Multimedia Rio MP3 players.

Radio receiver devices

             D-Link DSB-R100 USB radio.

Human Interface Devices

             Generic driver for Human Interface Devices.
             Base driver for all Human Interface Devices.
             USB keyboards that follow the boot protocol.
             USB mouse devices.

Miscellaneous devices

             Generic driver for unknown USB devices.
             Prolific based host-to-host adapters.
             USB scanners.
             SCSI-over-USB scanners.
             Handspring Visor.
             YAP phone firmware loader.


     The USB is a 12 Mb/s serial bus (1.5 Mb/s for low speed devices). Each
     USB has a host controller that is the master of the bus; all other dev-
     ices on the bus only speak when spoken to.

     There can be up to 127 devices (apart from the host controller) on a bus,
     each with its own address. The addresses are assigned dynamically by the
     host when each device is attached to the bus.

     Within each device there can be up to 16 endpoints. Each endpoint is in-
     dividually addressed and the addresses are static. Each of these end-
     points will communicate in one of four different modes: control, isochro-
     nous, bulk, or interrupt. A device always has at least one endpoint. This
     is a control endpoint at address 0 and is used to give commands to the
     device and extract basic data, such as descriptors, from the device. Each
     endpoint, except the control endpoint, is unidirectional.

     The endpoints in a device are grouped into interfaces. An interface is a
     logical unit within a device; e.g., a compound device with both a key-
     board and a trackball would present one interface for each. An interface
     can sometimes be set into different modes, called alternate settings,
     which affects how it operates. Different alternate settings can have dif-
     ferent endpoints within it.

     A device may operate in different configurations. Depending on the confi-
     guration the device may present different sets of endpoints and inter-

     Each device located on a hub has several config(8) locators:

     port           Number of the port on closest upstream hub.
     configuration  Configuration the device must be in for this driver to at-
                    tach. This locator does not set the configuration; it is
                    iterated by the bus enumeration.
     interface      Interface number within a device that an interface driver
                    attaches to.
     vendor         16-bit vendor ID of the device.
     product        16-bit product ID of the device.
     release        16-bit release (revision) number of the device.

     The first locator can be used to pin down a particular device according
     to its physical position in the device tree. The last three locators can
     be used to pin down a particular device according to what device it actu-
     ally is.

     The bus enumeration of the USB bus proceeds in several steps:

     1.   Any device-specific driver can attach to the device.

     2.   If none is found, any device class specific driver can attach.

     3.   If none is found, all configurations are iterated over. For each
          configuration all the interfaces are iterated over and interface
          drivers can attach. If any interface driver attached in a certain
          configuration, the iteration over configurations is stopped.

     4.   If still no drivers have been found, the generic USB driver can at-


     Use the following to get access to the USB specific structures and de-
     fines. #include <dev/usb/usb.h>

     The /dev/usbN device can be opened and a few operations can be performed
     on it. The poll(2) system call will say that I/O is possible on the con-
     troller device when a USB device has been connected or disconnected to
     the bus.

     The following ioctl(2) commands are supported on the controller device:

     USB_DEVICEINFO struct usb_device_info
             This command can be used to retrieve some information about a
             device on the bus. The addr field should be filled before the
             call and the other fields will be filled by information about the
             device on that address. Should no such device exist an error is

             struct usb_device_info {
                     uByte   addr;           /* device address */
                     char    product[USB_MAX_STRING_LEN];
                     char    vendor[USB_MAX_STRING_LEN];
                     char    release[8];
                     uByte   class;
                     uByte   config;
                     uByte   lowspeed;
                     int     power;
                     int     nports;
                     uByte   ports[16];
             #define USB_PORT_ENABLED 0xff
             #define USB_PORT_SUSPENDED 0xfe
             #define USB_PORT_POWERED 0xfd
             #define USB_PORT_DISABLED 0xfc

             The product, vendor, and release fields contain self-explanatory
             descriptions of the device.

             The class field contains the device class.

             The config field shows the current configuration of the device.

             The lowspeed field is set if the device is a USB low speed dev-

             The power field shows the power consumption in milli-amps drawn
             at 5 volts, or zero if the device is self powered.

             If the device is a hub the nports field is non-zero and the ports
             field contains the addresses of the connected devices. If no dev-
             ice is connected to a port one of the USB_PORT_* values indicates
             its status.

     USB_DEVICESTATS struct usb_device_stats
             This command retrieves statistics about the controller.

             struct usb_device_stats {
                     u_long  requests[4];

             The requests field is indexed by the transfer kind, i.e. UE_*,
             and indicates how many transfers of each kind that has been com-
             pleted by the controller.

     USB_REQUEST struct usb_ctl_request
             This command can be used to execute arbitrary requests on the
             control pipe. This is DANGEROUS and should be used with great
             care since it can destroy the bus integrity.

     The include file <dev/usb/usb.h> contains definitions for the types used
     by the various ioctl(2) calls. The naming convention of the fields for
     the various USB descriptors exactly follows the naming in the USB specif-
     ication. Byte sized fields can be accessed directly, but word (16-bit)
     sized fields must be accessed by the UGETW(field) and USETW(field, value)
     macros to handle byte order and alignment properly.

     The include file <dev/usb/usbhid.h> similarly contains the definitions
     for Human Interface Devices (HID).


     aue(4), axe(4), cardbus(4), cue(4), intro(4), isa(4), isapnp(4), kue(4),
     pci(4), pcmcia(4), uaudio(4), ubsa(4), ucom(4), udsbr(4), uftdi(4),
     ugen(4), uhid(4), uhidev(4), uhub(4), ukbd(4), ulpt(4), umass(4),
     umct(4), umidi(4), umodem(4), ums(4), upl(4), uplcom(4), urio(4), url(4),
     uscanner(4), usscanner(4), uvisor(4), uvscom(4), uyap(4), wi(4),
     usbdevs(8), usbhidaction(8), usbhidctl(8)

     The USB specifications can be found at:



     The usb driver appeared in OpenBSD 2.6.


     There should be a serial number locator, but OpenBSD does not have string
     valued locators.

MirBSD #10-current              July 12, 1998                                4

Generated on 2022-12-24 01:00:14 by $MirOS: src/scripts/roff2htm,v 1.113 2022/12/21 23:14:31 tg Exp $ — This product includes material provided by mirabilos.

These manual pages and other documentation are copyrighted by their respective writers; their sources are available at the project’s CVSweb, AnonCVS and other mirrors. The rest is Copyright © 2002–2022 MirBSD.

This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report — diffs preferred.

Kontakt / Impressum & Datenschutzerklärung