xref: /freebsd/share/man/man4/usb.4 (revision 0275f9dbf73b01e9478dc7d6ab5fab4f8e077448)
1.\" Copyright (c) 1997, 1998 Nick Hibma <n_hibma@FreeBSD.org>
2.\" Copyright (c) 2008 Hans Petter Selasky. All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\"
13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.\" $FreeBSD$
26.\"
27.Dd August 3, 2017
28.Dt USB 4
29.Os
30.Sh NAME
31.Nm usb
32.Nd Universal Serial Bus
33.Sh SYNOPSIS
34To compile this driver into the kernel,
35place the following line in your
36kernel configuration file:
37.Bd -ragged -offset indent
38.Cd "device usb"
39.Ed
40.Pp
41Alternatively, to load the driver as a
42module at boot time, place the following line in
43.Xr loader.conf 5 :
44.Bd -literal -offset indent
45usb_load="YES"
46.Ed
47.Sh USERLAND PROGRAMMING
48USB functions can be accessed from userland through the libusb library.
49See
50.Xr libusb 3
51for more information.
52.Sh DESCRIPTION
53.Fx
54provides machine-independent bus support and drivers for
55.Tn USB
56devices in host and device side mode.
57.Pp
58The
59.Nm
60driver has three layers:
61.Bl -tag -width 6n -offset indent
62.It USB Controller (Bus)
63.It USB Device
64.It USB Driver
65.El
66.Pp
67The controller attaches to a physical bus
68like
69.Xr pci 4 .
70The
71.Tn USB
72bus attaches to the controller, and the root hub attaches
73to the controller.
74Any devices attached to the bus will attach to the root hub
75or another hub attached to the
76.Tn USB
77bus.
78.Pp
79The
80.Nm uhub
81device will always be present as it is needed for the root hub.
82.Sh INTRODUCTION TO USB
83The
84.Tn USB
85is a system where external devices can be connected to a PC.
86The most common USB speeds are:
87.Bl -tag -width 6n -offset indent
88.It Low Speed (1.5MBit/sec)
89.It Full Speed (12MBit/sec)
90.It High Speed (480MBit/sec)
91.El
92.Pp
93Each
94.Tn USB
95has a USB controller that is the master of the bus.
96The physical communication is simplex which means the host controller only
97communicates with one USB device at a time.
98.Pp
99There can be up to 127 devices connected to an USB HUB tree.
100The addresses are assigned dynamically by the host when each device is
101attached to the bus.
102.Pp
103Within each device there can be up to 16 endpoints.
104Each endpoint is individually addressed and the addresses are static.
105Each of these endpoints will communicate in one of four different modes:
106.Em control , isochronous , bulk ,
107or
108.Em interrupt .
109A device always has at least one endpoint.
110This endpoint has address 0 and is a control endpoint and is used to give
111commands to and extract basic data, such as descriptors, from the device.
112Each endpoint, except the control endpoint, is unidirectional.
113.Pp
114The endpoints in a device are grouped into interfaces.
115An interface is a logical unit within a device, e.g., a compound device with
116both a keyboard and a trackball, would present one interface for each.
117An interface can sometimes be set into different modes, called alternate
118settings, which affects how it operates.
119Different alternate settings can have different endpoints within it.
120.Pp
121A device may operate in different configurations.
122Depending on the configuration, the device may present different sets of
123endpoints and interfaces.
124.Pp
125The bus enumeration of the
126.Tn USB
127bus proceeds in several steps:
128.Bl -enum
129.It
130Any interface specific driver can attach to the device.
131.It
132If none is found, generic interface class drivers can attach.
133.El
134.Sh MIB Variables
135The
136.Nm
137driver exposes the following variables in the
138.Va hw.usb
139branch of the
140.Xr sysctl 3
141MIB:
142.Bl -tag -width ".Va debug"
143.It Va debug
144Debug output level, where 0 is debugging disabled and larger values increase
145debug message verbosity.
146Default is 0.
147.Sh SEE ALSO
148The
149.Tn USB
150specifications can be found at:
151.Pp
152.D1 Pa http://www.usb.org/developers/docs/
153.Pp
154.Xr libusb 3 ,
155.Xr aue 4 ,
156.Xr axe 4 ,
157.Xr axge 4 ,
158.Xr cue 4 ,
159.Xr ehci 4 ,
160.Xr kue 4 ,
161.Xr mos 4 ,
162.Xr ohci 4 ,
163.Xr pci 4 ,
164.Xr rue 4 ,
165.Xr ucom 4 ,
166.Xr udav 4 ,
167.Xr uhci 4 ,
168.Xr uhid 4 ,
169.Xr ukbd 4 ,
170.Xr ulpt 4 ,
171.Xr umass 4 ,
172.Xr ums 4 ,
173.Xr uplcom 4 ,
174.Xr urio 4 ,
175.Xr uvscom 4 ,
176.Xr xhci 4
177.Xr usbconfig 8 ,
178.Xr usbdi 9 ,
179.Sh STANDARDS
180The
181.Nm
182module complies with the USB 2.0 standard.
183.Sh HISTORY
184The
185.Nm
186module has been inspired by the
187.Nx
188USB stack initially written by
189.An Lennart Augustsson .
190The
191.Nm
192module was written by
193.An Hans Petter Selasky Aq Mt hselasky@FreeBSD.org .
194