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