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.html31
1 files changed, 22 insertions, 9 deletions
diff --git a/en/devices/input/key-layout-files.html b/en/devices/input/key-layout-files.html
index 22faf84e..486b4fcb 100644
--- a/en/devices/input/key-layout-files.html
+++ b/en/devices/input/key-layout-files.html
@@ -133,19 +133,32 @@ axis 0x05 invert BRAKE
<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>
-<h4 id="center-flat-position-option">Center Flat Position Option</h4>
-<p>The center flat position is the neutral position of the axis, such as when
-a directional pad is in the very middle of its range and the user is not
-touching it.</p>
+<h4 id="center-flat-option">Center Flat Option</h4>
+<p> A joystick device may report input events even when the joystick is not being used, due to noise.
+This noise typically comes from the left and/or right sticks, and causes the driver to report
+ a position value near 0.
+The "center flat" value specifies the amount of noise to expect from the controller at rest.</p>
<p>The Linux input protocol provides a way for input device drivers to specify
-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>
+the center flat value of joystick axes, but not all drivers report it 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 width of the region around the center
+position of the axis that should be considered as centered.</p>
+<p> For example, if a device driver reports values for <code>AXIS_X</code> between 0 and 100,
+then 0 will be mapped to -1 and 100 will be mapped to 1 by the Android input system.
+The center of the range will be 50 in the unscaled coordinates and 0 in the scaled coordinates.
+If a flat value is equal to 10,
+then the developers should assume that any <code>AXIS_X</code> value reported between
+-0.1 and 0.1 (between 40 and 60 in unscaled coordinates) is noise, and treat those values coming
+from the joystick as zero.</p>
+<p class="note"><strong>Note</strong>: While the key layout file specifies the value
+ for the driver coordinate space,
+the value reported by android.view.InputDevice.MotionRange#getFlat() is in the Android
+coordinate space.</p>
+
<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>In the above example, the center flat value is set to <code>4096</code>.
</p>
<h3 id="comments">Comments</h3>