1page.title=Input Device Configuration Files 2@jd:body 3 4<!-- 5 Copyright 2015 The Android Open Source Project 6 7 Licensed under the Apache License, Version 2.0 (the "License"); 8 you may not use this file except in compliance with the License. 9 You may obtain a copy of the License at 10 11 http://www.apache.org/licenses/LICENSE-2.0 12 13 Unless required by applicable law or agreed to in writing, software 14 distributed under the License is distributed on an "AS IS" BASIS, 15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 See the License for the specific language governing permissions and 17 limitations under the License. 18--> 19<div id="qv-wrapper"> 20 <div id="qv"> 21 <h2>In this document</h2> 22 <ol id="auto-toc"> 23 </ol> 24 </div> 25</div> 26 27<p>Input device configuration files (<code>.idc</code> files) contain device-specific 28configuration properties that affect the behavior of input devices.</p> 29<p>Input device configuration files are typically not necessary for standard 30peripherals such as HID keyboards and mice since the default system behavior 31usually ensures that they will work out of the box. On the other hand, 32built-in embedded devices, particularly touch screens, almost always 33require input device configuration files to specify their behavior.</p> 34<h2 id="rationale">Rationale</h2> 35<p>Android automatically detects and configures most input device capabilities 36based on the event types and properties that are reported by the associated 37Linux kernel input device driver.</p> 38<p>For example, if an input device supports the <code>EV_REL</code> event type and codes 39<code>REL_X</code> and <code>REL_Y</code> as well as the <code>EV_KEY</code> event type and <code>BTN_MOUSE</code>, 40then Android will classify the input device as a mouse. The default behavior 41for a mouse is to present an on-screen cursor which tracks the mouse's movements 42and simulates touches when the mouse is clicked. Although the mouse can 43be configured differently, the default behavior is usually sufficient for 44standard mouse peripherals.</p> 45<p>Certain classes of input devices are more ambiguous. For example, multi-touch 46touch screens and touch pads both support the <code>EV_ABS</code> event type and codes 47<code>ABS_MT_POSITION_X</code> and <code>ABS_MT_POSITION_Y</code> at a minimum. However, the intended 48uses of these devices are quite different and cannot always be determined 49automatically. Also, additional information is required to make sense of the 50pressure and size information reported by touch devices. Hence touch devices, 51especially built-in touch screens, usually need IDC files.</p> 52<h2 id="location">Location</h2> 53<p>Input device configuration files are located by USB vendor, product (and 54optionally version) id or by input device name.</p> 55<p>The following paths are consulted in order.</p> 56<ul> 57<li><code>/system/usr/idc/Vendor_XXXX_Product_XXXX_Version_XXXX.idc</code></li> 58<li><code>/system/usr/idc/Vendor_XXXX_Product_XXXX.idc</code></li> 59<li><code>/system/usr/idc/DEVICE_NAME.idc</code></li> 60<li><code>/data/system/devices/idc/Vendor_XXXX_Product_XXXX_Version_XXXX.idc</code></li> 61<li><code>/data/system/devices/idc/Vendor_XXXX_Product_XXXX.idc</code></li> 62<li><code>/data/system/devices/idc/DEVICE_NAME.idc</code></li> 63</ul> 64<p>When constructing a file path that contains the device name, all characters 65in the device name other than '0'-'9', 'a'-'z', 'A'-'Z', '-' or '_' are replaced by '_'.</p> 66<h2 id="syntax">Syntax</h2> 67<p>An input device configuration file is a plain text file consisting of property 68assignments and comments.</p> 69<h3 id="properties">Properties</h3> 70<p>Property assignments each consist of a property name, an <code>=</code>, a property value, 71and a new line. Like this:</p> 72<pre><code>property = value 73</code></pre> 74<p>Property names are non-empty literal text identifiers. They must not contain 75whitespace. Each components of the input system defines a set of properties 76that are used to configure its function.</p> 77<p>Property values are non-empty string literals, integers or floating point numbers. 78They must not contain whitespace or the reserved characters <code>\</code> or <code>"</code>.</p> 79<p>Property names and values are case-sensitive.</p> 80<h3 id="comments">Comments</h3> 81<p>Comment lines begin with '#' and continue to the end of the line. Like this:</p> 82<pre><code># A comment! 83</code></pre> 84<p>Blank lines are ignored.</p> 85<h3 id="example">Example</h3> 86<pre><code># This is an example of an input device configuration file. 87# It might be used to describe the characteristics of a built-in touch screen. 88 89# This is an internal device, not an external peripheral attached to the USB 90# or Bluetooth bus. 91device.internal = 1 92 93# The device should behave as a touch screen, which uses the same orientation 94# as the built-in display. 95touch.deviceType = touchScreen 96touch.orientationAware = 1 97 98# Additional calibration properties... 99# etc... 100</code></pre> 101<h2 id="common-properties">Common Properties</h2> 102<p>The following properties are common to all input device classes.</p> 103<p>Refer to the documentation of each input device class for information about the 104special properties used by each class.</p> 105<h4 id="deviceinternal"><code>device.internal</code></h4> 106<p><em>Definition:</em> <code>device.internal</code> = <code>0</code> | <code>1</code></p> 107<p>Specifies whether the input device is an internal built-in component as opposed to an 108externally attached (most likely removable) peripheral.</p> 109<ul> 110<li> 111<p>If the value is <code>0</code>, the device is external.</p> 112</li> 113<li> 114<p>If the value is <code>1</code>, the device is internal.</p> 115</li> 116<li> 117<p>If the value is not specified, the default value is <code>0</code> for all devices on the 118 USB (BUS_USB) or Bluetooth (BUS_BLUETOOTH) bus, <code>1</code> otherwise.</p> 119</li> 120</ul> 121<p>This property determines default policy decisions regarding wake events.</p> 122<p>Internal input devices generally do not wake the display from sleep unless explicitly 123configured to do so in the key layout file or in a hardcoded policy rule. This 124distinction prevents key presses and touches from spuriously waking up your phone 125when it is in your pocket. Usually there are only a small handful of wake keys defined.</p> 126<p>Conversely, external input devices usually wake the device more aggressively because 127they are assumed to be turned off or not plugged in during transport. For example, 128pressing any key on an external keyboard is a good indicator that the user wants the 129device to wake up and respond.</p> 130<p>It is important to ensure that the value of the <code>device.internal</code> property is set 131correctly for all internal input devices.</p> 132<h2 id="validation">Validation</h2> 133<p>Make sure to validate your input device configuration files using the 134<a href="validate-keymaps.html">Validate Keymaps</a> tool.</p> 135 136