xref: /netbsd-src/share/man/man4/uhid.4 (revision 23c8222edbfb0f0932d88a8351d3a0cf817dfb9e)
1.\" $NetBSD: uhid.4,v 1.18 2004/05/11 23:23:20 wiz 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.\" 3. All advertising materials mentioning features or use of this software
18.\"    must display the following acknowledgement:
19.\"        This product includes software developed by the NetBSD
20.\"        Foundation, Inc. and its contributors.
21.\" 4. Neither the name of The NetBSD Foundation nor the names of its
22.\"    contributors may be used to endorse or promote products derived
23.\"    from this software without specific prior written permission.
24.\"
25.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
26.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
29.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35.\" POSSIBILITY OF SUCH DAMAGE.
36.\"
37.Dd May 8, 2004
38.Dt UHID 4
39.Os
40.Sh NAME
41.Nm uhid
42.Nd USB generic HID support
43.Sh SYNOPSIS
44.Cd "uhid* at uhidev? reportid ?"
45.Sh DESCRIPTION
46The
47.Nm
48driver provides support for all HID (Human Interface Device) interfaces
49in USB devices that do not have a special driver.
50.Pp
51The device handles the following
52.Xr ioctl 2
53calls:
54.Pp
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     ucrd_size;
66    u_char  ucrd_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.Dv 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     ucr_report;
93	u_char	ucr_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.It Dv USB_GET_DEVICEINFO (struct usb_device_info)
108Get an information summary for the device.
109This call will not issue any USB transactions.
110.It Dv USB_GET_STRING_DESC (struct usb_string_desc)
111Get a string descriptor for the given language id and
112string index.
113.Bd -literal
114struct usb_string_desc {
115	int	usd_string_index;
116	int	usd_language_id;
117	usb_string_descriptor_t usd_desc;
118};
119.Ed
120.El
121.Pp
122Use
123.Xr read 2
124to get data from the device.
125Data should be read in chunks of the size prescribed by the report
126descriptor.
127.Pp
128Use
129.Xr write 2
130send data to the device.
131Data should be written in chunks of the size prescribed by the
132report descriptor.
133.Sh FILES
134.Bl -tag -width Pa
135.It Pa /dev/uhid?
136.El
137.Sh SEE ALSO
138.Xr usbhidaction 1 ,
139.Xr usbhidctl 1 ,
140.Xr uhidev 4 ,
141.Xr usb 4
142.Sh HISTORY
143The
144.Nm
145driver
146appeared in
147.Nx 1.4 .
148Support for the
149.Dv USB_GET_DEVICEINFO
150and
151.Dv USB_GET_STRING_DESC
152ioctls appeared in
153.Nx 2.0 .
154