1.\" $OpenBSD: uhid.4,v 1.19 2020/12/30 12:49:58 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.\" 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: December 30 2020 $ 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 Fa int 50Get the report identifier used by this HID report. 51.It Dv USB_GET_REPORT_DESC Fa "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_GET_REPORT Fa "struct usb_ctl_report" 63Get a report from the device without waiting for data on 64the interrupt pipe. 65The 66.Fa report 67field indicates which report is requested. 68It should be 69.Dv UHID_INPUT_REPORT , 70.Dv UHID_OUTPUT_REPORT , 71or 72.Dv UHID_FEATURE_REPORT . 73This call may fail if the device does not support this feature. 74.Bd -literal 75struct usb_ctl_report { 76 int ucr_report; 77 u_char ucr_data[1024]; /* used data size will vary */ 78}; 79.Ed 80.It Dv USB_SET_REPORT Fa "struct usb_ctl_report" 81Set a report in the device. 82The 83.Dv report 84field indicates which report is to be set. 85It should be 86.Dv UHID_INPUT_REPORT , 87.Dv UHID_OUTPUT_REPORT , 88or 89.Dv UHID_FEATURE_REPORT . 90This call may fail if the device does not support this feature. 91.El 92.Pp 93Use 94.Xr read 2 95to get data from the device. 96Data should be read in chunks of the size prescribed by the report descriptor. 97.Pp 98Use 99.Xr write 2 100to send data to the device. 101Data should be written in chunks of the size prescribed by the report 102descriptor. 103.Sh SEE ALSO 104.Xr usbhidctl 1 , 105.Xr usbhid 3 , 106.Xr intro 4 , 107.Xr uhidev 4 , 108.Xr usb 4 109.Sh HISTORY 110The 111.Nm 112driver 113appeared in 114.Ox 2.6 . 115