usb man page on DragonFly

Man page or keyword search:  
man Server   44335 pages
apropos Keyword Search (all sections)
Output format
DragonFly logo
[printable version]

USB(4)			 BSD Kernel Interfaces Manual			USB(4)

NAME
     usb — Universal Serial Bus

SYNOPSIS
     device usb

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

DESCRIPTION
     DragonFly provides machine-independent bus support and drivers for USB
     devices.

     The usb driver has three layers: 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 con‐
     troller.  Any devices attached to the bus will attach to the root hub or
     another hub attached to the USB bus.

     The uhub device will always be present as it is needed for the root hub.

   Storage devices
	   umass(4)	  Mass Storage Devices, e.g., external disk drives

   Wired network interfaces
	   aue(4)	  ADMtek AN986 Pegasus Ethernet driver
	   axe(4)	  ASIX Electronics AX88172 Ethernet driver
	   cue(4)	  CATC USB-EL1210A Ethernet driver
	   kue(4)	  Kawasaki LSI KL5KUSB101B Ethernet driver
	   rue(4)	  RealTek RTL8150 Ethernet driver

   Wireless network interfaces
	   ubt(4)	  Bluetooth adapters

   Serial and parallel interfaces
	   moscom(4)	  MosChip Semiconductor MCS7703 based serial adapters
	   uark(4)	  Arkmicro Technologies ARK3116 based serial adapters
	   ubsa(4)	  Belkin serial adapters
	   uchcom(4)	  WinChipHead CH341/CH340 serial adapters
	   ucom(4)	  tty support
	   uftdi(4)	  serial devices based on the FTDI chips
	   ugensa(4)	  generic serial device
	   ulpt(4)	  printer support
	   umct(4)	  Magic Control Technology USB-232 based serial
			  adapters
	   uplcom(4)	  Prolific PL-2303/2303X/2303HX serial adapters
	   uslcom(4)	  Silicon Laboratories CP2101, CP2102 and CP2103 USB
			  to serial bridge
	   uticom(4)	  Texas Instruments TUSB3410 RS232 to USB converter
	   uvisor(4)	  support for the Handspring Visor, a Palmpilot com‐
			  patible PDA
	   uvscom(4)	  SUNTAC Slipper U VS-10U serial adapters

   Audio devices
	   snd_uaudio(4)  audio device driver
	   urio(4)	  driver for the Rio500 MP3 player

   Radio receiver devices
	   ufm(4)	  Cypress Semiconductor FM Radio

   Human Interface Devices
	   uhid(4)	  generic driver for Human Interface Devices
	   uhidev(4)	  base driver for all Human Interface Devices
	   ukbd(4)	  keyboards that follow the boot protocol
	   ums(4)	  mouse devices

   Miscellaneous devices
	   ugen(4)	  generic device support
	   uscanner(4)	  scanner support

INTRODUCTION TO USB
     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
     devices 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
     individually addressed and the addresses are static.  Each of these end‐
     points will communicate in one of four different modes: control,
     isochronous, bulk, or interrupt.  A device always has at least one end‐
     point.  This endpoint has address 0 and is a control endpoint and is used
     to give commands to 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 keyboard
     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 different
     endpoints within it.

     A device may operate in different configurations.	Depending on the con‐
     figuration, the device may present different sets of endpoints and inter‐
     faces.

     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
	  attach.

USB CONTROLLER INTERFACE
     Use the following to get access to the USB specific structures and
     defines.

     <bus/usb/usb.h>

     The /dev/usbN 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 controller
     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_DISCOVER
	     This command will cause a complete bus discovery to be initiated.
	     If any devices attached or detached from the bus they will be
	     processed during this command.  This is the only way that new
	     devices are found on the bus.

     USB_DEVICEINFO struct usb_device_info
	     This command can be used to retrieve some information about a
	     device on the bus.	 The udi_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 reported.

	     #define USB_MAX_DEVNAMES 4
	     #define USB_MAX_DEVNAMELEN 16
	     struct usb_device_info {
		     u_int8_t	     udi_bus;
		     u_int8_t	     udi_addr;	     /* device address */
		     usb_event_cookie_t udi_cookie;
		     char	     udi_product[USB_MAX_STRING_LEN];
		     char	     udi_vendor[USB_MAX_STRING_LEN];
		     char	     udi_release[8];
		     u_int16_t	     udi_productNo;
		     u_int16_t	     udi_vendorNo;
		     u_int16_t	     udi_releaseNo;
		     u_int8_t	     udi_class;
		     u_int8_t	     udi_subclass;
		     u_int8_t	     udi_protocol;
		     u_int8_t	     udi_config;
		     u_int8_t	     udi_speed;
	     #define USB_SPEED_LOW  1
	     #define USB_SPEED_FULL 2
	     #define USB_SPEED_HIGH 3
		     int	     udi_power;	     /* power consumption in mA, 0 if selfpowered */
		     int	     udi_nports;
		     char	     udi_devnames[USB_MAX_DEVNAMES][USB_MAX_DEVNAMELEN];
		     u_int8_t	     udi_ports[16];/* hub only: addresses of devices on ports */
	     #define USB_PORT_ENABLED 0xff
	     #define USB_PORT_SUSPENDED 0xfe
	     #define USB_PORT_POWERED 0xfd
	     #define USB_PORT_DISABLED 0xfc
	     };

	     udi_bus and udi_addr contain the topological information for the
	     device.  udi_devnames contains the device names of the connected
	     drivers.  For example, the third USB Zip drive connected will be
	     umass2.  The udi_product, udi_vendor and udi_release fields con‐
	     tain self-explanatory descriptions of the device.	udi_productNo,
	     udi_vendorNo, udi_releaseNo, udi_class, udi_subclass and
	     udi_protocol contain the corresponding values from the device
	     descriptors.  The udi_config field shows the current configura‐
	     tion of the device.

	     udi_speed indicates whether the device is at low speed
	     (USB_SPEED_LOW), full speed (USB_SPEED_FULL) or high speed
	     (USB_SPEED_HIGH).	The udi_power field shows the power consump‐
	     tion in milli-amps drawn at 5 volts, or zero if the device is
	     self powered.

	     If the device is a hub, the udi_nports field is non-zero, and the
	     udi_ports field contains the addresses of the connected devices.
	     If no device 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  uds_requests[4];
	     };

	     The uds_requests field is indexed by the transfer kind, i.e.
	     UE_*, and indicates how many transfers of each kind that has been
	     completed 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 <bus/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 speci‐
     fication.	Byte sized fields can be accessed directly, but word (16 bit)
     sized fields must be access by the UGETW(field) and USETW(field, value)
     macros to handle byte order and alignment properly.

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

USB EVENT INTERFACE
     All USB events are reported via the /dev/usb device.  This devices can be
     opened for reading and each read(2) will yield an event record (if some‐
     thing has happened).  The poll(2) system call can be used to determine if
     an event record is available for reading.

     The event record has the following definition:

     struct usb_event {
	     int				 ue_type;
     #define USB_EVENT_CTRLR_ATTACH 1
     #define USB_EVENT_CTRLR_DETACH 2
     #define USB_EVENT_DEVICE_ATTACH 3
     #define USB_EVENT_DEVICE_DETACH 4
     #define USB_EVENT_DRIVER_ATTACH 5
     #define USB_EVENT_DRIVER_DETACH 6
	     struct timespec			 ue_time;
	     union {
		     struct {
			     int		 ue_bus;
		     } ue_ctrlr;
		     struct usb_device_info	 ue_device;
		     struct {
			     usb_event_cookie_t	 ue_cookie;
			     char		 ue_devname[16];
		     } ue_driver;
	     } u;
     };
     The ue_type field identifies the type of event that is described.	The
     possible events are attach/detach of a host controller, a device, or a
     device driver.  The union contains information pertinent to the different
     types of events.  Macros, USB_EVENT_IS_ATTACH(ue_type) and
     USB_EVENT_IS_DETACH(ue_type) can be used to determine if an event was an
     “attach” or a “detach” request.

     The ue_bus contains the number of the USB bus for host controller events.

     The ue_device record contains information about the device in a device
     event event.

     The ue_cookie is an opaque value that uniquely determines which device a
     device driver has been attached to (i.e., it equals the cookie value in
     the device that the driver attached to).

     The ue_devname contains the name of the device (driver) as seen in, e.g.,
     kernel messages.

     Note that there is a separation between device and device driver events.
     A device event is generated when a physical USB device is attached or
     detached.	A single USB device may have zero, one, or many device drivers
     associated with it.

SEE ALSO
     The USB specifications can be found at:

	   http://www.usb.org/developers/docs/

     ehci(4), ohci(4), pci(4), uhci(4), usbd(8), usbdevs(8)

HISTORY
     The usb driver first appeared in FreeBSD 3.0.

AUTHORS
     The usb driver was written by Lennart Augustsson ⟨augustss@carlstedt.se⟩
     for the NetBSD project.

BSD			       January 26, 2008				   BSD
[top]

List of man pages available for DragonFly

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net