1.\" $OpenBSD: uhid.4,v 1.12 2004/01/05 09:30:08 jmc Exp $
2.\" $NetBSD: uhid.4,v 1.13 2001/12/29 14:41:59 augustss Exp $
3.\"
4.\" Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
5.\" All rights reserved.
6.\"
7.\" This code is derived from software contributed to The NetBSD Foundation
8.\" by Lennart Augustsson.
9.\"
10.\" Redistribution and use in source and binary forms, with or without
11.\" modification, are permitted provided that the following conditions
12.\" are met:
13.\" 1. Redistributions of source code must retain the above copyright
14.\"    notice, this list of conditions and the following disclaimer.
15.\" 2. Redistributions in binary form must reproduce the above copyright
16.\"    notice, this list of conditions and the following disclaimer in the
17.\"    documentation and/or other materials provided with the distribution.
18.\" 3. All advertising materials mentioning features or use of this software
19.\"    must display the following acknowledgement:
20.\"        This product includes software developed by the NetBSD
21.\"        Foundation, Inc. and its contributors.
22.\" 4. Neither the name of The NetBSD Foundation nor the names of its
23.\"    contributors may be used to endorse or promote products derived
24.\"    from this software without specific prior written permission.
25.\"
26.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36.\" POSSIBILITY OF SUCH DAMAGE.
37.\"
38.Dd July 12, 1998
39.Dt UHID 4
40.Os
41.Sh NAME
42.Nm uhid
43.Nd USB generic HID support
44.Sh SYNOPSIS
45.Cd "uhid* at uhidev? reportid ?"
46.Sh DESCRIPTION
47The
48.Nm
49driver provides support for all HID (Human Interface Device) interfaces
50in USB devices that do not have a special driver.
51.Pp
52The device handles the following
53.Xr ioctl 2
54calls:
55.Bl -tag -width indent
56.It Dv USB_GET_REPORT_ID (int)
57Get the report identifier used by this HID report.
58.It Dv USB_GET_REPORT_DESC (struct usb_ctl_report_desc)
59Get the HID report descriptor.
60Using this descriptor the exact layout and meaning of data to/from
61the device can be found.
62The report descriptor is delivered without any processing.
63.Bd -literal
64struct usb_ctl_report_desc {
65    int     size;
66    u_char  data[1024];	/* filled data size will vary */
67};
68.Ed
69.It Dv USB_SET_IMMED (int)
70Sets the device in a mode where each
71.Xr read 2
72will return the current value of the input report.
73Normally a
74.Xr read 2
75will only return the data that the device reports on its
76interrupt pipe.
77This call may fail if the device does not support this feature.
78.It Dv USB_GET_REPORT (struct usb_ctl_report)
79Get a report from the device without waiting for data on
80the interrupt pipe.
81The
82.Fa report
83field indicates which report is requested.
84It should be
85.Dv UHID_INPUT_REPORT ,
86.Dv UHID_OUTPUT_REPORT ,
87or
88.Dv UHID_FEATURE_REPORT .
89This call may fail if the device does not support this feature.
90.Bd -literal
91struct usb_ctl_report {
92	int report;
93	u_char	data[1024];	/* used data size will vary */
94};
95.Ed
96.It Dv USB_SET_REPORT (struct usb_ctl_report)
97Set a report in the device.
98The
99.Dv report
100field indicates which report is to be set.
101It should be
102.Dv UHID_INPUT_REPORT ,
103.Dv UHID_OUTPUT_REPORT ,
104or
105.Dv UHID_FEATURE_REPORT .
106This call may fail if the device does not support this feature.
107.El
108.Pp
109Use
110.Xr read 2
111to get data from the device.
112Data should be read in chunks of the size prescribed by the report descriptor.
113.Pp
114Use
115.Xr write 2
116send data to the device.
117Data should be written in chunks of the size prescribed by the report
118descriptor.
119.Sh SEE ALSO
120.Xr usbhidctl 1 ,
121.Xr usbhid 3 ,
122.Xr intro 4 ,
123.Xr uhidev 4 ,
124.Xr usb 4
125.Sh HISTORY
126The
127.Nm
128driver
129appeared in
130.Ox 2.6 .
131