aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortakeshi_hoshina <takeshi_hoshina@mail.toyota.co.jp>2020-10-21 13:50:32 +0900
committertakeshi_hoshina <takeshi_hoshina@mail.toyota.co.jp>2020-10-21 13:50:32 +0900
commit96bd8be3dbf0c36c211f7dafeb61a1eba7f30ee7 (patch)
tree99613d9705c1152fd916828af27aed4c82e71914
parent706ad73eb02caf8532deaf5d38995bd258725cb8 (diff)
-rw-r--r--LICENSE177
-rw-r--r--Makefile81
-rw-r--r--README.md3
-rw-r--r--hal_api/input_hal.h696
-rw-r--r--hal_api/peripheral_service/aglinput.h536
-rw-r--r--hal_api/peripheral_service/extinput.h27
-rw-r--r--inc/input_drm.h22
-rw-r--r--inc/input_hal_debug.h57
-rw-r--r--inc/input_hal_frameworkunifiedlog.h76
-rw-r--r--inc/input_hal_internal.h107
-rw-r--r--inc/input_touch_ilitek.h27
-rw-r--r--inc/input_udev_monitor.h40
-rw-r--r--inc/input_util.h46
-rw-r--r--src/input_drm.cpp128
-rw-r--r--src/input_hal.cpp267
-rw-r--r--src/input_touch_ilitek.cpp226
-rw-r--r--src/input_udev_monitor.cpp566
-rw-r--r--src/input_util.cpp77
18 files changed, 3159 insertions, 0 deletions
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 00000000..f433b1a5
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/Makefile b/Makefile
new file mode 100644
index 00000000..35dfefdf
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,81 @@
+#
+# @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+#
+# 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.
+#
+
+COMPONENT_NAME := peripheral_service
+
+######### installed program/file ################
+TARGET := libinput_hal.so
+
+HEADER := ./hal_api/input_hal.h
+
+######### include paths/files ###################
+CXXFLAGS := -I./inc/
+CXXFLAGS += -I./hal_api/
+CXXFLAGS += -I$(SDKTARGETSYSROOT)/usr/agl/include
+CXXFLAGS += -I$(SDKTARGETSYSROOT)/usr/include/libdrm
+CXXFLAGS += -include $(SDKTARGETSYSROOT)/usr/agl/include/agl_types_obsoluted.h
+
+######### compile options #######################
+CXXFLAGS += -Wall -fPIC
+CXXFLAGS += -D_USE_DRM
+
+######### link options ##########################
+LDFLAGS := -shared
+LDFLAGS += -Wl,--no-as-needed
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -L$(SDKTARGETSYSROOT)/usr/agl/lib
+
+######### linked library ########################
+LIBS := -Wl,-Bdynamic -lstdc++
+LIBS += -Wl,-Bdynamic -lNS_FrameworkUnified
+LIBS += -Wl,-Bdynamic -ludev
+LIBS += -Wl,-Bdynamic -lpthread
+LIBS += -Wl,-Bdynamic -ldrm
+
+######### source files ##########################
+VPATH := src
+OBJS := input_hal.o
+OBJS += input_touch_ilitek.o
+OBJS += input_util.o
+OBJS += input_udev_monitor.o
+OBJS += input_drm.o
+
+######### make targets ##########################
+all: $(TARGET)
+ @echo $@ done.
+
+$(TARGET): $(OBJS)
+ $(CC) $(LDFLAGS) $(OBJS) $(LIBS) -o $(TARGET)
+ @echo $@ done.
+
+######### make cleans ###########################
+GCNO_FILES := $(filter %.gcno,$(OBJS:%.o=%.gcno))
+
+clean:
+ rm -f $(OBJS) $(TARGET) $(GCNO_FILES)
+ @echo $@ done.
+
+######### make installs #########################
+install: install-input
+install:
+ install -d -m 0755 $(DESTDIR)/usr/lib
+ install -m 0755 $(TARGET) $(DESTDIR)/usr/lib
+ @echo $@ done.
+
+install-input:
+ install -m 0755 -d $(DESTDIR)/usr/agl/include/$(COMPONENT_NAME)/
+ install -m 0644 ./hal_api/$(COMPONENT_NAME)/aglinput.h $(DESTDIR)/usr/agl/include/$(COMPONENT_NAME)/
+ install -m 0644 ./hal_api/$(COMPONENT_NAME)/extinput.h $(DESTDIR)/usr/agl/include/$(COMPONENT_NAME)/
diff --git a/README.md b/README.md
new file mode 100644
index 00000000..4a691131
--- /dev/null
+++ b/README.md
@@ -0,0 +1,3 @@
+input_hal library
+==================
+Input HAL implementation library for AGL Reference Board.
diff --git a/hal_api/input_hal.h b/hal_api/input_hal.h
new file mode 100644
index 00000000..bfc9d592
--- /dev/null
+++ b/hal_api/input_hal.h
@@ -0,0 +1,696 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * 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.
+ */
+
+#ifndef HAL_API_INPUT_HAL_H_
+#define HAL_API_INPUT_HAL_H_
+
+#include <native_service/frameworkunified_types.h>
+
+#include "peripheral_service/aglinput.h"
+
+/**
+ * @file input_hal.h
+ */
+
+/** @addtogroup switchhandler
+ * @{
+ */
+/** @addtogroup input_hal
+ * @ingroup switchhandler
+ * @{
+ */
+
+/************************************************************************
+* Macro definitions *
+************************************************************************/
+/**
+ * \~english Return value type
+ */
+enum HalInputRetType {
+ /**
+ * \~english Success
+ */
+ HAL_INPUT_RET_NORMAL = 0,
+ /**
+ * \~english Process abnormality
+ */
+ HAL_INPUT_RET_ERROR,
+ /**
+ * \~english Not support
+ */
+ HAL_INPUT_RET_NOT_SUPPORT,
+};
+/**
+ * \~english Touch panel IC type
+ */
+enum HalInputTouchDeviceType {
+ /**
+ * \~english Touch panel IC is invalid
+ */
+ HAL_INPUT_TOUCH_DEVICE_INVALID = 0,
+ /**
+ * \~english Touch panel IC is ILITEK
+ */
+ HAL_INPUT_TOUCH_DEVICE_ILITEK,
+};
+
+/**
+ * \~english Radio band type
+ */
+enum HalInputBandType {
+ /**
+ * \~english Radio band is AM
+ */
+ HAL_INPUT_BAND_TYPE_AM = 0,
+ /**
+ * \~english Radio band isn't AM
+ */
+ HAL_INPUT_BAND_TYPE_NOT_AM,
+};
+
+/**
+ * \~english Radio reception status
+ */
+enum HalInputTuneStatus {
+ /**
+ * \~english Radio is in normal state
+ */
+ HAL_INPUT_TUNE_STATUS_NORMAL = 0,
+ /**
+ * \~english Radio is in search state
+ */
+ HAL_INPUT_TUNE_STATUS_SERACH,
+};
+
+/**
+ * \~english Sensitivity Level
+ */
+enum HalInputTouchSensitivityLevel {
+ /**
+ * \~english Sensitivity level low
+ */
+ HAL_INPUT_TOUCH_SENSITIVITY_LEVEL_LOW = 1,
+ /**
+ * \~english Sensitivity level middle
+ */
+ HAL_INPUT_TOUCH_SENSITIVITY_LEVEL_MIDDLE,
+ /**
+ * \~english Sensitivity level high
+ */
+ HAL_INPUT_TOUCH_SENSITIVITY_LEVEL_HIGH,
+ /**
+ * \~english Sensitivity level none
+ */
+ HAL_INPUT_TOUCH_SENSITIVITY_LEVEL_NONE,
+};
+
+/**
+ * \~english input device type
+ */
+enum HalInputDeviceType {
+ /**
+ * \~english The device type invalid
+ */
+ HAL_INPUT_DEVICE_INVALID,
+ /**
+ * \~english The device is keyboard
+ */
+ HAL_INPUT_DEVICE_KEYBOARD,
+ /**
+ * \~english The device is touch
+ */
+ HAL_INPUT_DEVICE_TOUCH,
+ /**
+ * \~english The device is ESC-KEY
+ */
+ HAL_INPUT_DEVICE_TOUCH_ESCKEY,
+ /**
+ * \~english The device is steering SW
+ */
+ HAL_INPUT_DEVICE_STEERING,
+ /**
+ * \~english The device is tablet finger
+ */
+ HAL_INPUT_DEVICE_TABLET_FINGER,
+ /**
+ * \~english The device is rotary key
+ */
+ HAL_INPUT_DEVICE_ROTARY_KEY,
+};
+
+/**
+ * \~english Don't need to config touch panel
+ */
+#define HAL_INPUT_TOUCH_CONFIG_OFF (0)
+/**
+ * \~english Touch panel configed
+ */
+#define HAL_INPUT_TOUCH_CONFIG_ON (1)
+
+/**
+ * \~english Touch panel touch press
+ */
+#define HAL_INPUT_TOUCH_PRESS (0)
+/**
+ * \~english Touch panel touch release
+ */
+#define HAL_INPUT_TOUCH_RELEASE (1)
+
+/**
+ * \~english Don't report touch panel's touch event
+ */
+#define HAL_INPUT_TOUCH_UNREPORT (0)
+/**
+ * \~english Report touch panel's touch event
+ */
+#define HAL_INPUT_TOUCH_REPORT (1)
+
+/**
+ * \~english Test all case
+ */
+#define HAL_INPUT_TOUCH_SELFTEST_ID_ALL (0xFE)
+/**
+ * \~english Selftest data length
+ */
+#define HAL_INPUT_TOUCH_SELFTEST_DATA_LEN (5)
+/**
+ * \~english Selftest mode not support
+ */
+#define HAL_INPUT_TOUCH_SELFTEST_NOT_SUPPORT (0xEE)
+
+/**
+ * \~english max number of input_event per package.
+ */
+#define HAL_INPUT_EVENT_COUNT 64
+
+/**
+ * \~english Thread name defined
+ */
+#define HAL_INPUT_SOURCE_NAME "input_hal_mon"
+
+/**
+ * \~english Notify input event from touch panel,
+ * The data of the notification please refer the following two type.\n
+ * @ref HAL_INPUT_TOUCH_PRESS \n
+ * @ref HAL_INPUT_TOUCH_RELEASE \n
+ * Please use IF of NSFW as follows to receive this event.
+ * \~ @code
+ * l_eStatus = FrameworkunifiedAttachCallbackToDispatcher(happ, HAL_INPUT_SOURCE_NAME, HAL_INPUT_NOTIFY_TOUCH, fpOnCmd);
+ * @endcode
+ * \~english note:FrameworkunifiedAttachCallbacksToDispatcher is available, too.
+ */
+#define HAL_INPUT_NOTIFY_TOUCH 100
+/**
+ * \~english Notify input event from touch panel ESC-KEY,
+ * The data format of the notification please refer to @ref EventsPackageInput.\n
+ * Please use IF of NSFW as follows to receive this event.
+ * \~ @code
+ * l_eStatus = FrameworkunifiedAttachCallbackToDispatcher(happ, HAL_INPUT_SOURCE_NAME, HAL_INPUT_NOTIFY_ESC_KEY, fpOnCmd)
+ * @endcode
+ * \~english note:FrameworkunifiedAttachCallbacksToDispatcher is available, too.
+ */
+#define HAL_INPUT_NOTIFY_ESC_KEY 101
+/**
+ * \~english Notify input event from key board,
+ * The data format of the notification please refer to @ref EventsPackageInput.\n
+ * Please use IF of NSFW as follows to receive this event.
+ * \~ @code
+ * l_eStatus = FrameworkunifiedAttachCallbackToDispatcher(happ, HAL_INPUT_SOURCE_NAME, HAL_INPUT_NOTIFY_KEY_BOARD, fpOnCmd)
+ * @endcode
+ * \~english note:FrameworkunifiedAttachCallbacksToDispatcher is available, too.
+ */
+#define HAL_INPUT_NOTIFY_KEY_BOARD 102
+/**
+ * \~english Notify input event from steering,
+ * The data format of the notification please refer to @ref EventsPackageInput.\n
+ * Please use IF of NSFW as follows to receive this event.
+ * \~ @code
+ * l_eStatus = FrameworkunifiedAttachCallbackToDispatcher(happ, HAL_INPUT_SOURCE_NAME, HAL_INPUT_NOTIFY_STEERING, fpOnCmd)
+ * @endcode
+ * \~english note:FrameworkunifiedAttachCallbacksToDispatcher is available, too.
+ */
+#define HAL_INPUT_NOTIFY_STEERING 104
+/**
+ * \~english Notify input event from tablet finger,
+ * The data format of the notification please refer to @ref EventsPackageInput.\n
+ * Please use IF of NSFW as follows to receive this event.
+ * \~ @code
+ * l_eStatus = FrameworkunifiedAttachCallbackToDispatcher(happ, HAL_INPUT_SOURCE_NAME, HAL_INPUT_NOTIFY_TABLET_FINGER, fpOnCmd)
+ * @endcode
+ * \~english note:FrameworkunifiedAttachCallbacksToDispatcher is available, too.
+ */
+#define HAL_INPUT_NOTIFY_TABLET_FINGER 105
+/**
+ * \~english Notify input event from rotary-key,
+ * The data format of the notification please refer to @ref EventsPackageInput.\n
+ * Please use IF of NSFW as follows to receive this event.
+ * \~ @code
+ * l_eStatus = FrameworkunifiedAttachCallbackToDispatcher(happ, HAL_INPUT_SOURCE_NAME, HAL_INPUT_NOTIFY_ROTARY_KEY, fpOnCmd)
+ * @endcode
+ * \~english note:FrameworkunifiedAttachCallbacksToDispatcher is available, too.
+ */
+#define HAL_INPUT_NOTIFY_ROTARY_KEY 106
+
+/**
+ * \~english Initialzing touch result notify,
+ * The data format of the notification please refer to @ref TouchInitFinishInput.\n
+ * Please use IF of NSFW as follows to receive this event.
+ * \~ @code
+ * l_eStatus = FrameworkunifiedAttachCallbackToDispatcher(happ, HAL_INPUT_SOURCE_NAME, HAL_INPUT_NOTIFY_TOUCH_INIT_FINISH, fpOnCmd)
+ * @endcode
+ * \~english note:FrameworkunifiedAttachCallbacksToDispatcher is available, too.
+ */
+#define HAL_INPUT_NOTIFY_TOUCH_INIT_FINISH 120
+
+/**
+ * @struct RadioInfoTouch
+ * \~english @par Brief
+ * Radio information
+ */
+struct RadioInfoTouch {
+ /**
+ * \~english Radio band type
+ * \~english Please ref to @ref HalInputBandType
+ */
+ int16_t band;
+ /**
+ * \~english Frequency of the tuner[kHz]
+ * (Use only at the time of AM reception)
+ */
+ uint16_t freq;
+ /**
+ * \~english Reception status (Use only at the time of AM reception)
+ * \~english Please refer to @ref HalInputBandType
+ */
+ int32_t status;
+};
+
+/**
+ * @struct SelftestTouch
+ * \~english @par Brief
+ * Touch panel selftest mode result
+ */
+struct SelftestTouch {
+ /**
+ * \~english Touch panel selftest mode result
+ */
+ unsigned char r_code;
+ /**
+ * \~english Touch panel selftest mode data.
+ * The datail info is depend on hardware spec.
+ */
+ unsigned char r_data[HAL_INPUT_TOUCH_SELFTEST_DATA_LEN];
+};
+
+/**
+ * @struct EventsPackageInput
+ * \~english @par Brief
+ * Input event package defined
+ */
+struct EventsPackageInput {
+ /**
+ * \~english device type
+ */
+ int device_type;
+ /**
+ * \~english event count
+ */
+ int count;
+ /**
+ * \~english input event data.
+ */
+ struct input_event event[HAL_INPUT_EVENT_COUNT];
+};
+
+/**
+ * @struct TouchInitFinishInput
+ * \~english @par Brief
+ * The result of initializing touch
+ */
+struct TouchInitFinishInput {
+ /**
+ * \~english If initializing the touch successful, the result was set HAL_INPUT_RET_NORMAL.
+ * If an error occurred, the result was set HAL_INPUT_RET_ERROR.
+ */
+ int result;
+};
+/************************************************************************
+* Function prototype *
+************************************************************************/
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup input_hal
+/// \~english @par Brief
+/// initializing input_hal.
+/// \~english @param [in] app_name
+/// const char* - the app name for receive input event.
+/// \~english @retval HAL_INPUT_RET_NORMAL : Success
+/// \~english @retval HAL_INPUT_RET_ERROR : Process abnormality
+/// \~english @par Prerequisite
+/// - Have called @ref InitTouch()
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - Listen input devices and send input event.
+/// - After initializing touch panel, the event(@ref HAL_INPUT_NOTIFY_TOUCH_INIT_FINISH) will be sent.
+/// - The API can be used by 1 process.
+/// \~english @see None.
+////////////////////////////////////////////////////////////////////////////////
+int InitInput(const char* app_name);
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup input_hal
+/// \~english @par Brief
+/// finalize input_hal
+/// \~english @param none
+/// \~english @retval HAL_INPUT_RET_NORMAL : Success
+/// \~english @par Prerequisite
+/// - None
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - This API is to finalize input_hal.
+/// - The API can be used by 1 process.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+int DeInitInput();
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup input_hal
+/// \~english @par Brief
+/// Init those operating function of touch panel driver
+/// \~english @param none
+/// \~english @retval HAL_INPUT_RET_NORMAL : Success
+/// \~english @par Prerequisite
+/// - Touch panel function exist
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - None
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - The API is a block I/F which initializes those operating functions of touch panel driver.
+/// - The API can be used by 1 process.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+int InitTouch();
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup input_hal
+/// \~english @par Brief
+/// Make touch panel start work
+/// \~english @param none
+/// \~english @retval HAL_INPUT_RET_NORMAL : Success
+/// \~english @retval HAL_INPUT_RET_ERROR : Process abnormality
+/// \~english @par Prerequisite
+/// - Have called @ref InitTouch()
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - Haven't called @ref InitTouch()
+/// - @ref HAL_INPUT_RET_ERROR
+/// - Inner io error
+/// - @ref HAL_INPUT_RET_ERROR
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - This API is to prepare touch panel and make it start work.
+/// - The API can be used by 1 process.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+int StartTouch();
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup input_hal
+/// \~english @par Brief
+/// Execute touch panel self test
+/// \~english @param [in] id
+/// int - selftest id(Pass HAL_INPUT_TOUCH_SELFTEST_ID_ALL :
+/// Execute all test(disconnection check))
+/// \~english @param [out] result
+/// void* - Touch panel selftest mode check result
+/// \~english @note Result struct SelftestTouch depend on hardware spec
+/// \~english @retval HAL_INPUT_RET_NORMAL : Success
+/// \~english @retval HAL_INPUT_RET_ERROR : Process abnormality
+/// \~english @retval HAL_INPUT_RET_NOT_SUPPORT : Not support
+/// \~english @par Prerequisite
+/// - Have called @ref InitTouch()
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - Haven't called @ref InitTouch()
+/// - @ref HAL_INPUT_RET_ERROR
+/// - Not support this function
+/// - @ref HAL_INPUT_RET_NOT_SUPPORT
+/// - Param result is NULL
+/// - @ref HAL_INPUT_RET_ERROR
+/// - Inner io error
+/// - @ref HAL_INPUT_RET_ERROR
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - This API is to execute touch panel self test and get test result.
+/// - The API can be used by 1 process.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+int SelfTestTouch(int id, void *result);
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup input_hal
+/// \~english @par Brief
+/// Set whether the driver sends touch panel data or not.
+/// \~english @param [in] status
+/// int - Touch panel whether report/unreport event\n
+/// HAL_INPUT_TOUCH_REPORT : Report touch panel's touch event\n
+/// HAL_INPUT_TOUCH_UNREPORT : Don't report touch panel's touch event\n
+/// \~english @retval HAL_INPUT_RET_NORMAL : Success
+/// \~english @retval HAL_INPUT_RET_ERROR : Process abnormality
+/// \~english @retval HAL_INPUT_RET_NOT_SUPPORT : Not support
+/// \~english @note It means this API isn't support when return
+/// @ref HAL_INPUT_RET_NOT_SUPPORT.
+/// The user need to implement it
+/// if don't need to report touch event.
+/// \~english @par Prerequisite
+/// - Have called @ref InitTouch()
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - Haven't called @ref InitTouch()
+/// - @ref HAL_INPUT_RET_ERROR
+/// - Not support this function
+/// - @ref HAL_INPUT_RET_NOT_SUPPORT
+/// - Status is none of @ref HAL_INPUT_TOUCH_REPORT /
+/// @ref HAL_INPUT_TOUCH_UNREPORT
+/// - @ref HAL_INPUT_RET_ERROR
+/// - Inner io error
+/// - @ref HAL_INPUT_RET_ERROR
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - This API is to set whether the driver sends touch panel data or not.
+/// - The API can be used by 1 process.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+int LockTouch(int status);
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup input_hal
+/// \~english @par Brief
+/// Suspend touch panel
+/// \~english @param none
+/// \~english @retval HAL_INPUT_RET_NORMAL : Success
+/// \~english @retval HAL_INPUT_RET_ERROR : Process abnormality
+/// \~english @retval HAL_INPUT_RET_NOT_SUPPORT : Not support
+/// \~english @note It means this API isn't support when return
+/// @ref HAL_INPUT_RET_NOT_SUPPORT.
+/// The user need to implement it
+/// if don't need to report touch event.
+/// \~english @par Prerequisite
+/// - Have called @ref InitTouch()
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - Haven't called @ref InitTouch()
+/// - @ref HAL_INPUT_RET_ERROR
+/// - Not support this function
+/// - @ref HAL_INPUT_RET_NOT_SUPPORT
+/// - Inner io error
+/// - @ref HAL_INPUT_RET_ERROR
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - This API is to suspend touch panel.
+/// - The API can be used by 1 process.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+int SuspendTouch();
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup input_hal
+/// \~english @par Brief
+/// Set touch panel sensitivity level
+/// \~english @param [in] level
+/// int - Sensitivity level.
+/// \~english @retval HAL_INPUT_RET_NORMAL : Success
+/// \~english @retval HAL_INPUT_RET_ERROR : Process abnormality
+/// \~english @retval HAL_INPUT_RET_NOT_SUPPORT : Not support
+/// \~english @par Prerequisite
+/// - Have called @ref InitTouch()
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - Haven't called @ref InitTouch()
+/// - @ref HAL_INPUT_RET_ERROR
+/// - Not support this function
+/// - @ref HAL_INPUT_RET_NOT_SUPPORT
+/// - Sensitivity level is none of @ref HalInputTouchSensitivityLevel
+/// - @ref HAL_INPUT_RET_ERROR
+/// - Inner io error
+/// - @ref HAL_INPUT_RET_ERROR
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - This API is to set touch panel sensitivity level.
+/// - The API can be used by 1 process.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+int SetSensitivityLevelTouch(int level);
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup input_hal
+/// \~english @par Brief
+/// Get touch panel sensitivity level
+/// \~english @param [out] level
+/// int* - Sensitivity level.
+/// \~english @retval HAL_INPUT_RET_NORMAL : Success
+/// \~english @retval HAL_INPUT_RET_ERROR : Process abnormality
+/// \~english @retval HAL_INPUT_RET_NOT_SUPPORT : Not support
+/// \~english @par Prerequisite
+/// - Have called @ref InitTouch()
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - Haven't called @ref InitTouch()
+/// - @ref HAL_INPUT_RET_ERROR
+/// - Not support this function
+/// - @ref HAL_INPUT_RET_NOT_SUPPORT
+/// - Param level is NULL
+/// - @ref HAL_INPUT_RET_ERROR
+/// - Inner io error
+/// - @ref HAL_INPUT_RET_ERROR
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - This API is to get touch panel sensitivity level.
+/// - The API can be used by 1 process.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+int GetSensitivityLevelTouch(int *level);
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup input_hal
+/// \~english @par Brief
+/// Notify radio scan frequency
+/// \~english @param [in] info
+/// RadioInfoTouch* - SCAN frequence info
+/// \~english @retval HAL_INPUT_RET_NORMAL : Success
+/// \~english @retval HAL_INPUT_RET_ERROR : Process abnormality
+/// \~english @retval HAL_INPUT_RET_NOT_SUPPORT : Not support
+/// \~english @par Prerequisite
+/// - Have called @ref InitTouch()
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - Haven't called @ref InitTouch()
+/// - @ref HAL_INPUT_RET_ERROR
+/// - Not support this function
+/// - @ref HAL_INPUT_RET_NOT_SUPPORT
+/// - Param info is NULL
+/// - @ref HAL_INPUT_RET_ERROR
+/// - Inner io error
+/// - @ref HAL_INPUT_RET_ERROR
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - This API is to notify radio scan frequency.
+/// - The API can be used by 1 process.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+int NotifyRadioScanFreqTouch(struct RadioInfoTouch *info);
+
+////////////////////////////////////////////////////////////////////////////////
+/// \ingroup input_hal
+/// \~english @par Brief
+/// Get panel resolution
+/// \~english @param [in] reso_h
+/// int* - horizontal resolution
+/// \~english @param [in] reso_v
+/// int* - vertical resolution
+/// \~english @retval HAL_INPUT_RET_NORMAL : Success
+/// \~english @retval HAL_INPUT_RET_ERROR : Process abnormality
+/// \~english @par Prerequisite
+/// - Have called @ref InitTouch()
+/// \~english @par Change of internal state
+/// - Change of internal state according to the API does not occur
+/// \~english @par Conditions of processing failure
+/// - Param reso_h or reso_v is NULL
+/// - @ref HAL_INPUT_RET_ERROR
+/// - Inner io error
+/// - @ref HAL_INPUT_RET_ERROR
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// Sync
+/// \~english @par Detail
+/// - This API is to get horizontal and vertical resolution.
+/// - The API can be used by 1 process.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////
+int GetPanelSpecResolutionInput(int *reso_h, int *reso_v);
+
+/** @}*/ // end of input_hal
+/** @}*/ // end of switchhandler
+
+#endif // HAL_API_INPUT_HAL_H_
diff --git a/hal_api/peripheral_service/aglinput.h b/hal_api/peripheral_service/aglinput.h
new file mode 100644
index 00000000..aa5f6ed8
--- /dev/null
+++ b/hal_api/peripheral_service/aglinput.h
@@ -0,0 +1,536 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * 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.
+ */
+#ifndef HAL_API_PERIPHERAL_SERVICE_AGLINPUT_H_
+#define HAL_API_PERIPHERAL_SERVICE_AGLINPUT_H_
+
+#include <peripheral_service/extinput.h>
+
+/*
+ * Extended Area for AGL
+ * In this file the Key definition based on the specification
+ * Redefine with '#undef/#define
+ */
+enum{
+ /**
+ * FP Switch : 0x0001 - 0x0064
+ * */
+ KEY_FP_TOP = 0x001,
+ KEY_FP_SW1 = KEY_FP_TOP,
+ KEY_FP_SW2 ,
+ KEY_FP_SW3 ,
+ KEY_FP_SW4 ,
+ KEY_FP_SW5 ,
+ KEY_FP_SW6 ,
+ KEY_FP_SW7 ,
+ KEY_FP_SW8 ,
+ KEY_FP_SW9 ,
+ KEY_FP_SW10 ,
+ KEY_FP_SW11 ,
+ KEY_FP_SW12 ,
+ KEY_FP_SW13 ,
+ KEY_FP_SW14 ,
+ KEY_FP_SW15 ,
+ KEY_FP_SW16 ,
+ KEY_FP_SW17 ,
+ KEY_FP_SW18 ,
+ KEY_FP_SW19 ,
+ KEY_FP_SW20 ,
+ KEY_FP_SW21 ,
+ KEY_FP_SW22 ,
+ KEY_FP_SW23 ,
+ KEY_FP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HAL_TOUCHPAD_DUMMY12,
+ KEY_INPUTHAL_TOUCH_POINT_3,
+ KEY_INPUTHAL_TOUCH_POINT_2,
+ KEY_INPUTHAL_PUSH,
+ KEY_INPUTHAL_TAP_SINGLE,
+ KEY_INPUTHAL_TAP_DOUBLE,
+ KEY_INPUTHAL_SW16,
+ KEY_INPUTHAL_NAVI,
+ KEY_INPUTHAL_HOME,
+ KEY_INPUTHAL_MEM1,
+ KEY_INPUTHAL_MEM2,
+ KEY_INPUTHAL_RECENT_JP,
+ KEY_INPUTHAL_WEB,
+ KEY_INPUTHAL_DEST_ERACE,
+ KEY_INPUTHAL_MENU_SEARCH,
+ KEY_INPUTHAL_MENU_GO_HOME,
+ KEY_INPUTHAL_MENU_RECENT_NA,
+ KEY_INPUTHAL_MENU_FAVORITE,
+ KEY_INPUTHAL_MENU_CONTACT,
+ KEY_INPUTHAL_MENU_OTHERS,
+ KEY_INPUTHAL_MENU_SUBSCREEN_NAVI,
+ KEY_INPUTHAL_INVALID_SW ,
+ KEY_INPUTHAL_BOTTOM = KEY_INPUTHAL_INVALID_SW,
+};
+
+#define BTN_TAP_DOUBLE KEY_INPUTHAL_SW10
+
+#define REL_PINCH 0x0a
+
+#endif // HAL_API_PERIPHERAL_SERVICE_AGLINPUT_H_
diff --git a/hal_api/peripheral_service/extinput.h b/hal_api/peripheral_service/extinput.h
new file mode 100644
index 00000000..0265a2dc
--- /dev/null
+++ b/hal_api/peripheral_service/extinput.h
@@ -0,0 +1,27 @@
+/*
+ * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * 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.
+ */
+#ifndef HAL_API_PERIPHERAL_SERVICE_EXTINPUT_H_
+#define HAL_API_PERIPHERAL_SERVICE_EXTINPUT_H_
+
+#include <linux/input.h>
+
+/*
+ * Extended fields for each supplier
+ * If you want to modify the key definition at the supplier,
+ * redefine with '#undef/#define in this file.
+ */
+
+#endif // HAL_API_PERIPHERAL_SERVICE_EXTINPUT_H_
diff --git a/inc/input_drm.h b/inc/input_drm.h
new file mode 100644
index 00000000..11ffc328
--- /dev/null
+++ b/inc/input_drm.h
@@ -0,0 +1,22 @@
+/*
+ * @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * 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.
+ */
+
+#ifndef INC_INPUT_DRM_H_
+#define INC_INPUT_DRM_H_
+
+int GetPanelSpecResolutionInput(int *reso_h, int *reso_v);
+
+#endif // INC_INPUT_DRM_H_
diff --git a/inc/input_hal_debug.h b/inc/input_hal_debug.h
new file mode 100644
index 00000000..2fb7d86d
--- /dev/null
+++ b/inc/input_hal_debug.h
@@ -0,0 +1,57 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * 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.
+ */
+
+#ifndef INC_INPUT_HAL_DEBUG_H_
+#define INC_INPUT_HAL_DEBUG_H_
+
+#include "input_hal_frameworkunifiedlog.h"
+
+// #define INPUT_DEBUG
+
+#ifdef INPUT_DEBUG
+#define INPUT_DBG_LOG(zone_index, fmt, ...) \
+ FRAMEWORKUNIFIEDLOG(zone_index, __FUNCTION__, fmt, ## __VA_ARGS__);
+#else
+#define INPUT_DBG_LOG(zone_index, fmt, ...)
+#endif
+
+/* Log output control flag */
+#define INPUT_LOG_ENABLE_TRACE /* Normal log(Trace) */
+#define INPUT_LOG_ENABLE_ERROR /* Error log */
+#define INPUT_LOG_ENABLE_RETAIL /* Debug log */
+
+#ifdef INPUT_LOG_ENABLE_TRACE
+#define INPUT_LOG_TRACE(fmt, ...) \
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, fmt, ## __VA_ARGS__);
+#else
+#define INPUT_LOG_TRACE(fmt, ...)
+#endif
+
+#ifdef INPUT_LOG_ENABLE_ERROR
+#define INPUT_ERROR_LOG(fmt, ...) \
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, fmt, ## __VA_ARGS__);
+#else
+#define INPUT_ERROR_LOG(fmt, ...)
+#endif
+
+#ifdef INPUT_LOG_ENABLE_RETAIL
+#define INPUT_RETAIL_LOG(fmt, ...) \
+ FRAMEWORKUNIFIEDLOG(ZONE_HMI_DBG, __FUNCTION__, fmt, ## __VA_ARGS__);
+#else
+#define INPUT_RETAIL_LOG(fmt, ...)
+#endif
+
+#endif // INC_INPUT_HAL_DEBUG_H_
diff --git a/inc/input_hal_frameworkunifiedlog.h b/inc/input_hal_frameworkunifiedlog.h
new file mode 100644
index 00000000..c54f16a4
--- /dev/null
+++ b/inc/input_hal_frameworkunifiedlog.h
@@ -0,0 +1,76 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * 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.
+ */
+#ifndef INC_INPUT_HAL_FRAMEWORKUNIFIEDLOG_H_
+#define INC_INPUT_HAL_FRAMEWORKUNIFIEDLOG_H_
+
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_28 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LSHAREDMEM) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_ERR, ZONE_WARN, ZONE_INFO
+#endif
+
+extern const CHAR AppName[]; // NOLINT (defind outside)
+#endif // INC_INPUT_HAL_FRAMEWORKUNIFIEDLOG_H_
diff --git a/inc/input_hal_internal.h b/inc/input_hal_internal.h
new file mode 100644
index 00000000..4e57aed9
--- /dev/null
+++ b/inc/input_hal_internal.h
@@ -0,0 +1,107 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * 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.
+ */
+
+#ifndef INC_INPUT_HAL_INTERNAL_H_
+#define INC_INPUT_HAL_INTERNAL_H_
+
+/*
+ * Touch panel operation function info
+ */
+struct TouchHal {
+ /**
+ * \~english Make touch panel start work.
+ */
+ int (* start)(void);
+ /**
+ * \~english Get touch panel device horizontal resolution.
+ */
+ int (* get_reso_h)(int *);
+ /**
+ * \~english Get touch panel device vertical resolution.
+ */
+ int (* get_reso_v)(int *);
+ /**
+ * \~english Get whether X axis is inversion.
+ */
+ int (* get_reverse_axis_x)(bool *);
+ /**
+ * \~english Get whether Y axis is inversion.
+ */
+ int (* get_reverse_axis_y)(bool *);
+ /**
+ * \~english Config touch panel.
+ */
+ int (* config)(const char *, int, int);
+ /**
+ * \~english Get touch panel device name.
+ */
+ int (* get_touch_devicename)(char*, size_t);
+ /**
+ * \~english Get touch panel key device name.
+ */
+ int (* get_key_devicename)(char*, size_t);
+ /**
+ * \~english Execute touch panel self test.
+ */
+ int (* selftest)(int, void *);
+ /**
+ * \~english Get touch panel config status.
+ */
+ int (* get_config_status)(int *);
+ /**
+ * \~english Set whether the driver sends touch panel data or not.
+ */
+ int (* set_touch_lock)(int);
+ /**
+ * \~english Request touch panel touch suspend.
+ */
+ int (* set_touch_suspend)(void);
+ /**
+ * \~english Set touch panel sensitivity level.
+ */
+ int (* set_sensitivity_level)(int);
+ /**
+ * \~english Get touch panel sensitivity level.
+ */
+ int (* get_sensitivity_level)(int *);
+ /**
+ * \~english Notify radio scan frequency.
+ */
+ int (* notify_radio_scan_frequency)(struct RadioInfoTouch *);
+};
+
+
+/**
+ * Config touch panel
+ */
+int ConfigTouch(const char *path , int resolution_h, int resolution_v);
+
+/**
+ * Get touch panel device name
+ */
+int GetPanelNameTouch(char* name, size_t buf_length);
+
+/**
+ * Get touch panel key device name
+ */
+int GetKeyNameTouch(char* name, size_t buf_length);
+
+/**
+ * Get touch panel config status
+ */
+int GetConfigStatusTouch(int *status);
+
+#endif // INC_INPUT_HAL_INTERNAL_H_
diff --git a/inc/input_touch_ilitek.h b/inc/input_touch_ilitek.h
new file mode 100644
index 00000000..6d76d839
--- /dev/null
+++ b/inc/input_touch_ilitek.h
@@ -0,0 +1,27 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * 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.
+ */
+
+#ifndef INC_INPUT_TOUCH_ILITEK_H_
+#define INC_INPUT_TOUCH_ILITEK_H_
+
+#include "input_hal_internal.h"
+
+/*
+ * Init ilitek touch panel operation function
+ */
+int InputTouchIlitekInit(struct TouchHal *touch);
+
+#endif // INC_INPUT_TOUCH_ILITEK_H_
diff --git a/inc/input_udev_monitor.h b/inc/input_udev_monitor.h
new file mode 100644
index 00000000..0391f6f6
--- /dev/null
+++ b/inc/input_udev_monitor.h
@@ -0,0 +1,40 @@
+/*
+ * @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * 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.
+ */
+#ifndef INC_INPUT_UDEV_MONITOR_H_
+#define INC_INPUT_UDEV_MONITOR_H_
+
+#include <peripheral_service/aglinput.h>
+
+#include "input_util.h"
+
+#define INPUT_DEVICE_NODE_LENGTH_MAX (32)
+
+struct InputInputDeviceList{
+ int fd;
+ int device_assort;
+ char device_node[INPUT_DEVICE_NODE_LENGTH_MAX];
+ struct InputUtilList list;
+};
+
+struct InputUdevMonitorInfo {
+ struct udev *udev;
+ struct udev_monitor *monitor;
+ struct InputInputDeviceList dev_list;
+};
+
+int32_t InputUdevMonitorThreadCreate(void);
+
+#endif // INC_INPUT_UDEV_MONITOR_H_
diff --git a/inc/input_util.h b/inc/input_util.h
new file mode 100644
index 00000000..6d6a4009
--- /dev/null
+++ b/inc/input_util.h
@@ -0,0 +1,46 @@
+/*
+ * @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * 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.
+ */
+
+#ifndef INC_INPUT_UTIL_H_
+#define INC_INPUT_UTIL_H_
+
+#include <native_service/frameworkunified_types.h>
+
+struct InputUtilList {
+ struct InputUtilList *next;
+ struct InputUtilList *prev;
+};
+
+#define INPUT_INIT_LIST_HEAD(ptr) \
+ (ptr)->next = (ptr); (ptr)->prev = (ptr);
+
+#define input_list_entry(ptr, type, member) \
+ (reinterpret_cast<type *>( \
+ reinterpret_cast<char *>(ptr) - (size_t)(&(reinterpret_cast<type *>(0))->member)))
+
+#define input_list_for_each(pos, head) \
+ for (pos = (head)->next; pos != (head); pos = pos->next)
+
+#define input_list_for_each_safe(pos, n, head) \
+ for (pos = (head)->next, n = pos->next; pos != (head); \
+ pos = n, n = pos->next)
+
+void InputUtilListAdd(struct InputUtilList *node_new, struct InputUtilList *node_head);
+void InputUtilListDelete(struct InputUtilList *node);
+int InputUtilMCSend(HANDLE h_message, PCSTR source, UI_32 cmd, UI_32 length, PCVOID data);
+int InputUtilSleep(int usec);
+
+#endif // INC_INPUT_UTIL_H_
diff --git a/src/input_drm.cpp b/src/input_drm.cpp
new file mode 100644
index 00000000..20adf799
--- /dev/null
+++ b/src/input_drm.cpp
@@ -0,0 +1,128 @@
+/*
+ * @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * 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 "input_drm.h"
+
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#if defined(_USE_DRM)
+#include <xf86drm.h>
+#include <xf86drmMode.h>
+#endif
+
+#include "input_hal.h"
+#include "input_hal_debug.h"
+
+#define DIR_PATH "/dev/dri/card0"
+#define DEFAULT_RESOLUTION_HORIZONTAL 1280 /* Horizontal resolution default value */
+#define DEFAULT_RESOLUTION_VERTICAL 800 /* Vertical resolution default value */
+/**
+ * Panel resolution acquisition / GetPanelSpecResolutionInput
+ */
+int GetPanelSpecResolutionInput(int *reso_h, int *reso_v) {
+ if ((NULL == reso_h) || (NULL == reso_v)) {
+ return HAL_INPUT_RET_ERROR;
+ }
+
+#if defined(_USE_DRM)
+ int fd;
+ drmModeRes *resources = NULL;
+ drmModeConnector *connector = NULL;
+ drmModeEncoder *encoder = NULL;
+ drmModeCrtc *crtc = NULL;
+
+ fd = open(DIR_PATH, O_RDWR);
+ if (fd < 0) {
+ INPUT_ERROR_LOG("DRI Open Error=%s\n", DIR_PATH);
+ goto err_rtn;
+ }
+
+ resources = drmModeGetResources(fd);
+ if (!resources) {
+ INPUT_ERROR_LOG("No resources\n");
+ goto err_rtn;
+ }
+ if (2 > resources->count_connectors) {
+ INPUT_ERROR_LOG("DRI Connect Num Error connectors=%d\n",
+ resources->count_connectors);
+ goto err_rtn;
+ }
+
+ connector = drmModeGetConnector(fd, resources->connectors[1]);
+ if (!connector) {
+ INPUT_ERROR_LOG("No Connector\n");
+ goto err_rtn;
+ }
+
+ if ((DRM_MODE_CONNECTED == connector->connection) &&(connector->count_modes > 0)) {
+ } else {
+ INPUT_ERROR_LOG("Not found connected connector\n");
+ goto err_rtn;
+ }
+
+ encoder = drmModeGetEncoder(fd, connector->encoder_id);
+ if (!encoder) {
+ INPUT_ERROR_LOG("drmModeGetEncoder null\n");
+ goto err_rtn;
+ }
+
+ crtc = drmModeGetCrtc(fd, encoder->crtc_id);
+ if (!crtc) {
+ INPUT_ERROR_LOG("drmModeGetCrtc null\n");
+ goto err_rtn;
+ }
+
+ *reso_h = crtc->mode.hdisplay;
+ *reso_v = crtc->mode.vdisplay;
+
+ drmModeFreeCrtc(crtc);
+ drmModeFreeEncoder(encoder);
+ drmModeFreeConnector(connector);
+ drmModeFreeResources(resources);
+ close(fd);
+
+ INPUT_LOG_TRACE("width=%d height=%d\n", *reso_h, *reso_v);
+ return HAL_INPUT_RET_NORMAL;
+
+err_rtn:
+
+ if (encoder) {
+ drmModeFreeEncoder(encoder);
+ }
+ if (connector) {
+ drmModeFreeConnector(connector);
+ }
+ if (resources) {
+ drmModeFreeResources(resources);
+ }
+ if (fd >= 0) {
+ close(fd);
+ }
+
+ INPUT_ERROR_LOG("Use Default Resolution\n");
+ *reso_h = DEFAULT_RESOLUTION_HORIZONTAL;
+ *reso_v = DEFAULT_RESOLUTION_VERTICAL;
+
+ return HAL_INPUT_RET_ERROR;
+#else
+ *reso_h = DEFAULT_RESOLUTION_HORIZONTAL;
+ *reso_v = DEFAULT_RESOLUTION_VERTICAL;
+
+ return HAL_INPUT_RET_NORMAL;
+#endif
+}
diff --git a/src/input_hal.cpp b/src/input_hal.cpp
new file mode 100644
index 00000000..b5f49160
--- /dev/null
+++ b/src/input_hal.cpp
@@ -0,0 +1,267 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * 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 "input_hal.h"
+
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "input_hal_debug.h"
+#include "input_hal_internal.h"
+#include "input_touch_ilitek.h"
+#include "input_udev_monitor.h"
+
+// Touch panel operation function info
+static struct TouchHal g_input_touch_info = { 0 };
+
+char* g_app_name = NULL;
+static bool g_touch_inited = false;
+static bool g_input_inited = false;
+
+extern bool g_break_from_watch;
+extern pthread_t g_udev_monitor_thread;
+
+// Environment key name
+#define HAL_INPUT_TARGET_BOARD "TARGET_BOARD"
+// Reference board environment value of HAL_INPUT_TARGET_BOARD
+#define HAL_INPUT_REF_BOARD_NAME "agl_reference"
+// Invalid status of report touch panel's touch event
+#define HAL_INPUT_TOUCH_REPORT_INVALID (-1)
+
+/*
+ * Input device init.
+ */
+int InitInput(const char* app_name) {
+ if (NULL == app_name) {
+ INPUT_ERROR_LOG("param is error");
+ return HAL_INPUT_RET_ERROR;
+ }
+
+ if (!g_touch_inited) {
+ INPUT_ERROR_LOG("call InitTouch first.");
+ return HAL_INPUT_RET_ERROR;
+ }
+
+ if (g_input_inited) {
+ INPUT_ERROR_LOG("input inited.");
+ return HAL_INPUT_RET_ERROR;
+ }
+
+ g_break_from_watch = false;
+ if (NULL != g_app_name) {
+ delete[] g_app_name;
+ }
+
+ g_app_name = new char[strlen(app_name) + 1];
+ snprintf(g_app_name, strlen(app_name) + 1, "%s", app_name);
+ if (HAL_INPUT_RET_ERROR == InputUdevMonitorThreadCreate()) {
+ delete[] g_app_name;
+ g_app_name = NULL;
+ return HAL_INPUT_RET_ERROR;
+ }
+
+ g_input_inited = true;
+ return HAL_INPUT_RET_NORMAL;
+}
+
+/*
+ * Deinit input device
+ */
+int DeInitInput() {
+ g_break_from_watch = true;
+ void* ret_val = NULL;
+ if (NULL != g_app_name) {
+ delete[] g_app_name;
+ g_app_name = NULL;
+ }
+ if (g_udev_monitor_thread != static_cast<pthread_t>(-1)) {
+ pthread_join(g_udev_monitor_thread, &ret_val);
+ }
+ g_input_inited = false;
+ return HAL_INPUT_RET_NORMAL;
+}
+
+/*
+ * Init those operating function of touch panel driver
+ */
+int InitTouch() {
+ int ret = InputTouchIlitekInit(&g_input_touch_info);
+ g_touch_inited = true;
+ return ret;
+}
+
+/*
+ * Make touch panel start work
+ */
+int StartTouch() {
+ int ret = HAL_INPUT_RET_ERROR;
+
+ if (NULL != g_input_touch_info.start) {
+ ret = g_input_touch_info.start();
+ }
+
+ return ret;
+}
+
+/*
+ * Config touch panel
+ */
+int ConfigTouch(const char *path , int reso_h, int reso_v) {
+ int ret = HAL_INPUT_RET_ERROR;
+
+ if (NULL != g_input_touch_info.config) {
+ ret = g_input_touch_info.config(path, reso_h, reso_v);
+ }
+
+ return ret;
+}
+
+/*
+ * Get touch panel device name
+ */
+int GetPanelNameTouch(char* name, size_t buf_length) {
+ int ret = HAL_INPUT_RET_ERROR;
+
+ if (NULL != g_input_touch_info.get_touch_devicename) {
+ ret = g_input_touch_info.get_touch_devicename(name, buf_length);
+ }
+
+ return ret;
+}
+
+/*
+ * Get touch panel key device name
+ */
+int GetKeyNameTouch(char* name, size_t buf_length) {
+ int ret = HAL_INPUT_RET_ERROR;
+
+ if (NULL != g_input_touch_info.get_key_devicename) {
+ ret = g_input_touch_info.get_key_devicename(name, buf_length);
+ }
+
+ return ret;
+}
+
+/*
+ * Execute touch panel self test
+ */
+int SelfTestTouch(int id, void *result) {
+ int ret = HAL_INPUT_RET_ERROR;
+
+ if (NULL != g_input_touch_info.selftest) {
+ ret = g_input_touch_info.selftest(id, result);
+ }
+
+ return ret;
+}
+
+/*
+ * Get touch panel config status
+ */
+int GetConfigStatusTouch(int *status) {
+ int ret = HAL_INPUT_RET_ERROR;
+
+ if (NULL != g_input_touch_info.get_config_status) {
+ ret = g_input_touch_info.get_config_status(status);
+ }
+
+ return ret;
+}
+
+/*
+ * Set whether the driver sends touch panel data or not
+ */
+int LockTouch(int status) {
+ static int input_touch_lock_status = HAL_INPUT_TOUCH_REPORT_INVALID;
+
+ if (input_touch_lock_status == status) {
+ return HAL_INPUT_RET_NORMAL;
+ }
+
+ int ret = HAL_INPUT_RET_ERROR;
+ if (NULL != g_input_touch_info.set_touch_lock) {
+ ret = g_input_touch_info.set_touch_lock(status);
+ if (HAL_INPUT_RET_NORMAL == ret) {
+ input_touch_lock_status = status;
+ }
+ }
+
+ return ret;
+}
+
+/*
+ * Suspend touch panel
+ */
+int SuspendTouch() {
+ int ret = HAL_INPUT_RET_ERROR;
+
+ if (NULL != g_input_touch_info.set_touch_suspend) {
+ ret = g_input_touch_info.set_touch_suspend();
+ }
+
+ return ret;
+}
+
+/*
+ * Set touch panel sensitivity level
+ */
+int SetSensitivityLevelTouch(int level) {
+ int cur = HAL_INPUT_TOUCH_SENSITIVITY_LEVEL_NONE;
+
+ int ret = GetSensitivityLevelTouch(&cur);
+ if (HAL_INPUT_RET_NORMAL == ret) {
+ if (cur == level) {
+ // Don't need to update sensitivity level
+ INPUT_LOG_TRACE("already set level=%d", level);
+ } else {
+ if (NULL != g_input_touch_info.set_sensitivity_level) {
+ ret = g_input_touch_info.set_sensitivity_level(level);
+ } else {
+ ret = HAL_INPUT_RET_ERROR;
+ }
+ }
+ }
+
+ return ret;
+}
+
+/*
+ * Get touch panel sensitivity level
+ */
+int GetSensitivityLevelTouch(int *level) {
+ int ret = HAL_INPUT_RET_ERROR;
+
+ if (NULL != g_input_touch_info.get_sensitivity_level) {
+ ret = g_input_touch_info.get_sensitivity_level(level);
+ }
+
+ return ret;
+}
+
+/*
+ * Notify radio scan frequency
+ */
+int NotifyRadioScanFreqTouch(struct RadioInfoTouch *info) {
+ int ret = HAL_INPUT_RET_ERROR;
+
+ if (NULL != g_input_touch_info.notify_radio_scan_frequency) {
+ ret = g_input_touch_info.notify_radio_scan_frequency(info);
+ }
+
+ return ret;
+}
diff --git a/src/input_touch_ilitek.cpp b/src/input_touch_ilitek.cpp
new file mode 100644
index 00000000..9d1822a7
--- /dev/null
+++ b/src/input_touch_ilitek.cpp
@@ -0,0 +1,226 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * 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 "input_touch_ilitek.h"
+
+#include <unistd.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "input_hal.h"
+
+// Touch panel device name
+#define HAL_INPUT_ILITEK_TOUCH_DEVICE_NAME "ILITEK ILITEK Multi-Touch"
+// Touch panel key device name
+#define HAL_INPUT_ILITEK_KEY_DEVICE_NAME ""
+
+// Touch panel horizontal resolution value
+#define HAL_INPUT_TOUCH_RESOLUTION_HORIZONTAL 4816
+
+// Touch panel vertical resolution value
+#define HAL_INPUT_TOUCH_RESOLUTION_VERTICAL 2992
+
+/*
+ * Make touch panel start work
+ */
+static int InputTouchStart() {
+ return HAL_INPUT_RET_NORMAL;
+}
+
+/*
+ * Config touch panel
+ */
+static int InputTouchConfig(const char *path,
+ int resolution_h, int resolution_v) {
+ if (NULL == path) {
+ return HAL_INPUT_RET_ERROR;
+ }
+
+ if (-1 == ::access(path, F_OK)) {
+ return HAL_INPUT_RET_ERROR;
+ }
+ return HAL_INPUT_RET_NORMAL;
+}
+
+/*
+ * Get touch panel device name
+ */
+static int InputTouchGetDeviceName(char* name, size_t buf_length) {
+ if (NULL == name) {
+ return HAL_INPUT_RET_ERROR;
+ }
+
+ if (buf_length < (strlen(HAL_INPUT_ILITEK_TOUCH_DEVICE_NAME) + 1)) {
+ return HAL_INPUT_RET_ERROR;
+ }
+
+ snprintf(name, buf_length, "%s", HAL_INPUT_ILITEK_TOUCH_DEVICE_NAME);
+ return HAL_INPUT_RET_NORMAL;
+}
+
+/*
+ * Get touch panel key device name
+ */
+static int InputTouchGetKeyName(char* name, size_t buf_length) {
+ if (NULL == name) {
+ return HAL_INPUT_RET_ERROR;
+ }
+
+ if (buf_length < (strlen(HAL_INPUT_ILITEK_KEY_DEVICE_NAME) + 1)) {
+ return HAL_INPUT_RET_ERROR;
+ }
+
+ snprintf(name, buf_length, "%s", HAL_INPUT_ILITEK_KEY_DEVICE_NAME);
+ return HAL_INPUT_RET_NORMAL;
+}
+
+/*
+ * Get touch panel device horizontal resolution
+ */
+static int InputTouchGetDeviceHResolution(int *resolution) {
+ if (NULL == resolution) {
+ return HAL_INPUT_RET_ERROR;
+ }
+ *resolution = HAL_INPUT_TOUCH_RESOLUTION_HORIZONTAL;
+ return HAL_INPUT_RET_NORMAL;
+}
+
+/*
+ * Get touch panel device vertical resolution
+ */
+static int InputTouchGetDeviceVResolution(int *resolution) {
+ if (NULL == resolution) {
+ return HAL_INPUT_RET_ERROR;
+ }
+ *resolution = HAL_INPUT_TOUCH_RESOLUTION_VERTICAL;
+ return HAL_INPUT_RET_NORMAL;
+}
+
+/*
+ * Get whether X axis is inversion
+ */
+static int InputTouchGetXAxisReverse(bool* is_reverse) {
+ if (NULL == is_reverse) {
+ return HAL_INPUT_RET_ERROR;
+ }
+ *is_reverse = false;
+ return HAL_INPUT_RET_NORMAL;
+}
+
+/*
+ * Get whether Y axis is inversion
+ */
+static int InputTouchGetYAxisReverse(bool* is_reverse) {
+ if (NULL == is_reverse) {
+ return HAL_INPUT_RET_ERROR;
+ }
+ *is_reverse = false;
+ return HAL_INPUT_RET_NORMAL;
+}
+
+/*
+ * Execute touch panel self test
+ */
+static int InputTouchSelftest(int id, void *result) {
+ if (NULL == result) {
+ return HAL_INPUT_RET_ERROR;
+ }
+ return HAL_INPUT_RET_NOT_SUPPORT;
+}
+
+/*
+ * Get touch panel config status
+ */
+static int InputTouchGetConfigStatus(int *status) {
+ if (NULL == status) {
+ return HAL_INPUT_RET_ERROR;
+ }
+ *status = HAL_INPUT_TOUCH_CONFIG_OFF;
+ return HAL_INPUT_RET_NORMAL;
+}
+
+/*
+ * Set whether the driver sends touch panel data or not
+ */
+static int InputTouchSetTouchLock(int lock) {
+ if ((HAL_INPUT_TOUCH_UNREPORT == lock) ||
+ (HAL_INPUT_TOUCH_REPORT == lock)) {
+ return HAL_INPUT_RET_NOT_SUPPORT;
+ }
+ return HAL_INPUT_RET_ERROR;
+}
+
+/*
+ * Suspend touch panel
+ */
+static int InputTouchSetTouchSuspend() {
+ return HAL_INPUT_RET_NOT_SUPPORT;
+}
+
+/*
+ * Set touch panel sensitivity level
+ */
+static int InputTouchSetSensitivityLevel(int level) {
+ if ((HAL_INPUT_TOUCH_SENSITIVITY_LEVEL_LOW == level) ||
+ (HAL_INPUT_TOUCH_SENSITIVITY_LEVEL_MIDDLE == level) ||
+ (HAL_INPUT_TOUCH_SENSITIVITY_LEVEL_HIGH == level) ||
+ (HAL_INPUT_TOUCH_SENSITIVITY_LEVEL_NONE == level) ) {
+ return HAL_INPUT_RET_NOT_SUPPORT;
+ }
+ return HAL_INPUT_RET_ERROR;
+}
+
+/*
+ * Get touch panel sensitivity level
+ */
+static int InputTouchGetSensitivityLevel(int *level) {
+ if (NULL == level) {
+ return HAL_INPUT_RET_ERROR;
+ }
+
+ return HAL_INPUT_RET_NOT_SUPPORT;
+}
+
+/*
+ * Notify radio scan frequency
+ */
+static int InputTouchNotifyRadioScanFrequency(struct RadioInfoTouch *info) {
+ if (NULL == info) {
+ return HAL_INPUT_RET_ERROR;
+ }
+ return HAL_INPUT_RET_NOT_SUPPORT;
+}
+
+/*
+ * Init touch panel operation function
+ */
+int InputTouchIlitekInit(struct TouchHal *touch) {
+ touch->start = InputTouchStart;
+ touch->config = InputTouchConfig;
+ touch->get_touch_devicename = InputTouchGetDeviceName;
+ touch->get_key_devicename = InputTouchGetKeyName;
+ touch->get_reso_h = InputTouchGetDeviceHResolution;
+ touch->get_reso_v = InputTouchGetDeviceVResolution;
+ touch->get_reverse_axis_x = InputTouchGetXAxisReverse;
+ touch->get_reverse_axis_y = InputTouchGetYAxisReverse;
+ touch->selftest = InputTouchSelftest;
+ touch->get_config_status = InputTouchGetConfigStatus;
+ touch->set_touch_lock = InputTouchSetTouchLock;
+ touch->set_touch_suspend = InputTouchSetTouchSuspend;
+ touch->set_sensitivity_level = InputTouchSetSensitivityLevel;
+ touch->get_sensitivity_level = InputTouchGetSensitivityLevel;
+ touch->notify_radio_scan_frequency = InputTouchNotifyRadioScanFrequency;
+ return HAL_INPUT_RET_NORMAL;
+}
diff --git a/src/input_udev_monitor.cpp b/src/input_udev_monitor.cpp
new file mode 100644
index 00000000..5d8cc6b7
--- /dev/null
+++ b/src/input_udev_monitor.cpp
@@ -0,0 +1,566 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * 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 <errno.h>
+#include <fcntl.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/prctl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include <libudev.h>
+#include <native_service/ns_message_center_if.h>
+
+#include "input_hal.h"
+#include "input_hal_debug.h"
+#include "input_hal_internal.h"
+#include "input_drm.h"
+#include "input_udev_monitor.h"
+
+#define HAL_INPUT_UDEVMONITOR_THREADNAME "input_hal_udevm"
+#define max_value(x, y) ((x) > (y) ? (x) : (y))
+
+#define INPUT_VIRTUAL_INPUTDEVICE_NAME "/devices/virtual" /* Virtual device name created by SwitchManager */
+
+// Enough name length to contain node name
+#define INPUT_NODE_NAME_LENGTH 256
+
+#define TRACKING_ID_NONE -1
+
+static struct InputUdevMonitorInfo g_input_udevmonitor_info;
+static HANDLE g_sender_handle;
+static bool g_input_touch_init_notify = false;
+extern char* g_app_name; /* app name */
+bool g_break_from_watch = false; /* watch thread loop break flag */
+pthread_t g_udev_monitor_thread = -1; /* udev monitor thread */
+
+static void InputUdevMonitorTouchInitFinEventSend(int result) {
+ struct TouchInitFinishInput msg;
+
+ if (g_input_touch_init_notify) {
+ return;
+ }
+
+ if (NULL == g_sender_handle) {
+ g_sender_handle = McOpenSender(g_app_name);
+ }
+ msg.result = result;
+
+ InputUtilMCSend(
+ g_sender_handle, HAL_INPUT_SOURCE_NAME,
+ HAL_INPUT_NOTIFY_TOUCH_INIT_FINISH, sizeof(msg), &msg);
+ g_input_touch_init_notify = true;
+}
+
+static void InputUdevMonitorInputEventHandle(int fd, int device_type, int notify_id) {
+ ssize_t read_size;
+ struct EventsPackageInput events = {0};
+
+ read_size = read(fd, events.event, sizeof(events.event));
+ if (read_size > 0) {
+ events.count = read_size / sizeof(struct input_event);
+ events.device_type = device_type;
+
+ if (NULL == g_sender_handle) {
+ g_sender_handle = McOpenSender(g_app_name);
+ }
+
+ InputUtilMCSend(
+ g_sender_handle, HAL_INPUT_SOURCE_NAME,
+ notify_id, sizeof(events), &events);
+ }
+}
+
+static void InputUdevMonitorTouchEventHandle(int fd, int notify_id) {
+ ssize_t read_size;
+ struct input_event event[HAL_INPUT_EVENT_COUNT] = {0};
+ int touch_status;
+
+ read_size = read(fd, event, sizeof(event));
+
+ if (read_size > 0) {
+ if (NULL == g_sender_handle) {
+ g_sender_handle = McOpenSender(g_app_name);
+ }
+
+ int event_num = read_size / sizeof(struct input_event);
+
+ for (int index = 0; index < event_num; ++index) {
+ if (EV_ABS == event[index].type) {
+ if (event[index].code == ABS_MT_TRACKING_ID) {
+ if (TRACKING_ID_NONE == event[index].value) {
+ touch_status = HAL_INPUT_TOUCH_RELEASE;
+ } else {
+ touch_status = HAL_INPUT_TOUCH_PRESS;
+ }
+ InputUtilMCSend(
+ g_sender_handle, HAL_INPUT_SOURCE_NAME,
+ notify_id, sizeof(touch_status), &touch_status);
+ }
+ }
+ }
+ }
+}
+
+static int InputUdevMonitorDeviceAssort(struct udev_device *dev) {
+ const char *property;
+
+ char touch_key_device_name[INPUT_NODE_NAME_LENGTH] = { 0 };
+ GetKeyNameTouch(touch_key_device_name, sizeof(touch_key_device_name));
+ const char *sysattr_name = udev_device_get_sysattr_value(dev, "name");
+ if ((sysattr_name) &&
+ (0 == strcmp(touch_key_device_name, sysattr_name))) {
+ INPUT_LOG_TRACE("DeviceAssort : ESC_SW\n");
+ return HAL_INPUT_DEVICE_TOUCH_ESCKEY;
+ }
+
+ char touch_device_name[INPUT_NODE_NAME_LENGTH] = { 0 };
+ GetPanelNameTouch(touch_device_name, sizeof(touch_device_name));
+ sysattr_name = udev_device_get_sysattr_value(dev, "name");
+ if ((sysattr_name) &&
+ (0 == strcmp(touch_device_name, sysattr_name))) {
+ INPUT_LOG_TRACE("DeviceAssort : Touch\n");
+ return HAL_INPUT_DEVICE_TOUCH;
+ }
+
+ property = udev_device_get_property_value(dev, "ID_INPUT_KEYBOARD");
+ if ((property) && (strcmp("1", property) == 0)) {
+ INPUT_LOG_TRACE("DeviceAssort : KeyBoard\n");
+ return HAL_INPUT_DEVICE_KEYBOARD;
+ }
+
+ property = udev_device_get_property_value(dev, "ID_INPUT_TABLET");
+ if ((property) && (strcmp("1", property) == 0)) {
+ INPUT_LOG_TRACE("DeviceAssort : Tablet\n");
+ return HAL_INPUT_DEVICE_INVALID;
+ }
+
+ property = udev_device_get_property_value(dev, "ID_INPUT_TOUCHPAD");
+ if ((property) && (strcmp("1", property) == 0)) {
+ INPUT_LOG_TRACE("DeviceAssort : Touch pad\n");
+ return HAL_INPUT_DEVICE_TABLET_FINGER;
+ }
+
+ return HAL_INPUT_DEVICE_INVALID;
+}
+
+static void InputUdevMonitorDeviceListOutput(void) {
+ struct InputUtilList *p;
+
+ INPUT_LOG_TRACE("OutputList >> start ======================\n");
+ input_list_for_each(p, &g_input_udevmonitor_info.dev_list.list) {
+ struct InputInputDeviceList *entry = input_list_entry(p, struct InputInputDeviceList, list);
+ if (NULL != entry) {
+ INPUT_LOG_TRACE("FD: %d Device=%s Assort=%d\n",
+ entry->fd, entry->device_node, entry->device_assort);
+ }
+ }
+ INPUT_LOG_TRACE("OutputList << end ======================\n");
+}
+
+static void InputUdevMonitorDeviceListDelete(const char *node) {
+ struct InputUtilList *p;
+
+ input_list_for_each(p, &g_input_udevmonitor_info.dev_list.list) {
+ struct InputInputDeviceList *entry = input_list_entry(p, struct InputInputDeviceList, list);
+ if (strcmp(node, entry->device_node) == 0) {
+ close(entry->fd);
+ InputUtilListDelete(p);
+ free(entry);
+ break;
+ }
+ }
+ InputUdevMonitorDeviceListOutput();
+}
+
+static int InputUdevMonitorDeviceListAdd(int fd, int device_assort, const char *node) {
+ int ret = HAL_INPUT_RET_NORMAL;
+ struct InputInputDeviceList *p;
+
+ p = (struct InputInputDeviceList *) malloc(sizeof(struct InputInputDeviceList));
+ if (p) {
+ p->fd = fd;
+ p->device_assort = device_assort;
+
+ if (strlen(node) < INPUT_DEVICE_NODE_LENGTH_MAX) {
+ strncpy(p->device_node, node, sizeof(p->device_node) - 1);
+ InputUdevMonitorDeviceListDelete(node);
+ InputUtilListAdd(&p->list, &g_input_udevmonitor_info.dev_list.list);
+ } else {
+ ret = HAL_INPUT_RET_ERROR;
+ }
+ } else {
+ ret = HAL_INPUT_RET_ERROR;
+ }
+
+ InputUdevMonitorDeviceListOutput();
+
+ return ret;
+}
+
+static int InputUdevMonitorInputEventGrab(const char *node, struct udev_device *dev) {
+ int fd, rtn;
+
+ InputUdevMonitorDeviceListDelete(node);
+
+ fd = open(node, O_RDONLY);
+
+ if (fd < 0) {
+ INPUT_ERROR_LOG("ERR: open %s errno=%d \n", node, errno);
+ goto err_rtn;
+ }
+
+ rtn = ioctl(fd, EVIOCGRAB, 1);
+ if (rtn) {
+ INPUT_ERROR_LOG("ERR: ioctl grab %s \n", node);
+ goto err_rtn_close;
+ }
+ INPUT_LOG_TRACE("%s Grab \n", node);
+
+ /* Backup FD */
+ rtn = InputUdevMonitorDeviceListAdd(fd, InputUdevMonitorDeviceAssort(dev), node);
+ if (rtn) {
+ goto err_rtn_close;
+ }
+
+ return HAL_INPUT_RET_NORMAL;
+
+err_rtn_close:
+ close(fd);
+err_rtn:
+ INPUT_LOG_TRACE("%s Grab impossible \n", node);
+ return HAL_INPUT_RET_ERROR;
+}
+
+static void InputUdevMonitorFDSet(int *nfds, fd_set *fds) {
+ struct InputUtilList *p;
+
+ input_list_for_each(p, &g_input_udevmonitor_info.dev_list.list) {
+ struct InputInputDeviceList *entry = input_list_entry(p, struct InputInputDeviceList, list);
+
+ switch (entry->device_assort) {
+ case HAL_INPUT_DEVICE_TOUCH_ESCKEY:
+ case HAL_INPUT_DEVICE_TOUCH:
+ case HAL_INPUT_DEVICE_KEYBOARD:
+ case HAL_INPUT_DEVICE_TABLET_FINGER:
+ FD_SET(entry->fd, fds);
+ *nfds = max_value(*nfds, entry->fd);
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+static void InputUdevMonitorFDHandle(fd_set *fds) {
+ struct InputUtilList *p;
+
+ input_list_for_each(p, &g_input_udevmonitor_info.dev_list.list) {
+ struct InputInputDeviceList *entry = input_list_entry(p, struct InputInputDeviceList, list);
+ if (FD_ISSET(entry->fd, fds)) {
+ int notify_id = 0;
+ switch (entry->device_assort) {
+ case HAL_INPUT_DEVICE_TOUCH_ESCKEY:
+ notify_id = HAL_INPUT_NOTIFY_ESC_KEY;
+ break;
+ case HAL_INPUT_DEVICE_TOUCH:
+ notify_id = HAL_INPUT_NOTIFY_TOUCH;
+ break;
+ case HAL_INPUT_DEVICE_KEYBOARD:
+ notify_id = HAL_INPUT_NOTIFY_KEY_BOARD;
+ break;
+ case HAL_INPUT_DEVICE_TABLET_FINGER:
+ notify_id = HAL_INPUT_NOTIFY_TABLET_FINGER;
+ break;
+ default:
+ return;
+ }
+ if (notify_id == HAL_INPUT_NOTIFY_TOUCH) {
+ InputUdevMonitorTouchEventHandle(entry->fd, notify_id);
+ } else {
+ InputUdevMonitorInputEventHandle(entry->fd, entry->device_assort, notify_id);
+ }
+ }
+ }
+}
+
+static int InputUdevMonitorInit(void) {
+ g_input_udevmonitor_info.udev = udev_new();
+ if (NULL == g_input_udevmonitor_info.udev) {
+ INPUT_ERROR_LOG("ERR: udev_new ret=%d \n", errno);
+ return HAL_INPUT_RET_ERROR;
+ }
+
+ // create the udev monitor
+ g_input_udevmonitor_info.monitor = udev_monitor_new_from_netlink(g_input_udevmonitor_info.udev, "udev");
+ udev_monitor_filter_add_match_subsystem_devtype(g_input_udevmonitor_info.monitor, "input", NULL);
+
+ // start receiving hotplug events
+ udev_monitor_enable_receiving(g_input_udevmonitor_info.monitor);
+
+ INPUT_INIT_LIST_HEAD(&g_input_udevmonitor_info.dev_list.list)
+
+ return HAL_INPUT_RET_NORMAL;
+}
+
+static void InputUdevMonitorDeinit(void) {
+ // destroy the udev monitor
+ udev_monitor_unref(g_input_udevmonitor_info.monitor);
+ // destroy the udev object
+ udev_unref(g_input_udevmonitor_info.udev);
+
+ if (g_sender_handle != NULL) {
+ McClose(g_sender_handle);
+ g_sender_handle = NULL;
+ }
+
+ g_input_touch_init_notify = false;
+}
+
+static int InputUdevMonitorDevicesGet(void) {
+ int ret;
+ struct udev_enumerate *enumerate;
+ struct udev_list_entry *devices, *dev_list_entry;
+ char touch_device_name[INPUT_NODE_NAME_LENGTH] = { 0};
+ const char* sysattr_name;
+ bool input_touch_device_found = false;
+
+ // Create a list of the devices in the 'usb_device' subsystem.
+ enumerate = udev_enumerate_new(g_input_udevmonitor_info.udev);
+ udev_enumerate_add_match_subsystem(enumerate, "input");
+ udev_enumerate_scan_devices(enumerate);
+ devices = udev_enumerate_get_list_entry(enumerate);
+ GetPanelNameTouch(touch_device_name, sizeof(touch_device_name));
+
+ // Enumerate device list
+ udev_list_entry_foreach(dev_list_entry, devices) {
+ const char *path, *node;
+
+ // Get the filename of the /sys entry for the device and create a udev_device object (dev) representing it
+ path = udev_list_entry_get_name(dev_list_entry);
+ struct udev_device* dev = udev_device_new_from_syspath(g_input_udevmonitor_info.udev, path);
+ if (NULL == dev) continue;
+
+ // usb_device_get_devnode() returns the path to the device node itself in /dev.
+ node = udev_device_get_devnode(dev);
+ if (!node) {
+ udev_device_unref(dev);
+ continue;
+ }
+
+ // Filter device name is eventX
+ if (strncmp("event", udev_device_get_sysname(dev), sizeof("event") -1) != 0) {
+ udev_device_unref(dev);
+ continue;
+ }
+
+ // virtual device
+ if (strncmp(INPUT_VIRTUAL_INPUTDEVICE_NAME, udev_device_get_devpath(dev),
+ sizeof(INPUT_VIRTUAL_INPUTDEVICE_NAME) - 1) == 0) {
+ INPUT_LOG_TRACE("Found Virtual Device : %s \n", node);
+ udev_device_unref(dev);
+ continue;
+ }
+
+ // check parent is input
+ struct udev_device* input_dev = udev_device_get_parent_with_subsystem_devtype(dev, "input", NULL);
+ if (NULL == input_dev) {
+ udev_device_unref(dev);
+ continue;
+ }
+
+ sysattr_name = udev_device_get_sysattr_value(input_dev, "name");
+ if (NULL == sysattr_name) {
+ INPUT_ERROR_LOG("ERR: Unable to find sysattr \n");
+ udev_device_unref(dev);
+ continue;
+ }
+
+ // touchpanel device
+ if (0 == strcmp(touch_device_name, sysattr_name)) {
+ INPUT_LOG_TRACE("Found %s : %s \n", touch_device_name, path);
+ int spec_reso_h;
+ int spec_reso_v;
+ GetPanelSpecResolutionInput(&spec_reso_h, &spec_reso_v);
+ ret = ConfigTouch(udev_device_get_syspath(input_dev),
+ spec_reso_h, spec_reso_v);
+
+ if (HAL_INPUT_RET_NORMAL == ret) {
+ int status;
+ ret = GetConfigStatusTouch(&status);
+ if (HAL_INPUT_RET_NORMAL == ret) {
+ if (HAL_INPUT_TOUCH_CONFIG_OFF == status) {
+ InputUdevMonitorTouchInitFinEventSend(HAL_INPUT_RET_NORMAL);
+ }
+ } else {
+ INPUT_ERROR_LOG("GetConfigStatusTouch fail\n");
+ InputUdevMonitorTouchInitFinEventSend(HAL_INPUT_RET_ERROR);
+ }
+ } else {
+ INPUT_ERROR_LOG("ConfigTouch fail\n");
+ InputUdevMonitorTouchInitFinEventSend(HAL_INPUT_RET_ERROR);
+ }
+
+ input_touch_device_found = true;
+ }
+
+ INPUT_LOG_TRACE("Found Device : %s \n", node);
+
+ /* Modified not to notify input events to other processes */
+ InputUdevMonitorInputEventGrab(node, input_dev);
+
+ udev_device_unref(dev);
+ } // end foreach
+
+ if (!input_touch_device_found) {
+ INPUT_ERROR_LOG("ERR: Dummy Device Create");
+ InputUdevMonitorTouchInitFinEventSend(HAL_INPUT_RET_NORMAL);
+ }
+
+ // Free the enumerator object
+ udev_enumerate_unref(enumerate);
+
+ return HAL_INPUT_RET_NORMAL;
+}
+
+static void InputUdevMonitorDeviceStatusChange(int fd, fd_set *fds) {
+ if (FD_ISSET(fd, fds)) {
+ // receive the relevant device
+ struct udev_device* dev = udev_monitor_receive_device(g_input_udevmonitor_info.monitor);
+ if (NULL == dev) return;
+
+ // input_udev_DevicesGet(udm);
+ const char* action = udev_device_get_action(dev);
+ const char* node = udev_device_get_devnode(dev);
+ if ((!action) || (!node)) {
+ udev_device_unref(dev);
+ return;
+ }
+
+ if (strncmp("event", udev_device_get_sysname(dev), sizeof("event") -1) != 0) {
+ INPUT_LOG_TRACE("not event device %s \n", udev_device_get_sysname(dev));
+ udev_device_unref(dev);
+ return;
+ }
+
+ if (strncmp(INPUT_VIRTUAL_INPUTDEVICE_NAME, udev_device_get_devpath(dev),
+ sizeof(INPUT_VIRTUAL_INPUTDEVICE_NAME) - 1) == 0) {
+ udev_device_unref(dev);
+ return;
+ }
+
+ if (strcmp(action, "remove") == 0) {
+ InputUdevMonitorDeviceListDelete(node);
+ }
+
+ struct udev_device* input_dev = udev_device_get_parent_with_subsystem_devtype(dev, "input", NULL);
+ if (NULL == input_dev) {
+ udev_device_unref(dev);
+ return;
+ }
+ char touch_device_name[INPUT_NODE_NAME_LENGTH] = { 0};
+ GetPanelNameTouch(touch_device_name, sizeof(touch_device_name));
+ const char *sysattr_name = udev_device_get_sysattr_value(input_dev, "name");
+ if (NULL == sysattr_name) {
+ INPUT_ERROR_LOG("ERR: Unable to find sysattr \n");
+ udev_device_unref(dev);
+ return;
+ }
+
+ if (0 == strcmp(touch_device_name, sysattr_name)) {
+ if (strcmp(action, "remove") == 0) {
+ } else {
+ INPUT_LOG_TRACE("Found %s \n", touch_device_name);
+ InputUdevMonitorTouchInitFinEventSend(HAL_INPUT_RET_NORMAL);
+ }
+ }
+
+ INPUT_LOG_TRACE("%s : %s \n", node, action);
+ if (strcmp(action, "remove") == 0) {
+ } else {
+ /* Modified not to notify input events to other processes */
+ InputUdevMonitorInputEventGrab(node, input_dev);
+ }
+ udev_device_unref(dev);
+ }
+}
+
+static void InputUdevMonitorWatch(void) {
+ fd_set fds;
+ int fd = udev_monitor_get_fd(g_input_udevmonitor_info.monitor);
+
+ if (fd != -1) {
+ while (!g_break_from_watch) {
+ FD_ZERO(&fds);
+ FD_SET(fd, &fds);
+ int nfds = max_value(0, fd);
+
+ InputUdevMonitorFDSet(&nfds, &fds);
+
+ struct timeval timeout;
+ timeout.tv_sec = 0;
+ timeout.tv_usec = 100 * 1000;
+ int ret = select(nfds + 1, &fds, NULL, NULL, &timeout);
+ if (ret > 0) {
+ InputUdevMonitorDeviceStatusChange(fd, &fds);
+
+ InputUdevMonitorFDHandle(&fds);
+ }
+ }
+ } else {
+ INPUT_ERROR_LOG("ERR: udev_monitor_get_fd");
+ }
+}
+
+static void *InputUdevMonitorMain(void * arg) {
+ int rtn;
+ prctl(PR_SET_NAME, HAL_INPUT_UDEVMONITOR_THREADNAME);
+
+ rtn = InputUdevMonitorInit();
+ if (rtn != HAL_INPUT_RET_NORMAL) {
+ goto err_rtn;
+ }
+
+ /* Get input device */
+ InputUdevMonitorDevicesGet();
+
+ /* Input device monitoring (basically never get out from here) */
+ InputUdevMonitorWatch();
+
+ InputUdevMonitorDeinit();
+
+ return NULL;
+
+err_rtn:
+ INPUT_LOG_TRACE("pthread_detach\n");
+ return NULL;
+}
+
+int32_t InputUdevMonitorThreadCreate(void) {
+ int ret;
+
+ ret = pthread_create(&g_udev_monitor_thread, NULL, InputUdevMonitorMain, NULL);
+ if (ret != 0) {
+ INPUT_ERROR_LOG("ERR: pthread_create =%d\n", errno);
+ return HAL_INPUT_RET_ERROR;
+ }
+
+ return HAL_INPUT_RET_NORMAL;
+}
diff --git a/src/input_util.cpp b/src/input_util.cpp
new file mode 100644
index 00000000..bb349ebd
--- /dev/null
+++ b/src/input_util.cpp
@@ -0,0 +1,77 @@
+/*
+ * @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * 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 "input_util.h"
+
+#include <native_service/ns_message_center_if.h>
+#include <stdio.h>
+
+#include "input_hal.h"
+#include "input_hal_debug.h"
+
+#define INPUT_UTIL_MESSAGE_SEND_RETRY 3
+#define INPUT_UTIL_MESSAGE_SEND_WAIT 10000 /* RetryWait:10ms */
+/*
+ * InputUtilListAdd
+ */
+void InputUtilListAdd(struct InputUtilList *node_new, struct InputUtilList *node_head) {
+ node_new->prev = node_head;
+ node_new->next = node_head->next;
+ node_head->next = node_new;
+ node_new->next->prev = node_new;
+}
+
+/*
+ * InputUtilListDelete
+ */
+void InputUtilListDelete(struct InputUtilList *node) {
+ node->prev->next = node->next;
+ node->next->prev = node->prev;
+}
+
+/*
+ * InputUtilMCSend
+ */
+int InputUtilMCSend(HANDLE h_message, PCSTR source, UI_32 cmd, UI_32 length, PCVOID data) {
+ int i = 0;
+ EFrameworkunifiedStatus e_status; /* return value */
+
+ do {
+ e_status = McSend(h_message, source, cmd, length, data);
+ if (eFrameworkunifiedStatusOK == e_status) {
+ break;
+ }
+ InputUtilSleep(INPUT_UTIL_MESSAGE_SEND_WAIT);
+ } while (i++ < INPUT_UTIL_MESSAGE_SEND_RETRY);
+
+ if (e_status != eFrameworkunifiedStatusOK) {
+ INPUT_ERROR_LOG("ERR: MessageSend=%d \n", e_status);
+ }
+
+ return e_status;
+}
+
+/*
+ * InputUtilSleep
+ */
+int InputUtilSleep(int usec) {
+ struct timespec req;
+
+ req.tv_sec = 0;
+ req.tv_nsec = usec * 1000;
+ nanosleep(&req, NULL);
+
+ return HAL_INPUT_RET_NORMAL;
+}