1.\" $NetBSD: uhid.4,v 1.13 2001/12/29 14:41:59 augustss 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.\" 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. 29.\" 30.\" $FreeBSD$ 31.\" 32.Dd April 24, 2018 33.Dt UHID 4 34.Os 35.Sh NAME 36.Nm uhid 37.Nd USB generic HID support 38.Sh SYNOPSIS 39To compile this driver into the kernel, 40place the following line in your 41kernel configuration file: 42.Bd -ragged -offset indent 43.Cd "device uhid" 44.Ed 45.Pp 46Alternatively, to load the driver as a 47module at boot time, place the following line in 48.Xr loader.conf 5 : 49.Bd -literal -offset indent 50uhid_load="YES" 51.Ed 52.Sh DESCRIPTION 53The 54.Nm 55driver provides support for all HID (Human Interface Device) interfaces 56in USB devices that do not have a special driver. 57.Pp 58The device handles the following 59.Xr ioctl 2 60calls: 61.Bl -tag -width indent 62.It Dv USB_GET_REPORT_ID Pq Vt int 63Get the report identifier used by this HID report. 64.It Dv USB_GET_REPORT_DESC Pq Vt "struct usb_ctl_report_desc" 65Get the HID report descriptor. 66Using 67this descriptor the exact layout and meaning of data to/from 68the device can be found. 69The report descriptor is delivered 70without any processing. 71.Bd -literal 72struct usb_ctl_report_desc { 73 int ucrd_size; 74 u_char ucrd_data[1024]; /* filled data size will vary */ 75}; 76.Ed 77.It Dv USB_SET_IMMED Pq Vt int 78Sets the device in a mode where each 79.Xr read 2 80will return the current value of the input report. 81Normally 82a 83.Xr read 2 84will only return the data that the device reports on its 85interrupt pipe. 86This call may fail if the device does not support 87this feature. 88.It Dv USB_GET_REPORT Pq Vt "struct usb_ctl_report" 89Get a report from the device without waiting for data on 90the interrupt pipe. 91The 92.Va report 93field indicates which report is requested. 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.Bd -literal 101struct usb_ctl_report { 102 int ucr_report; 103 u_char ucr_data[1024]; /* used data size will vary */ 104}; 105.Ed 106.It Dv USB_SET_REPORT Pq Vt "struct usb_ctl_report" 107Set a report in the device. 108The 109.Va report 110field indicates which report is to be set. 111It should be 112.Dv UHID_INPUT_REPORT , 113.Dv UHID_OUTPUT_REPORT , 114or 115.Dv UHID_FEATURE_REPORT . 116This call may fail if the device does not support this feature. 117.El 118.Pp 119Use 120.Xr read 2 121to get data from the device. 122Data should be read in chunks of the 123size prescribed by the report descriptor. 124.Pp 125Use 126.Xr write 2 127to send data to the device. 128Data should be written in chunks of the 129size prescribed by the report descriptor. 130.Sh SYSCTL VARIABLES 131The following variables are available as both 132.Xr sysctl 8 133variables and 134.Xr loader 8 135tunables: 136.Bl -tag -width indent 137.It Va hw.usb.uhid.debug 138Debug output level, where 0 is debugging disabled and larger values increase 139debug message verbosity. 140Default is 0. 141.Sh FILES 142.Bl -tag -width ".Pa /dev/uhid?" 143.It Pa /dev/uhid? 144.El 145.Sh SEE ALSO 146.Xr usbhidctl 1 , 147.Xr usb 4 148.Sh HISTORY 149The 150.Nm 151driver 152appeared in 153.Nx 1.4 . 154This manual page was adopted from 155.Nx 156by 157.An Tom Rhodes Aq Mt trhodes@FreeBSD.org 158in April 2002. 159