aboutsummaryrefslogtreecommitdiff
path: root/en/devices/input/key-layout-files.html
diff options
context:
space:
mode:
Diffstat (limited to 'en/devices/input/key-layout-files.html')
-rw-r--r--en/devices/input/key-layout-files.html59
1 files changed, 38 insertions, 21 deletions
diff --git a/en/devices/input/key-layout-files.html b/en/devices/input/key-layout-files.html
index b9ee2be9..22faf84e 100644
--- a/en/devices/input/key-layout-files.html
+++ b/en/devices/input/key-layout-files.html
@@ -70,11 +70,12 @@ HID usage and Android key code name. The HID usage is represented as a 32-bit
integer, where the high 16-bits represent the HID usage page and the low 16-bits
represent the HID usage ID. Either declaration can be followed by an optional
set of whitespace-delimited policy flags.</p>
-<pre><code>key 1 ESCAPE
+<pre class="devsite-click-to-copy">
+key 1 ESCAPE
key 114 VOLUME_DOWN
key 16 Q VIRTUAL
key usage 0x0c006F BRIGHTNESS_UP
-</code></pre>
+</pre>
<p>The following policy flags are recognized:</p>
<ul>
<li><code>FUNCTION</code>: The key should be interpreted as if the FUNCTION key
@@ -95,7 +96,9 @@ including at least one Android axis code name.</p>
<p>A basic axis simply maps a Linux axis code to an Android axis code name. The
following declaration maps <code>ABS_X</code> (indicated by <code>0x00</code>)
to <code>AXIS_X</code> (indicated by <code>X</code>).</p>
-<pre><code>axis 0x00 X</code></pre>
+<pre class="devsite-click-to-copy">
+axis 0x00 X
+</pre>
<p>In the above example, if the value of <code>ABS_X</code> is <code>5</code>
then <code>AXIS_X</code> is set to <code>5</code>.</p>
@@ -108,7 +111,8 @@ device encodes two different mutually exclusive logical axes.</p>
(indicated by <code>0x01</code>) to <code>AXIS_GAS</code> when less than
<code>0x7f</code> or to <code>AXIS_BRAKE</code> when greater than
<code>0x7f</code>.</p>
-<pre><code>axis 0x01 split 0x7f GAS BRAKE</code></pre>
+<pre class="devsite-click-to-copy">
+axis 0x01 split 0x7f GAS BRAKE</pre>
<p>In the above example, if the value of <code>ABS_Y</code> is <code>0x7d</code>
then <code>AXIS_GAS</code> is set to <code>2</code> (<code>0x7f - 0x7d</code>)
and <code>AXIS_BRAKE</code> is set to <code>0</code>. Conversely, if the value
@@ -123,7 +127,9 @@ the split value of <code>0x7f</code> then both <code>AXIS_GAS</code> and
declaration maps <code>ABS_RZ</code> (indicated by <code>0x05</code>) to
<code>AXIS_BRAKE</code> (indicated by <code>BRAKE</code>), and inverts the
output by negating it.</p>
-<pre><code>axis 0x05 invert BRAKE</code></pre>
+<pre class="devsite-click-to-copy">
+axis 0x05 invert BRAKE
+</pre>
<p>In the above example, if the value of <code>ABS_RZ</code> is <code>2</code>
then <code>AXIS_BRAKE</code> is set to <code>-2</code>.</p>
@@ -136,19 +142,24 @@ the center flat position of joystick axes but not all of them do and some of
them provide incorrect values. To resolve this issue, an axis declaration may be
followed by a <code>flat</code> option that specifies the value of the center
flat position for the axis.</p>
-<pre><code>axis 0x03 Z flat 4096</code></pre>
+<pre class="devsite-click-to-copy">
+axis 0x03 Z flat 4096
+</pre>
<p>In the above example, the center flat position is set to <code>4096</code>.
</p>
<h3 id="comments">Comments</h3>
<p>Comment lines begin with # and continue to the end of the line:</p>
-<pre><code># A comment!</code></pre>
+<pre class="devsite-click-to-copy">
+# A comment!
+</pre>
<p>Blank lines are ignored.</p>
<h3 id="examples">Examples</h3>
<h4 id="keyboard">Keyboard</h4>
-<pre><code># This is an example of a key layout file for a keyboard.
+<pre class="devsite-click-to-copy">
+# This is an example of a key layout file for a keyboard.
key 1 ESCAPE
key 2 1
@@ -166,29 +177,32 @@ key 13 EQUALS
key 14 DEL
# etc...
-</code></pre>
+</pre>
<h4 id="system-controls">System Controls</h4>
-<pre><code># This is an example of a key layout file for basic system controls,
+<pre class="devsite-click-to-copy">
+# This is an example of a key layout file for basic system controls,
# such as volume and power keys which are typically implemented as GPIO pins
# the device decodes into key presses.
key 114 VOLUME_DOWN
key 115 VOLUME_UP
key 116 POWER
-</code></pre>
+</pre>
<h4 id="capacitive-buttons">Capacitive Buttons</h4>
-<pre><code># This is an example of a key layout file for a touch device with capacitive buttons.
+<pre class="devsite-click-to-copy">
+# This is an example of a key layout file for a touch device with capacitive buttons.
key 139 MENU VIRTUAL
key 102 HOME VIRTUAL
key 158 BACK VIRTUAL
key 217 SEARCH VIRTUAL
-</code></pre>
+</pre>
<h4 id="headset-jack-media-controls">Headset Jack Media Controls</h4>
-<pre><code># This is an example of a key layout file for headset mounted media controls.
+<pre class="devsite-click-to-copy">
+# This is an example of a key layout file for headset mounted media controls.
# A typical headset jack interface might have special control wires or detect known
# resistive loads as corresponding to media functions or volume controls.
# This file assumes that the driver decodes these signals and reports media
@@ -197,10 +211,11 @@ key 217 SEARCH VIRTUAL
key 163 MEDIA_NEXT
key 165 MEDIA_PREVIOUS
key 226 HEADSETHOOK
-</code></pre>
+</pre>
<h4 id="joystick">Joystick</h4>
-<pre><code># This is an example of a key layout file for a joystick.
+<pre class="devsite-click-to-copy">
+# This is an example of a key layout file for a joystick.
# These are the buttons that the joystick supports, represented as keys.
key 304 BUTTON_A
@@ -231,7 +246,7 @@ axis 0x05 RTRIGGER
# Hat.
axis 0x10 HAT_X
axis 0x11 HAT_Y
-</code></pre>
+</pre>
<h2 id="virtual-soft-keys">Virtual Soft Keys</h2>
<p>The input system provides special features for implementing virtual soft keys
@@ -268,22 +283,24 @@ time after the most recent touch on the touch screen (this delay is called the
<ol>
<li>Provide a key layout file for the touch screen or capacitive button
input device with the <code>VIRTUAL</code> flag set for each key.
-<pre><code>key 139 MENU VIRTUAL
+<pre class="devsite-click-to-copy">
+key 139 MENU VIRTUAL
key 102 HOME VIRTUAL
key 158 BACK VIRTUAL
key 217 SEARCH VIRTUAL
-</code></pre>
+</pre>
</li>
<li>Set the value of the virtual key quiet time in a resource overlay for the
framework <code>config.xml</code> resource.
-<pre><code>&lt;!-- Specifies the amount of time to disable virtual keys after the screen
+<pre class="devsite-click-to-copy">
+&lt;!-- Specifies the amount of time to disable virtual keys after the screen
is touched to filter out accidental virtual key presses due to swiping gestures
or taps near the edge of the display. May be 0 to disable the feature.
It is recommended that this value be no more than 250 ms.
This feature should be disabled for most devices. --&gt;
&lt;integer name="config_virtualKeyQuietTimeMillis"&gt;250&lt;/integer&gt;
-</code></pre>
+</pre>
</li>
</ol>