From 64dbd0df84d5ed643920ce444feb67a6c0c983d2 Mon Sep 17 00:00:00 2001 From: Ethan Yonker Date: Wed, 10 Aug 2016 12:30:10 -0500 Subject: Make input whitelist and blacklist work for mouse devices too Includes some minor code clean up. Also we are now outputting the name of the first mouse device that we encounter to make it easier to identify which device(s) may need to be blacklisted. Change-Id: I515baf92967390edd224728f3a7092239138e6b8 --- minuitwrp/events.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/minuitwrp/events.cpp b/minuitwrp/events.cpp index d4ca0abbc..54119ebc0 100644 --- a/minuitwrp/events.cpp +++ b/minuitwrp/events.cpp @@ -176,7 +176,7 @@ static int vk_init(struct ev *e) } #else #ifndef TW_INPUT_BLACKLIST - // Blacklist these "input" devices + // Blacklist these "input" devices, use TW_INPUT_BLACKLIST := "accelerometer\x0atest1\x0atest2" using the \x0a as a separator between input devices if (strcmp(e->deviceName, "bma250") == 0 || strcmp(e->deviceName, "bma150") == 0) { printf("blacklisting %s input device\n", e->deviceName); @@ -277,7 +277,7 @@ static int vk_init(struct ev *e) // Check for EV_REL (REL_X and REL_Y) and, because touchscreens can have those too, // check also for EV_KEY (BTN_LEFT and BTN_RIGHT) -static void check_mouse(int fd) +static void check_mouse(int fd, const char* deviceName) { if(has_mouse) return; @@ -297,6 +297,7 @@ static void check_mouse(int fd) if(!test_bit(BTN_LEFT, bit[EV_KEY]) || !test_bit(BTN_RIGHT, bit[EV_KEY])) return; + printf("Found mouse '%s'\n", deviceName); has_mouse = 1; } @@ -326,9 +327,10 @@ int ev_init(void) evs[ev_count].fd = &ev_fds[ev_count]; /* Load virtualkeys if there are any */ - vk_init(&evs[ev_count]); + vk_init(&evs[ev_count]); - check_mouse(fd); + if (!evs[ev_count].ignored) + check_mouse(fd, evs[ev_count].deviceName); ev_count++; if(ev_count == MAX_DEVICES) break; -- cgit v1.2.3