summaryrefslogtreecommitdiff
path: root/static/freebsd/man4/gpiokeys.4 3.html
blob: c17dfbf71c996969b3627b97b9133c4d1d347b85 (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
<table class="head">
  <tr>
    <td class="head-ltitle">GPIOKEYS(4)</td>
    <td class="head-vol">Device Drivers Manual</td>
    <td class="head-rtitle">GPIOKEYS(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">gpiokeys</code> &#x2014; <span class="Nd">GPIO
    keys device driver</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 lines
    in your kernel configuration file:</p>
<div class="Bd Pp Bd-indent"><code class="Cd">options FDT</code>
<br/>
<code class="Cd">device gpio</code>
<br/>
<code class="Cd">device gpiokeys</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>gpiokeys_load=&quot;YES&quot;</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">gpiokeys</code> driver provides a way to
    represent a set of general purpose inputs as a <a class="Xr">keyboard(4)</a>
    device. At the moment the driver supports only <a class="Xr">FDT(4)</a>
    based systems. The DTS determines what pins are mapped to buttons and what
    key codes are generated for each virtual button. The
    <a class="Xr">keyboard(4)</a> device can be used from userland to monitor
    for input changes.</p>
<p class="Pp">On an <a class="Xr">FDT(4)</a> based system the DTS part for a
    <code class="Nm">gpiokeys</code> device usually looks like:</p>
<div class="Bd Pp Li">
<pre>/ {

	...

	gpio_keys {
		compatible = &quot;gpio-keys&quot;;

		btn1 {
			label = &quot;button1&quot;;
			linux,code = &lt;KEY_1&gt;;
			gpios = &lt;&amp;gpio 0 3 GPIO_ACTIVE_LOW&gt;
		};

		btn2 {
			label = &quot;button2&quot;;
			linux,code = &lt;KEY_2&gt;;
			gpios = &lt;&amp;gpio 0 4 GPIO_ACTIVE_LOW&gt;
		};
	};
};</pre>
</div>
<p class="Pp">For more details about the <var class="Va">gpios</var> property,
    please consult
  <span class="Pa">/usr/src/sys/dts/bindings-gpio.txt</span>.</p>
<p class="Pp">The <code class="Nm">gpiokeys</code> driver supports two
    properties for specifying a key code.</p>
<p class="Pp">The property <var class="Va">freebsd,code</var> specifies a
    <span class="Ux">FreeBSD</span> native scancode compatible with
    <a class="Xr">kbdmap(5)</a> keyboard maps.</p>
<p class="Pp">The property <var class="Va">linux,code</var> specifies an evdev
    scancode. That scancode is internally translated to a native scancode. Note
    that not all evdev scancodes have corresponding native scancodes. If a
    scancode cannot be translated, then a diagnostic message is printed and the
    input is ignored.</p>
<p class="Pp">The property <var class="Va">label</var> is a descriptive name of
    a button. It is used for diagnostic messages only. This property is
    optional. If not set, the node name is used in its place.</p>
<p class="Pp">The property <var class="Va">autorepeat</var> determines whether
    autorepeat is enabled for a button.</p>
<p class="Pp">The property <var class="Va">debounce-interval</var> defines
    debouncing interval time in milliseconds. If not specified the interval
    defaults to 5.</p>
</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">fdt(4)</a>, <a class="Xr">gpio(4)</a>,
    <a class="Xr">keyboard(4)</a>, <a class="Xr">kbdmap(5)</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">gpiokeys</code> manual page first appeared in
    <span class="Ux">FreeBSD 12.2</span>.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1>
<p class="Pp">The <code class="Nm">gpiokeys</code> driver was written by
    <span class="An">Oleksandr Tymoshenko</span>
    &lt;<a class="Mt" href="mailto:gonzo@FreeBSD.org">gonzo@FreeBSD.org</a>&gt;.
    This manual page was written by
  <br/>
  <span class="An">Andriy Gapon</span>
    &lt;<a class="Mt" href="mailto:avg@FreeBSD.org">avg@FreeBSD.org</a>&gt;.</p>
</section>
</div>
<table class="foot">
  <tr>
    <td class="foot-date">August 5, 2020</td>
    <td class="foot-os">FreeBSD 15.0</td>
  </tr>
</table>