touchscreen: disable get/set state by kerenl version 98/264598/1 accepted/tizen/6.5/unified/20211028.115524 accepted/tizen/unified/20210927.120907 submit/tizen/20210927.071602 submit/tizen_6.5/20211028.163201 tizen_6.5.m2_release
authorYoungjae Cho <y0.cho@samsung.com>
Mon, 27 Sep 2021 05:51:49 +0000 (14:51 +0900)
committerYoungjae Cho <y0.cho@samsung.com>
Mon, 27 Sep 2021 05:51:49 +0000 (14:51 +0900)
Change-Id: I5fc2df8336470fb9e24efbebe819706ae9020031
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
hw/touchscreen/touchscreen.c

index ff4e9b82214c6e80e9e69b07ab3c8d4ec681f77e..0e8c8c89d3b73a2bff3b38e5caddfe2fef4f3d7a 100644 (file)
@@ -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;