1.\" $OpenBSD: uhid.4,v 1.16 2010/07/10 20:40:34 gilles 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.\" 19.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29.\" POSSIBILITY OF SUCH DAMAGE. 30.\" 31.Dd $Mdocdate: July 10 2010 $ 32.Dt UHID 4 33.Os 34.Sh NAME 35.Nm uhid 36.Nd USB generic HID support 37.Sh SYNOPSIS 38.Cd "uhid* at uhidev?" 39.Sh DESCRIPTION 40The 41.Nm 42driver provides support for all HID (Human Interface Device) interfaces 43in USB devices that do not have a special driver. 44.Pp 45The device handles the following 46.Xr ioctl 2 47calls: 48.Bl -tag -width indent 49.It Dv USB_GET_REPORT_ID (int) 50Get the report identifier used by this HID report. 51.It Dv USB_GET_REPORT_DESC (struct usb_ctl_report_desc) 52Get the HID report descriptor. 53Using this descriptor the exact layout and meaning of data to/from 54the device can be found. 55The report descriptor is delivered without any processing. 56.Bd -literal 57struct usb_ctl_report_desc { 58 int ucrd_size; 59 u_char ucrd_data[1024]; /* filled data size will vary */ 60}; 61.Ed 62.It Dv USB_SET_IMMED (int) 63Sets the device in a mode where each 64.Xr read 2 65will return the current value of the input report. 66Normally a 67.Xr read 2 68will only return the data that the device reports on its 69interrupt pipe. 70This call may fail if the device does not support this feature. 71.It Dv USB_GET_REPORT (struct usb_ctl_report) 72Get a report from the device without waiting for data on 73the interrupt pipe. 74The 75.Fa report 76field indicates which report is requested. 77It should be 78.Dv UHID_INPUT_REPORT , 79.Dv UHID_OUTPUT_REPORT , 80or 81.Dv UHID_FEATURE_REPORT . 82This call may fail if the device does not support this feature. 83.Bd -literal 84struct usb_ctl_report { 85 int ucr_report; 86 u_char ucr_data[1024]; /* used data size will vary */ 87}; 88.Ed 89.It Dv USB_SET_REPORT (struct usb_ctl_report) 90Set a report in the device. 91The 92.Dv report 93field indicates which report is to be set. 94It should be 95.Dv UHID_INPUT_REPORT , 96.Dv UHID_OUTPUT_REPORT , 97or 98.Dv UHID_FEATURE_REPORT . 99This call may fail if the device does not support this feature. 100.El 101.Pp 102Use 103.Xr read 2 104to get data from the device. 105Data should be read in chunks of the size prescribed by the report descriptor. 106.Pp 107Use 108.Xr write 2 109send data to the device. 110Data should be written in chunks of the size prescribed by the report 111descriptor. 112.Sh SEE ALSO 113.Xr usbhidctl 1 , 114.Xr usbhid 3 , 115.Xr intro 4 , 116.Xr uhidev 4 , 117.Xr usb 4 118.Sh HISTORY 119The 120.Nm 121driver 122appeared in 123.Ox 2.6 . 124