summaryrefslogtreecommitdiff
path: root/libs/ui/EventHub.cpp
diff options
context:
space:
mode:
author Sean McNeil <sean.mcneil@windriver.com> 2010-06-23 16:00:37 +0700
committer Jean-Baptiste Queru <jbq@google.com> 2010-08-18 13:53:36 -0700
commitaeb00c409d1ead2a3cb0f3d98b78de80adeec52b (patch)
tree3c58fb70f4cb6e85b787fdf5e594a5322355adf0 /libs/ui/EventHub.cpp
parent72e0b2ab08dc49857955a4560de296fdddada8dc (diff)
Only monitor recognized uevent devices.
system_server can potentially monitor uevent devices that are of no use to it. For instance, an accelerometer implementation as uevents. This would cause the process to be busy when unnecessary. If a device cannot be classified, don't monitor it. Change-Id: Ib2c93105e7d746d9c1a7414bea8bab3fb8c0b70a
Diffstat (limited to 'libs/ui/EventHub.cpp')
-rw-r--r--libs/ui/EventHub.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/libs/ui/EventHub.cpp b/libs/ui/EventHub.cpp
index a3c34d0ba742..891661d690ac 100644
--- a/libs/ui/EventHub.cpp
+++ b/libs/ui/EventHub.cpp
@@ -581,7 +581,6 @@ int EventHub::open_device(const char *deviceName)
if (strcmp(name, test) == 0) {
LOGI("ignoring event id %s driver %s\n", deviceName, test);
close(fd);
- fd = -1;
return -1;
}
}
@@ -813,6 +812,14 @@ int EventHub::open_device(const char *deviceName)
device->id, name, propName, keylayoutFilename);
}
+ // If the device isn't recognized as something we handle, don't monitor it.
+ if (device->classes == 0) {
+ LOGV("Dropping device %s %p, id = %d\n", deviceName, device, devid);
+ close(fd);
+ delete device;
+ return -1;
+ }
+
LOGI("New device: path=%s name=%s id=0x%x (of 0x%x) index=%d fd=%d classes=0x%x\n",
deviceName, name, device->id, mNumDevicesById, mFDCount, fd, device->classes);