Skip to content

Commit

Permalink
Trying to disable fingerprint reader keyboard emulation
Browse files Browse the repository at this point in the history
Change-Id: I6509e1e0da2169b7db957f8f86a056b142e0be55
  • Loading branch information
Flohack74 committed Dec 29, 2020
1 parent 623be45 commit bb7b781
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 0 deletions.
4 changes: 4 additions & 0 deletions device.mk
Original file line number Diff line number Diff line change
Expand Up @@ -677,3 +677,7 @@ PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/ubuntu/display.conf:system/halium/etc/ubuntu-touch-session.d/android.conf \
$(LOCAL_PATH)/ubuntu/config-default.xml:system/halium/usr/share/powerd/device_configs/config-default.xml

PRODUCT_PACKAGES += \
miniafservice \
uinput-fpc-key-disable

10 changes: 10 additions & 0 deletions init.hardware.rc
Original file line number Diff line number Diff line change
Expand Up @@ -890,3 +890,13 @@ on property:sys.retaildemo.enabled=1
setprop persist.vendor.charge.stop.level 35
setprop persist.vendor.charge.start.level 30

service miniaf /system/bin/miniafservice
class main
user system
group audio

service uinput-fpc-key-disable /system/bin/uinput-fpc-key-disable
class main
user root
group root

15 changes: 15 additions & 0 deletions uinput-fpc-key-disable/Android.mk
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)
59 changes: 59 additions & 0 deletions uinput-fpc-key-disable/main.cpp
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;
}

0 comments on commit bb7b781

Please sign in to comment.