xref: /openbsd-src/share/man/man4/uhid.4 (revision b2ea75c1b17e1a9a339660e7ed45cd24946b230e)
1.\"	$OpenBSD: uhid.4,v 1.6 2001/08/05 20:23:18 hugh Exp $
2.\"	$NetBSD: uhid.4,v 1.6 1999/05/11 21:05:09 augustss Exp $
3.\"
4.\" Copyright (c) 1999 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 uhub?"
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.Pp
56.Bl -tag -width indent -compact
57.It Dv USB_GET_REPORT_DESC (struct usb_ctl_report_desc)
58Get the HID report descriptor.  Using
59this descriptor the exact layout and meaning of data to/from
60the device can be found.  The report descriptor is delivered
61without any processing.
62.Bd -literal
63struct usb_ctl_report_desc {
64    int     size;
65    u_char  data[1024];	/* filled data size will vary */
66};
67.Ed
68.It Dv USB_SET_IMMED (int)
69Sets the device in a mode where each
70.Xr read 2
71will return the current value of the input report.  Normally
72a
73.Xr read 2
74will only return the data that the device reports on its
75interrupt pipe.  This call may fail if the device does not support
76this feature.
77.It Dv USB_GET_REPORT (struct usb_ctl_report)
78Get a report from the device without waiting for data on
79the interrupt pipe.  The
80.Fa report
81field indicates which report is requested.  It should be
82.Dv UHID_INPUT_REPORT ,
83.Dv UHID_OUTPUT_REPORT ,
84or
85.Dv UHID_FEATURE_REPORT .
86This call may fail if the device does not support
87this feature.
88.Bd -literal
89struct usb_ctl_report {
90	int report;
91	u_char	data[1024];	/* filled data size will vary */
92};
93.Ed
94.El
95.Pp
96Use
97.Xr read 2
98to get data from the device.  Data should be read in chunks of the
99size prescribed by the report descriptor.
100.Pp
101Use
102.Xr write 2
103send data to the device.  Data should be written in chunks of the
104size prescribed by the report descriptor.
105.Sh SEE ALSO
106.\" .Xr usbhidctl 1 ,
107.\" .Xr usb 3 ,
108.Xr usb 4
109.Sh HISTORY
110The
111.Nm
112driver
113appeared in
114.Ox 2.6 .
115