--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(touchsensitivity C)
+
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(touchsensitivity_pkgs REQUIRED hwcommon dlog)
+
+FOREACH(flag ${touchsensitivity_pkgs_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+
+ADD_LIBRARY(${PROJECT_NAME} MODULE touchsensitivity.c)
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${touchsensitivity_pkgs_LDFLAGS})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES PREFIX "")
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR}/hw COMPONENT RuntimeLibraries)
--- /dev/null
+/*
+ * device-node
+ *
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <linux/limits.h>
+#include <dirent.h>
+
+#include <hw/touchsensitivity.h>
+#include <hw/shared.h>
+
+#define TOUCHSENSITIVITY_GLOVE_MODE_PATH "/sys/class/sec/tsp/glove_mode"
+
+static int glove_mode_get_state(int *state)
+{
+ int ret, val;
+
+ if (!state)
+ return -EINVAL;
+
+ ret = sys_get_int(TOUCHSENSITIVITY_GLOVE_MODE_PATH, &val);
+ if (ret < 0) {
+ _E("Failed to get touch glove mode state (%d)", ret);
+ return ret;
+ }
+
+ switch (val) {
+ case TOUCHSENSITIVITY_GLOVE_MODE_OFF:
+ case TOUCHSENSITIVITY_GLOVE_MODE_ON:
+ *state = val;
+ break;
+ default:
+ _E("Failed to get touch glove mode state (%d)", val);
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
+static int glove_mode_set_state(int state)
+{
+ int ret, val;
+
+ switch (state) {
+ case TOUCHSENSITIVITY_GLOVE_MODE_OFF:
+ case TOUCHSENSITIVITY_GLOVE_MODE_ON:
+ val = state;
+ break;
+ default:
+ _E("Invalid input (%d)", state);
+ return -EINVAL;
+ }
+
+ ret = sys_set_int(TOUCHSENSITIVITY_GLOVE_MODE_PATH, val);
+ if (ret < 0)
+ _E("Failed to change touch glove mode state (%d)", ret);
+
+ return ret;
+}
+
+static int touchsensitivity_open(struct hw_info *info,
+ const char *id, struct hw_common **common)
+{
+ struct touchsensitivity_device *touchsensitivity_dev;
+
+ if (!info || !common)
+ return -EINVAL;
+
+ touchsensitivity_dev = calloc(1, sizeof(struct touchsensitivity_device));
+ if (!touchsensitivity_dev)
+ return -ENOMEM;
+
+ touchsensitivity_dev->common.info = info;
+ touchsensitivity_dev->glove_mode_get_state = glove_mode_get_state;
+ touchsensitivity_dev->glove_mode_set_state = glove_mode_set_state;
+
+ *common = (struct hw_common *)touchsensitivity_dev;
+ return 0;
+}
+
+static int touchsensitivity_close(struct hw_common *common)
+{
+ if (!common)
+ return -EINVAL;
+
+ free(common);
+ return 0;
+}
+
+HARDWARE_MODULE_STRUCTURE = {
+ .magic = HARDWARE_INFO_TAG,
+ .hal_version = HARDWARE_INFO_VERSION,
+ .device_version = TOUCHSENSITIVITY_HARDWARE_DEVICE_VERSION,
+ .id = TOUCHSENSITIVITY_HARDWARE_DEVICE_ID,
+ .name = "touchsensitivity",
+ .open = touchsensitivity_open,
+ .close = touchsensitivity_close,
+};