#include <sys/limits.h>
#include <sys/sha1.h>
+#include <linux/vt.h>
+
/* this macro is used to tell if "bit" is set in "array"
* it selects a byte from the array, and does a boolean AND
* operation with a byte that only has the relevant bit set.
namespace android {
+int android_vt = 1;
+
static const char *WAKE_LOCK_ID = "KeyEvents";
static const char *DEVICE_PATH = "/dev/input";
}
}
+#ifdef __i386__
+ struct vt_stat vs;
+ int fd_vt = open("/dev/tty0", O_RDWR | O_SYNC);
+ if (fd_vt >= 0) {
+ ioctl(fd_vt, VT_GETSTATE, &vs);
+ close(fd_vt);
+ }
+#endif
// Grab the next input event.
bool deviceChanged = false;
while (mPendingEventIndex < mPendingEventCount) {
} else if ((readSize % sizeof(struct input_event)) != 0) {
ALOGE("could not get event (wrong size: %d)", readSize);
} else {
+#ifdef __i386__
+ if (vs.v_active != android_vt) {
+ ALOGV("Skip a non Android VT event");
+ continue;
+ }
+#endif
int32_t deviceId = device->id == mBuiltInKeyboardId ? 0 : device->id;
size_t count = size_t(readSize) / sizeof(struct input_event);
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);
device->classes |= INPUT_DEVICE_CLASS_TOUCH | INPUT_DEVICE_CLASS_TOUCH_MT;
}
// Is this an old style single-touch driver?
- } else if (test_bit(BTN_TOUCH, device->keyBitmask)
+ } else if ((test_bit(BTN_TOUCH, device->keyBitmask) || test_bit(BTN_LEFT, device->keyBitmask))
&& test_bit(ABS_X, device->absBitmask)
&& test_bit(ABS_Y, device->absBitmask)) {
device->classes |= INPUT_DEVICE_CLASS_TOUCH;
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.
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());