1 .\" $NetBSD: uhid.4,v 1.13 2001/12/29 14:41:59 augustss Exp $
3 .\" Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
6 .\" This code is derived from software contributed to The NetBSD Foundation
7 .\" by Lennart Augustsson.
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
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.
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.
37 .Nd Raw Access to HID devices
39 To compile this driver into the kernel,
40 place the following line in your
41 kernel configuration file:
42 .Bd -ragged -offset indent
48 Alternatively, to load the driver as a
49 module at boot time, place the following line in
51 .Bd -literal -offset indent
57 driver provides a raw interface to Human Interface Devices (HIDs).
58 The reports are sent to and received from the device unmodified.
60 The device handles 2 sets of
67 .Bl -tag -width indent
68 .It Dv HID_GET_REPORT_ID Pq Vt int
69 Get the report identifier used by this HID report.
70 .It Dv HID_GET_REPORT_DESC Pq Vt "struct hidraw_gen_descriptor"
71 Get the HID report descriptor.
74 bytes of the report descriptor data into the memory
79 is set to the number of bytes copied.
81 this descriptor the exact layout and meaning of data to/from
82 the device can be found.
83 The report descriptor is delivered
84 without any processing.
86 struct hidraw_gen_descriptor {
90 uint8_t hgd_report_type;
94 .It Dv HID_SET_IMMED Pq Vt int
95 Sets the device in a mode where each
97 will return the current value of the input report.
101 will only return the data that the device reports on its
103 This call may fail if the device does not support
105 .It Dv HID_GET_REPORT Pq Vt "struct hidraw_gen_descriptor"
106 Get a report from the device without waiting for data on
110 bytes of the report data into the memory specified by
114 is set to the number of bytes copied.
117 field indicates which report is requested.
119 .Dv HID_INPUT_REPORT ,
120 .Dv HID_OUTPUT_REPORT ,
122 .Dv HID_FEATURE_REPORT .
123 On a device which uses numbered reports, the first byte of the returned data
124 is the report number.
125 The report data begins from the second byte.
126 For devices which do not use numbered reports, the report data begins at the
128 This call may fail if the device does not support this feature.
129 .It Dv HID_SET_REPORT Pq Vt "struct hidraw_gen_descriptor"
130 Set a report in the device.
133 field indicates which report is to be set.
135 .Dv HID_INPUT_REPORT ,
136 .Dv HID_OUTPUT_REPORT ,
138 .Dv HID_FEATURE_REPORT .
139 The value of the report is specified by the
144 On a device which uses numbered reports, the first byte of data to be sent is
146 The report data begins from the second byte.
147 For devices which do not use numbered reports, the report data begins at the
149 This call may fail if the device does not support this feature.
155 .Bl -tag -width indent
156 .It Dv HIDIOCGRDESCSIZE Pq Vt int
157 Get the HID report descriptor size.
158 Returns the size of the device report descriptor to use with
161 .It Dv HIDIOCGRDESC Pq Vt "struct hidraw_report_descriptor"
162 Get the HID report descriptor.
165 bytes of the report descriptor data into the memory
169 struct hidraw_report_descriptor {
171 uint8_t value[HID_MAX_DESCRIPTOR_SIZE];
174 .It Dv HIDIOCGRAWINFO Pq Vt "struct hidraw_devinfo"
175 Get structure containing the bus type, the vendor ID (VID), and product ID
176 (PID) of the device. The bus type can be one of:
180 which are defined in dev/evdev/input.h.
182 struct hidraw_devinfo {
188 .It Dv HIDIOCGRAWNAME(len) Pq Vt "char[] buf"
189 Get device description.
192 bytes of the device description previously set with
193 .Xr device_set_desc 9
194 procedure into the memory
197 .It Dv HIDIOCGRAWPHYS(len) Pq Vt "char[] buf"
198 Get the newbus path to the device.
199 .\For Bluetooth devices, it returns the hardware (MAC) address of the device.
202 bytes of the newbus device path
206 .It Dv HIDIOCGFEATURE(len) Pq Vt "void[] buf"
207 Get a feature report from the device.
210 bytes of the feature report data into the memory specified by
212 The first byte of the supplied buffer should be set to the report
213 number of the requested report.
214 For devices which do not use numbered reports, set the first byte to 0.
215 The report will be returned starting at the first byte of the buffer
216 (ie: the report number is not returned).
217 This call may fail if the device does not support this feature.
218 .It Dv HIDIOCSFEATURE(len) Pq Vt "void[] buf"
219 Set a feature Report in the device.
220 The value of the report is specified by the
225 Set the first byte of the supplied buffer to the report number.
226 For devices which do not use numbered reports, set the first byte to 0.
227 The report data begins in the second byte.
228 Make sure to set len accordingly, to one more than the length of the report
229 (to account for the report number).
230 This call may fail if the device does not support this feature.
235 to get data from the device.
236 Data should be read in chunks of the
237 size prescribed by the report descriptor.
238 On a device which uses numbered reports, the first byte of the returned data
239 is the report number.
240 The report data begins from the second byte.
241 For devices which do not use numbered reports, the report data begins at the
246 to send data to the device.
247 Data should be written in chunks of the
248 size prescribed by the report descriptor.
249 The first byte of the buffer passed to
251 should be set to the report number.
252 If the device does not use numbered reports, there are 2 operation modes:
259 mode, the first byte should be set to 0 and the report data itself should
260 begin at the second byte.
263 mode, the report data should begin at the first byte.
264 The modes can be switched with issuing one of
267 .Dv HID_GET_REPORT_DESC
273 The following variables are available as both
278 .Bl -tag -width indent
279 .It Va hw.hid.hidraw.debug
280 Debug output level, where 0 is debugging disabled and larger values increase
281 debug message verbosity.
285 .Bl -tag -width ".Pa /dev/hidraw?"
300 protocol support was added in
303 .An Vladimir Kondratyev Aq Mt wulf@FreeBSD.org .
304 This manual page was adopted from
307 .An Tom Rhodes Aq Mt trhodes@FreeBSD.org