As we have seen in “How to identify which IDC file used by Input Device in Android ?” if the input device is already using IDC File, we can see it in “ConfigurationFile” parameter in dumpsys input, but if we don’t have any IDC file assigned to the device and want to use a new file for the device, then this information certainly helps you to achieve it.
Input device configuration files are located by USB vendor, product (and optionally version) id or by input device name.
The following paths are consulted in order.
When constructing a file path that contains the device name, all characters in the device name other than ‘0’-‘9’, ‘a’-‘z’, ‘A’-‘Z’, ‘-‘ or ‘_’ are replaced by ‘_’.
Now, the first thing, we need to do is identify “Vendor ID” , “Product ID” and “Device Name” for the device. This can be done as below,
$ adb shell dumpsys input INPUT MANAGER (dumpsys input) Input Manager State: Interactive: true System UI Visibility: 0x8008 Pointer Speed: 0 Pointer Gestures Enabled: true Show Touches: false Pointer Capture Enabled: false Event Hub State: BuiltInKeyboardId: -2 Devices: 5: fts_ts Classes: 0x00000015 Path: /dev/input/event1 Enabled: true Descriptor: a1cc21cba608c55d28d6dd2b1939004df0e0c756 Location: ControllerNumber: 0 UniqueId: Identifier: bus=0x0018, vendor=0x0000, product=0x0000, version=0x0000 KeyLayoutFile: /system/usr/keylayout/Generic.kl KeyCharacterMapFile: /system/usr/keychars/Generic.kcm ConfigurationFile: HaveKeyboardLayoutOverlay: false
using “dumpsys input” command, look for device number in “Event Hub State” and the string infront of device number ( 5 in above example) is a “device name” ( “fts_ts” in above example) and then from “identifier” we can see the Vendor ID is 0x0000 and Product ID is 0x0000,
So we found the necessary details as,
- Device Name – fts_ts
- Vendor ID – 0x0000
- Product ID – 0x0000
Here, we can see Vendor ID and Product ID as non zero, only may be for USB devices. So, if we have those ID’s as zero, then we need to create the IDC file using “device name”, so in our case, the IDC file will be “fts_ts.idc”
Now, create the file as,
$ vim fts_ts.idc touch.deviceType = touchScreen
and we can either integrate and compile the android source code or push this file to “/vendor/usr/idc/fts_ts.idc” i.e. as mentioned in paths above to “/vendor/usr/idc/device-name.idc”
During development, you will first need to remount the vendor partition as mentioned here.
Now, when you boot the device next time, we can see the input device is assigned with the IDC file we added.
Reference : https://source.android.com/docs/core/interaction/input/input-device-configuration-files