Allow blacklisting input devices by build flag

Usage:
TW_INPUT_BLACKLIST := accelerometer
TW_INPUT_BLACKLIST := "accelerometer\x0agyroscope"

This can be used to fix touch input on devices where an input
device is breaking touch processing in TWRP.

We are using new line chars to separate multiple devices and in
the make file you specify the new line character with \x0a which
is the hex code in ASCII for a new line.

The new line character might be a bit of a pain to use as a
delimeter, but it is highly unlikely that an OEM will ever name
an input device with a new line character in the name.

Change-Id: I255136b7a686909a23e649918c661843153c2853
This commit is contained in:
Ethan Yonker
2014-08-12 14:52:49 -05:00
parent e85f02dd91
commit 5742a40b87
2 changed files with 20 additions and 1 deletions
+4
View File
@@ -81,6 +81,10 @@ ifeq ($(TW_IGNORE_MAJOR_AXIS_0), true)
LOCAL_CFLAGS += -DTW_IGNORE_MAJOR_AXIS_0
endif
ifneq ($(TW_INPUT_BLACKLIST),)
LOCAL_CFLAGS += -DTW_INPUT_BLACKLIST=$(TW_INPUT_BLACKLIST)
endif
ifneq ($(BOARD_USE_CUSTOM_RECOVERY_FONT),)
LOCAL_CFLAGS += -DBOARD_USE_CUSTOM_RECOVERY_FONT=$(BOARD_USE_CUSTOM_RECOVERY_FONT)
else
+16 -1
View File
@@ -173,11 +173,26 @@ static int vk_init(struct ev *e)
e->ignored = 1;
}
#else
#ifndef TW_INPUT_BLACKLIST
// Blacklist these "input" devices
if (strcmp(e->deviceName, "bma250") == 0 || strcmp(e->deviceName, "bma150") == 0 || strcmp(e->deviceName, "accelerometer") == 0)
if (strcmp(e->deviceName, "bma250") == 0 || strcmp(e->deviceName, "bma150") == 0) == 0)
{
printf("blacklisting %s input device\n", e->deviceName);
e->ignored = 1;
}
#else
char* bl = strdup(EXPAND(TW_INPUT_BLACKLIST));
char* blacklist = strtok(bl, "\n");
while (blacklist != NULL) {
if (strcmp(e->deviceName, blacklist) == 0) {
printf("blacklisting %s input device\n", blacklist);
e->ignored = 1;
}
blacklist = strtok(NULL, "\n");
}
free(bl);
#endif
#endif
strcat(vk_path, e->deviceName);