From 74ae18cc8a30fbc9af17c7124f71e4096274989c Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Thu, 1 Apr 2021 07:15:25 -0400 Subject: fiiom3k_linux: Enable HAVE_TOUCHPAD and add in missing bits Change-Id: I78fa5fdb3648adfaa40f6d5f3c255666a85e2761 --- firmware/target/hosted/fiio/button-fiio.c | 10 ++++++++++ firmware/target/hosted/fiio/button-target.h | 6 ++++++ 2 files changed, 16 insertions(+) (limited to 'firmware/target') diff --git a/firmware/target/hosted/fiio/button-fiio.c b/firmware/target/hosted/fiio/button-fiio.c index 4acbfb0ea7..ffd2fbc454 100644 --- a/firmware/target/hosted/fiio/button-fiio.c +++ b/firmware/target/hosted/fiio/button-fiio.c @@ -46,6 +46,8 @@ static int key_up_delay = 0; static int key_down_delay = 0; static int key_f12_delay = 0; +static int tp_enabled = 1; + #define NR_POLL_DESC 2 static struct pollfd poll_fds[NR_POLL_DESC]; @@ -236,6 +238,11 @@ void button_init_device(void) } } +void touchpad_enable_device(bool en) +{ + tp_enabled = en; +} + int button_read_device(void) { static int button_bitmap = 0; @@ -247,6 +254,9 @@ int button_read_device(void) { for(int i = 0; i < NR_POLL_DESC; i++) { + if (i == 1 && !tp_enabled) /* Ignore touchpad ? */ + continue; + /* read only if non-blocking */ if(poll_fds[i].revents & POLLIN) { diff --git a/firmware/target/hosted/fiio/button-target.h b/firmware/target/hosted/fiio/button-target.h index 7098eaf9f3..92298960f8 100644 --- a/firmware/target/hosted/fiio/button-target.h +++ b/firmware/target/hosted/fiio/button-target.h @@ -39,8 +39,14 @@ #define BUTTON_LEFT BUTTON_PREV #define BUTTON_RIGHT BUTTON_NEXT +#define BUTTON_TOUCHPAD (BUTTON_UP|BUTTON_DOWN|BUTTON_PREV|BUTTON_NEXT|\ + BUTTON_HOME|BUTTON_OPTION) + /* Software power-off */ #define POWEROFF_BUTTON BUTTON_POWER #define POWEROFF_COUNT 25 +void touchpad_enable_device(bool en); + + #endif /* _BUTTON_TARGET_H_ */ -- cgit v1.2.3