blob: 59f5ad9d1a8822b11f1911f38baf2760e34ac507 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
<table class="head">
<tr>
<td class="head-ltitle">UHID(4)</td>
<td class="head-vol">Device Drivers Manual</td>
<td class="head-rtitle">UHID(4)</td>
</tr>
</table>
<div class="manual-text">
<section class="Sh">
<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1>
<p class="Pp"><code class="Nm">uhid</code> — <span class="Nd">USB generic
HID support</span></p>
</section>
<section class="Sh">
<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1>
<p class="Pp">To compile this driver into the kernel, place the following line
in your kernel configuration file:</p>
<div class="Bd Pp Bd-indent"><code class="Cd">device uhid</code>
<br/>
<code class="Cd">device hid</code>
<br/>
<code class="Cd">device usb</code></div>
<p class="Pp">Alternatively, to load the driver as a module at boot time, place
the following line in <a class="Xr">loader.conf(5)</a>:</p>
<div class="Bd Pp Bd-indent Li">
<pre>uhid_load="YES"</pre>
</div>
</section>
<section class="Sh">
<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
<p class="Pp">The <code class="Nm">uhid</code> driver provides support for all
HID (Human Interface Device) interfaces in USB devices that do not have a
special driver.</p>
<p class="Pp">The device handles the following <a class="Xr">ioctl(2)</a>
calls:</p>
<dl class="Bl-tag">
<dt id="USB_GET_REPORT_ID"><a class="permalink" href="#USB_GET_REPORT_ID"><code class="Dv">USB_GET_REPORT_ID</code></a>
(<var class="Vt">int</var>)</dt>
<dd>Get the report identifier used by this HID report.</dd>
<dt id="USB_GET_REPORT_DESC"><a class="permalink" href="#USB_GET_REPORT_DESC"><code class="Dv">USB_GET_REPORT_DESC</code></a>
(<var class="Vt">struct usb_gen_descriptor</var>)</dt>
<dd>Get the HID report descriptor. Copies a maximum of
<var class="Va">ugd_maxlen</var> bytes of the report descriptor data into
the memory specified by <var class="Va">ugd_data</var>. Upon return
<var class="Va">ugd_actlen</var> is set to the number of bytes copied.
Using this descriptor the exact layout and meaning of data to/from the
device can be found. The report descriptor is delivered without any
processing.
<div class="Bd Pp Li">
<pre>struct usb_gen_descriptor {
void *ugd_data;
uint16_t ugd_maxlen;
uint16_t ugd_actlen;
uint8_t ugd_report_type;
...
};</pre>
</div>
</dd>
<dt id="USB_SET_IMMED"><a class="permalink" href="#USB_SET_IMMED"><code class="Dv">USB_SET_IMMED</code></a>
(<var class="Vt">int</var>)</dt>
<dd>Sets the device in a mode where each <a class="Xr">read(2)</a> will return
the current value of the input report. Normally a
<a class="Xr">read(2)</a> will only return the data that the device
reports on its interrupt pipe. This call may fail if the device does not
support this feature.</dd>
<dt id="USB_GET_REPORT"><a class="permalink" href="#USB_GET_REPORT"><code class="Dv">USB_GET_REPORT</code></a>
(<var class="Vt">struct usb_gen_descriptor</var>)</dt>
<dd>Get a report from the device without waiting for data on the interrupt
pipe. Copies a maximum of <var class="Va">ugd_maxlen</var> bytes of the
report data into the memory specified by <var class="Va">ugd_data</var>.
Upon return <var class="Va">ugd_actlen</var> is set to the number of bytes
copied. The <var class="Va">ugd_report_type</var> field indicates which
report is requested. It should be
<code class="Dv">UHID_INPUT_REPORT</code>,
<code class="Dv">UHID_OUTPUT_REPORT</code>, or
<code class="Dv">UHID_FEATURE_REPORT</code>. This call may fail if the
device does not support this feature.</dd>
<dt id="USB_SET_REPORT"><a class="permalink" href="#USB_SET_REPORT"><code class="Dv">USB_SET_REPORT</code></a>
(<var class="Vt">struct usb_gen_descriptor</var>)</dt>
<dd>Set a report in the device. The <var class="Va">ugd_report_type</var>
field indicates which report is to be set. It should be
<code class="Dv">UHID_INPUT_REPORT</code>,
<code class="Dv">UHID_OUTPUT_REPORT</code>, or
<code class="Dv">UHID_FEATURE_REPORT</code>. The value of the report is
specified by the <var class="Va">ugd_data</var> and the
<var class="Va">ugd_maxlen</var> fields. This call may fail if the device
does not support this feature.</dd>
<dt id="USB_GET_DEVICEINFO"><a class="permalink" href="#USB_GET_DEVICEINFO"><code class="Dv">USB_GET_DEVICEINFO</code></a>
(<var class="Vt">struct usb_device_info</var>)</dt>
<dd>Returns information about the device, like USB vendor ID and USB product
ID. This call will not issue any USB transactions. Also refer to
<a class="Xr">ugen(4)</a>.</dd>
</dl>
<p class="Pp">Use <a class="Xr">read(2)</a> to get data from the device. Data
should be read in chunks of the size prescribed by the report
descriptor.</p>
<p class="Pp">Use <a class="Xr">write(2)</a> to send data to the device. Data
should be written in chunks of the size prescribed by the report
descriptor.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="SYSCTL_VARIABLES"><a class="permalink" href="#SYSCTL_VARIABLES">SYSCTL
VARIABLES</a></h1>
<p class="Pp">The following variables are available as both
<a class="Xr">sysctl(8)</a> variables and <a class="Xr">loader(8)</a>
tunables:</p>
<dl class="Bl-tag">
<dt id="hw.usb.uhid.debug"><var class="Va">hw.usb.uhid.debug</var></dt>
<dd>Debug output level, where 0 is debugging disabled and larger values
increase debug message verbosity. Default is 0.</dd>
</dl>
</section>
<section class="Sh">
<h1 class="Sh" id="FILES"><a class="permalink" href="#FILES">FILES</a></h1>
<dl class="Bl-tag">
<dt><span class="Pa">/dev/uhid?</span></dt>
<dd style="width: auto;"> </dd>
</dl>
</section>
<section class="Sh">
<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE
ALSO</a></h1>
<p class="Pp"><a class="Xr">usbhidctl(1)</a>, <a class="Xr">usb(4)</a></p>
</section>
<section class="Sh">
<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1>
<p class="Pp">The <code class="Nm">uhid</code> driver appeared in
<span class="Ux">NetBSD 1.4</span>. This manual page was adopted from
<span class="Ux">NetBSD</span> by <span class="An">Tom Rhodes</span>
<<a class="Mt" href="mailto:trhodes@FreeBSD.org">trhodes@FreeBSD.org</a>>
in April 2002.</p>
</section>
</div>
<table class="foot">
<tr>
<td class="foot-date">October 31, 2020</td>
<td class="foot-os">FreeBSD 15.0</td>
</tr>
</table>
|