xref: /freebsd/share/man/man4/usb_template.4 (revision e5b786625f7f82a1fa91e41823332459ea5550f9)
1.\"
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.Dd August 7, 2019
26.Dt USB_TEMPLATE 4
27.Os
28.
29.Sh NAME
30.
31.
32.Nm usb_template
33.
34.Nd "USB device side templates"
35.
36.
37.Sh SYNOPSIS
38To compile this module into the kernel, place the following line in
39your kernel configuration file:
40.Bd -ragged -offset indent
41.Cd "device usb_template"
42.Ed
43.Pp
44To load the module at boot time, place the following line in
45.Xr loader.conf 5 :
46.Bd -literal -offset indent
47usb_template_load="YES"
48.Ed
49.
50.Sh DESCRIPTION
51The
52.Nm
53module implements various USB templates that are needed when
54programming an USB device side driver.
55.
56A USB template consists of an USB device descriptor, one or more USB
57configuration descriptors, one or more USB interface descriptors, one
58or more USB endpoint descriptors, USB strings and additional USB
59descriptors.
60.
61USB templates are selected using the
62.Va hw.usb.template
63sysctl and tunable,
64or by using the
65.Xr usbconfig 8
66.Cm set_template
67subcommand.
68Changing the
69.Va hw.usb.template
70sysctl triggers reenumeration by the USB host; changes to other sysctls
71may not be visible to the host until reenumeration is performed.
72.Pp
73Available templates are:
74.Bl -column -offset 3n "Value"
75.It Em Value Ta Em Description
76.It Dv 0 Ta USB Mass Storage, see
77.Xr cfumass 4
78.It Dv 1 Ta CDC Ethernet, see
79.Xr cdce 4
80.It Dv 2 Ta Media Transfer Protocol (MTP)
81.It Dv 3 Ta USB serial port, see
82.Xr umodem 4
83.It Dv 4 Ta USB audio
84.It Dv 5 Ta USB keyboard
85.It Dv 6 Ta USB mouse
86.It Dv 7 Ta USB phone
87.It Dv 8 Ta CDC Ethernet and serial port
88.It Dv 9 Ta USB MIDI
89.It Dv 10 Ta CDC Ethernet, serial port, and storage
90.It Dv 11 Ta CDC Ethernet Emulation Model, see
91.Xr cdceem 4
92.El
93.
94.Sh SYSCTL VARIABLES
95The following variables are available as both
96.Xr sysctl 8
97variables and
98.Xr loader 8
99tunables:
100.Bl -tag -width indent
101.It Va hw.usb.template
102Currently selected template.
103Set to -1 to make the device disappear from the USB host point of view.
104.It Va hw.usb.template_power
105USB bus power consumption in mA at 5V.
106Must be between 0 and 500.
107Setting to 0 marks the device as self-powered.
108Defaults to 500mA.
109.It Va hw.usb.templates.N
110Configuration for template number
111.Va N .
112.It Va hw.usb.templates.N.vendor_id
11316-bit vendor identifier (VID), usually assigned by USB-IF.
114.It Va hw.usb.templates.N.product_id
11516-bit product identifier (PID).
116.It Va hw.usb.templates.N.manufacturer
117String containing human-readable manufacturer name.
118.It Va hw.usb.templates.N.product
119String containing human-readable product name.
120.El
121.Sh SEE ALSO
122.Xr cfumass 4 ,
123.Xr usb 4 ,
124.Xr usfs 4 ,
125.Xr usbconfig 8
126.Sh STANDARDS
127The
128.Nm
129module complies to the USB 1.0, 2.0 and 3.0 standard.
130.Sh HISTORY
131The
132.Nm
133module was written by
134.An Hans Petter Selasky Aq Mt hselasky@FreeBSD.org .
135