diff --git a/firmware/export/config/fiiom3klinux.h b/firmware/export/config/fiiom3klinux.h index 0ce58be46f..c383242909 100644 --- a/firmware/export/config/fiiom3klinux.h +++ b/firmware/export/config/fiiom3klinux.h @@ -51,6 +51,9 @@ #define HAVE_BUTTON_LIGHT #define HAVE_BUTTONLIGHT_BRIGHTNESS +/* We have a touchpad */ +#define HAVE_TOUCHPAD + /* Main LCD backlight brightness range and defaults: the backlight driver * has levels from 0 to 32. But 0 is off so start at 1. */ 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_ */