Permalink
Browse files

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: I489cc453bdce7cb376102cba67a9ea470e13292d
  • Loading branch information...
1 parent 032ddfd commit e7f4a64d71a22cfcd92aeae901405ae35eeb3192 @smcneil smcneil committed with Jun 23, 2010
Showing with 8 additions and 1 deletion.
  1. +8 −1 libs/ui/EventHub.cpp
View
@@ -623,7 +623,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;
}
}
@@ -841,6 +840,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);

0 comments on commit e7f4a64

Please sign in to comment.