summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYoungjae Cho <y0.cho@samsung.com>2021-09-27 14:51:49 +0900
committerYoungjae Cho <y0.cho@samsung.com>2021-09-27 14:51:49 +0900
commit6426bb380197a2c90a5a2113a6b564fa0c210c42 (patch)
treedb8be3ca5de1a01d22d1d66a35aba6fe76650eb7
parentb529fdbdf586edbb88040ad3e0c72f3c3d0a0a0d (diff)
downloaddevice-rpi-6426bb380197a2c90a5a2113a6b564fa0c210c42.tar.gz
device-rpi-6426bb380197a2c90a5a2113a6b564fa0c210c42.tar.bz2
device-rpi-6426bb380197a2c90a5a2113a6b564fa0c210c42.zip
Change-Id: I5fc2df8336470fb9e24efbebe819706ae9020031 Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
-rw-r--r--hw/touchscreen/touchscreen.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/hw/touchscreen/touchscreen.c b/hw/touchscreen/touchscreen.c
index ff4e9b8..0e8c8c8 100644
--- a/hw/touchscreen/touchscreen.c
+++ b/hw/touchscreen/touchscreen.c
@@ -20,6 +20,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#include <errno.h>
#include <linux/limits.h>
#include <dirent.h>
@@ -43,6 +44,10 @@ static int touchscreen_get_state(enum touchscreen_state *state)
if (!state)
return -EINVAL;
+ /* Since kernel version 5.4, it doesn't support the node. */
+ if (access(TOUCHSCREEN_CON_FILE, F_OK) != 0)
+ return -ENODEV;
+
ret = sys_get_int(TOUCHSCREEN_CON_FILE, &val);
if (ret < 0) {
_E("Failed to get touchscreen state (%d)", ret);
@@ -69,6 +74,10 @@ static int touchscreen_set_state(enum touchscreen_state state)
int ret;
int val;
+ /* Since kernel version 5.4, it doesn't support the node. */
+ if (access(TOUCHSCREEN_CON_FILE, F_OK) != 0)
+ return -ENODEV;
+
switch (state) {
case TOUCHSCREEN_OFF:
val = TURNOFF_TOUCHSCREEN;