From e22afbedc1a71905d112d8cf78ca8c2a27e371fe Mon Sep 17 00:00:00 2001 From: Jeff Brown Date: Fri, 16 Dec 2011 13:45:40 -0800 Subject: Add basic support for new suspend-block ioctls. The new ioctls will enable the system to be more selective about which evdev devices should hold wake-locks when their queue is non-empty. For now, we enable this behavior for all configured input devices, which is more or less the status quo. This change is mainly about ensuring that the system still works correctly when combined with a newer kernel that supports the suspend-block ioctls. We can tweak this behavior later. Change-Id: I8ff69aa5198903f7e2998772a339313df17c0f24 --- services/input/EventHub.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'services/input/EventHub.cpp') diff --git a/services/input/EventHub.cpp b/services/input/EventHub.cpp index 1f8cf630bc88..ee9824ef1bbc 100644 --- a/services/input/EventHub.cpp +++ b/services/input/EventHub.cpp @@ -1063,14 +1063,20 @@ status_t EventHub::openDeviceLocked(const char *devicePath) { return -1; } + // Enable wake-lock behavior on kernels that support it. + // TODO: Only need this for devices that can really wake the system. + bool usingSuspendBlock = ioctl(fd, EVIOCSSUSPENDBLOCK, 1) == 0; + ALOGI("New device: id=%d, fd=%d, path='%s', name='%s', classes=0x%x, " - "configuration='%s', keyLayout='%s', keyCharacterMap='%s', builtinKeyboard=%s", + "configuration='%s', keyLayout='%s', keyCharacterMap='%s', builtinKeyboard=%s, " + "usingSuspendBlock=%s", deviceId, fd, devicePath, device->identifier.name.string(), device->classes, device->configurationFile.string(), device->keyMap.keyLayoutFile.string(), device->keyMap.keyCharacterMapFile.string(), - toString(mBuiltInKeyboardId == deviceId)); + toString(mBuiltInKeyboardId == deviceId), + toString(usingSuspendBlock)); mDevices.add(deviceId, device); -- cgit v1.2.3-59-g8ed1b