OSDN Git Service

EventHub: load a default .idc if no other .idc found for touchscreen
authorChih-Wei Huang <cwhuang@linux.org.tw>
Tue, 17 Jul 2012 08:11:07 +0000 (16:11 +0800)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Wed, 25 Sep 2013 02:45:42 +0000 (10:45 +0800)
The patch moves loadConfigurationLocked to later stage that may cause issues
if upstream changes. Needs to review it on rebasing.

services/input/EventHub.cpp

index f3dd3b3..c2dd6c9 100644 (file)
@@ -1102,9 +1102,6 @@ status_t EventHub::openDeviceLocked(const char *devicePath) {
     ALOGV("  driver:     v%d.%d.%d\n",
         driverVersion >> 16, (driverVersion >> 8) & 0xff, driverVersion & 0xff);
 
-    // Load the configuration file for the device.
-    loadConfigurationLocked(device);
-
     // Figure out the kinds of events the device reports.
     ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(device->keyBitmask)), device->keyBitmask);
     ioctl(fd, EVIOCGBIT(EV_ABS, sizeof(device->absBitmask)), device->absBitmask);
@@ -1178,6 +1175,9 @@ status_t EventHub::openDeviceLocked(const char *devicePath) {
         device->classes |= INPUT_DEVICE_CLASS_VIBRATOR;
     }
 
+    // Load the configuration file for the device.
+    loadConfigurationLocked(device);
+
     // Configure virtual keys.
     if ((device->classes & INPUT_DEVICE_CLASS_TOUCH)) {
         // Load the virtual keys for the touch screen, if any.
@@ -1320,6 +1320,10 @@ void EventHub::addDeviceLocked(Device* device) {
 void EventHub::loadConfigurationLocked(Device* device) {
     device->configurationFile = getInputDeviceConfigurationFilePathByDeviceIdentifier(
             device->identifier, INPUT_DEVICE_CONFIGURATION_FILE_TYPE_CONFIGURATION);
+    if ((device->classes & INPUT_DEVICE_CLASS_TOUCH) && device->configurationFile.isEmpty()) {
+        device->configurationFile = getInputDeviceConfigurationFilePathByName(String8("GenericTouch"),
+                INPUT_DEVICE_CONFIGURATION_FILE_TYPE_CONFIGURATION);
+    }
     if (device->configurationFile.isEmpty()) {
         ALOGD("No input device configuration file found for device '%s'.",
                 device->identifier.name.string());