]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/man/man4/uhid.4
geom_uzip(4): fix a typo
[FreeBSD/FreeBSD.git] / share / man / man4 / uhid.4
1 .\" $NetBSD: uhid.4,v 1.13 2001/12/29 14:41:59 augustss Exp $
2 .\"
3 .\" Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
5 .\"
6 .\" This code is derived from software contributed to The NetBSD Foundation
7 .\" by Lennart Augustsson.
8 .\"
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
11 .\" are met:
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\"    notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\"    notice, this list of conditions and the following disclaimer in the
16 .\"    documentation and/or other materials provided with the distribution.
17 .\"
18 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 .\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 .\" POSSIBILITY OF SUCH DAMAGE.
29 .\"
30 .\" $FreeBSD$
31 .\"
32 .Dd Oct 31, 2020
33 .Dt UHID 4
34 .Os
35 .Sh NAME
36 .Nm uhid
37 .Nd USB generic HID support
38 .Sh SYNOPSIS
39 To compile this driver into the kernel,
40 place the following line in your
41 kernel configuration file:
42 .Bd -ragged -offset indent
43 .Cd "device uhid"
44 .Cd "device hid"
45 .Cd "device usb"
46 .Ed
47 .Pp
48 Alternatively, to load the driver as a
49 module at boot time, place the following line in
50 .Xr loader.conf 5 :
51 .Bd -literal -offset indent
52 uhid_load="YES"
53 .Ed
54 .Sh DESCRIPTION
55 The
56 .Nm
57 driver provides support for all HID (Human Interface Device) interfaces
58 in USB devices that do not have a special driver.
59 .Pp
60 The device handles the following
61 .Xr ioctl 2
62 calls:
63 .Bl -tag -width indent
64 .It Dv USB_GET_REPORT_ID Pq Vt int
65 Get the report identifier used by this HID report.
66 .It Dv USB_GET_REPORT_DESC Pq Vt "struct usb_gen_descriptor"
67 Get the HID report descriptor.
68 Copies a maximum of
69 .Va ugd_maxlen
70 bytes of the report descriptor data into the memory
71 specified by
72 .Va ugd_data .
73 Upon return
74 .Va ugd_actlen
75 is set to the number of bytes copied.
76 Using
77 this descriptor the exact layout and meaning of data to/from
78 the device can be found.
79 The report descriptor is delivered
80 without any processing.
81 .Bd -literal
82 struct usb_gen_descriptor {
83         void   *ugd_data;
84         uint16_t ugd_maxlen;
85         uint16_t ugd_actlen;
86         uint8_t ugd_report_type;
87         ...
88 };
89 .Ed
90 .It Dv USB_SET_IMMED Pq Vt int
91 Sets the device in a mode where each
92 .Xr read 2
93 will return the current value of the input report.
94 Normally
95 a
96 .Xr read 2
97 will only return the data that the device reports on its
98 interrupt pipe.
99 This call may fail if the device does not support
100 this feature.
101 .It Dv USB_GET_REPORT Pq Vt "struct usb_gen_descriptor"
102 Get a report from the device without waiting for data on
103 the interrupt pipe.
104 Copies a maximum of
105 .Va ugd_maxlen
106 bytes of the report data into the memory specified by
107 .Va ugd_data .
108 Upon return
109 .Va ugd_actlen
110 is set to the number of bytes copied.
111 The
112 .Va ugd_report_type
113 field indicates which report is requested.
114 It should be
115 .Dv UHID_INPUT_REPORT ,
116 .Dv UHID_OUTPUT_REPORT ,
117 or
118 .Dv UHID_FEATURE_REPORT .
119 This call may fail if the device does not support this feature.
120 .It Dv USB_SET_REPORT Pq Vt "struct usb_gen_descriptor"
121 Set a report in the device.
122 The
123 .Va ugd_report_type
124 field indicates which report is to be set.
125 It should be
126 .Dv UHID_INPUT_REPORT ,
127 .Dv UHID_OUTPUT_REPORT ,
128 or
129 .Dv UHID_FEATURE_REPORT .
130 The value of the report is specified by the
131 .Va ugd_data
132 and the
133 .Va ugd_maxlen
134 fields.
135 This call may fail if the device does not support this feature.
136 .It Dv USB_GET_DEVICEINFO Pq Vt "struct usb_device_info"
137 Returns information about the device, like USB vendor ID and USB product ID.
138 This call will not issue any USB transactions.
139 Also refer to
140 .Xr ugen 4 .
141 .El
142 .Pp
143 Use
144 .Xr read 2
145 to get data from the device.
146 Data should be read in chunks of the
147 size prescribed by the report descriptor.
148 .Pp
149 Use
150 .Xr write 2
151 to send data to the device.
152 Data should be written in chunks of the
153 size prescribed by the report descriptor.
154 .Sh SYSCTL VARIABLES
155 The following variables are available as both
156 .Xr sysctl 8
157 variables and
158 .Xr loader 8
159 tunables:
160 .Bl -tag -width indent
161 .It Va hw.usb.uhid.debug
162 Debug output level, where 0 is debugging disabled and larger values increase
163 debug message verbosity.
164 Default is 0.
165 .El
166 .Sh FILES
167 .Bl -tag -width ".Pa /dev/uhid?"
168 .It Pa /dev/uhid?
169 .El
170 .Sh SEE ALSO
171 .Xr usbhidctl 1 ,
172 .Xr usb 4
173 .Sh HISTORY
174 The
175 .Nm
176 driver
177 appeared in
178 .Nx 1.4 .
179 This manual page was adopted from
180 .Nx
181 by
182 .An Tom Rhodes Aq Mt trhodes@FreeBSD.org
183 in April 2002.