forked from LineageOS/android_device_google_wahoo
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Trying to disable fingerprint reader keyboard emulation
Change-Id: I6509e1e0da2169b7db957f8f86a056b142e0be55
- Loading branch information
Showing
4 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
LOCAL_PATH:= $(call my-dir) | ||
|
||
include $(CLEAR_VARS) | ||
|
||
LOCAL_SRC_FILES := main.cpp | ||
#LOCAL_SHARED_LIBRARIES := libutils \ | ||
# libbinder \ | ||
# libcutils \ | ||
# libaudioutils \ | ||
# libmedia \ | ||
# libhardware | ||
LOCAL_MODULE_TAGS := optional | ||
LOCAL_CPPFLAGS := -Wno-unused-parameter | ||
LOCAL_MODULE := uinput-fpc-key-disable | ||
include $(BUILD_EXECUTABLE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#include <fcntl.h> | ||
#include <iostream> | ||
#include <linux/input.h> | ||
#include <linux/limits.h> | ||
#include <limits> | ||
#include <string.h> | ||
#include <sys/ioctl.h> | ||
#include <sys/stat.h> | ||
#include <sys/types.h> | ||
#include <unistd.h> | ||
|
||
int main(int argc, char** argv) | ||
{ | ||
static const char* targetName = "uinput-fpc"; | ||
int fd = -1; | ||
int ioctlResult; | ||
char name[256]; | ||
|
||
for (int i = 1; i < 9; i++) { | ||
char eventPath[PATH_MAX]; | ||
|
||
memset(name, 0, sizeof(name)); | ||
sprintf(eventPath, "/dev/input/event%d", i); | ||
std::cout << "Trying " << eventPath << std::endl; | ||
|
||
fd = open(eventPath, O_RDONLY); | ||
ioctlResult = ioctl(fd, EVIOCGNAME(sizeof(name)), name); | ||
std::cout << "Device name is '" << name << "'" << std::endl; | ||
|
||
if (ioctlResult < 0) { | ||
close(fd); | ||
fd = -1; | ||
continue; | ||
} | ||
|
||
if (strcmp(targetName, name) == 0) | ||
break; | ||
} | ||
|
||
if (fd < 0) { | ||
std::cerr << "Failed to find uinput-fpc device" << std::endl; | ||
return 1; | ||
} | ||
|
||
std::cout << "Grabbing " << targetName << std::endl; | ||
ioctlResult = ioctl(fd, EVIOCGRAB, 1); | ||
|
||
if (ioctlResult < 0) { | ||
std::cerr << "Failed to grab fpc input device" << std::endl; | ||
return 2; | ||
} | ||
|
||
while (true) { | ||
sleep(std::numeric_limits<unsigned int>::max()); | ||
} | ||
|
||
close(fd); | ||
return 0; | ||
} |