Add SYSCOMMON_PLUGIN_MODULE_DEVICED_INPUT for input plugin module.
[Detailed description]
1. Newly added SYSCOMMON_PLUGIN_MODULE_DEVICED_INPUT plugin module
- module : SYSCOMMON_PLUGIN_MODULE_DEVICED_INPUT
- library_name : "/usr/lib/system/plugin/libplugin-backend-deviced-input.so"
- library_name_64bit : "/usr/lib64/system/plugin/libplugin-backend-deviced-input.so"
- symbol_name : "system_plugin_backend_deviced_input_data"
2. Newly added SYSCOMMON_PLUGIN_MODULE_DEVICED_INPUT plugin api
- int syscommon_plugin_deviced_input_get_backend(void)
: Load Deviced input plugin-backend from above library_name/library_name_64bit path
- int syscommon_plugin_deviced_input_put_backend(void);
: Unload Deviced input plugin-backend
- void syscommon_plugin_deviced_input_event_cb(struct timeval time, unsigned short type,
unsigned short keycode, unsigned int keyvalue);
: Callback function to handle the key event when input key event happen
Change-Id: I0194c88da69abff226c92846637c0e000d58e019
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
SYSCOMMON_PLUGIN_MODULE_UNKNOWN = 0,
SYSCOMMON_PLUGIN_MODULE_RESOURCED_MEMORY_LMK,
SYSCOMMON_PLUGIN_MODULE_DEVICED_BATTERY,
+ SYSCOMMON_PLUGIN_MODULE_DEVICED_INPUT,
SYSCOMMON_PLUGIN_MODULE_END,
};
.backend_min_abi_version = SYSCOMMON_PLUGIN_ABI_VERSION_TIZEN_8_0,
},
},
+ [SYSCOMMON_PLUGIN_MODULE_DEVICED_INPUT] = {
+ [0] = {
+ .platform_abi_version = SYSCOMMON_PLUGIN_ABI_VERSION_TIZEN_8_0,
+ .backend_min_abi_version = SYSCOMMON_PLUGIN_ABI_VERSION_TIZEN_8_0,
+ },
+ },
};
static struct __plugin_module_info g_plugin_module_info[] = {
.num_abi_versions = ARRAY_SIZE(abi_version_match_data[SYSCOMMON_PLUGIN_MODULE_DEVICED_BATTERY]),
.abi_versions = abi_version_match_data[SYSCOMMON_PLUGIN_MODULE_DEVICED_BATTERY],
},
+ [SYSCOMMON_PLUGIN_MODULE_DEVICED_INPUT] = {
+ .group = PLUGIN_GROUP_DEVICED,
+ .module = SYSCOMMON_PLUGIN_MODULE_DEVICED_INPUT,
+ .license = PLUGIN_LICENSE_APACHE_2_0,
+ .module_name = "SYSCOMMON_PLUGIN_MODULE_DEVICED_INPUT",
+ .backend_module_name = "deviced-input",
+ .library_name = "/usr/lib/system/plugin/libplugin-backend-deviced-input.so",
+ .library_name_64bit = "/usr/lib64/system/plugin/libplugin-backend-deviced-input.so",
+ .symbol_name = "system_plugin_backend_deviced_input_data",
+ .num_abi_versions = ARRAY_SIZE(abi_version_match_data[SYSCOMMON_PLUGIN_MODULE_DEVICED_INPUT]),
+ .abi_versions = abi_version_match_data[SYSCOMMON_PLUGIN_MODULE_DEVICED_INPUT],
+ },
};
#endif /* __PLUGIN_API_LIST_H__ */
# to PKG_MODULES.
SET(SRCS src/syscommon-plugin-deviced-display.c
src/syscommon-plugin-deviced-battery.c
+ src/syscommon-plugin-deviced-input.c
../common/src/syscommon-plugin-api-common.c
../common/src/syscommon-plugin-api-conf.c)
--- /dev/null
+/**
+ * MIT License
+ *
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is furnished
+ * to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#ifndef __SYSCOMMON_PLUGIN_DEVICED_INPUT_INTERFACE_H__
+#define __SYSCOMMON_PLUGIN_DEVICED_INPUT_INTERFACE_H__
+
+#include <time.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define SYSCOMMON_DEVICED_INPUT_KEY_RELEASED 0
+#define SYSCOMMON_DEVICED_INPUT_KEY_PRESSED 1
+#define SYSCOMMON_DEVICED_INPUT_KEY_BEING_PRESSED 2
+
+typedef struct _syscommon_plugin_backend_deviced_input_funcs {
+ void (*input_event_cb)(struct timeval time, unsigned short type,
+ unsigned short keycode, unsigned int keyvalue);
+} syscommon_plugin_backend_deviced_input_funcs;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //__SYSCOMMON_PLUGIN_DEVICED_input_INTERFACE_H__
--- /dev/null
+/**
+ * MIT License
+ *
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is furnished
+ * to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#ifndef __SYSCOMMON_PLUGIN_DEVICED_INPUT_H__
+#define __SYSCOMMON_PLUGIN_DEVICED_INPUT_H__
+
+#include <time.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Get the backend data of deviced-input module
+ * @return @c 0 on success, otherwise a negative error value
+ */
+int syscommon_plugin_deviced_input_get_backend(void);
+
+/**
+ * @brief Put the backend data of deviced-input module
+ * @return @c 0 on success, otherwise a negative error value
+ */
+int syscommon_plugin_deviced_input_put_backend(void);
+
+/**
+ * @brief Input event callback function
+ */
+void syscommon_plugin_deviced_input_event_cb(struct timeval time, unsigned short type,
+ unsigned short keycode, unsigned int keyvalue);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //__SYSCOMMON_PLUGIN_DEVICED_INPUT_H__
--- /dev/null
+/**
+ * MIT License
+ *
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is furnished
+ * to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+#include <glib.h>
+
+#include "syscommon-plugin-common.h"
+
+#include "common.h"
+#include "syscommon-plugin-deviced-input.h"
+#include "syscommon-plugin-deviced-input-interface.h"
+
+#ifndef EXPORT
+#define EXPORT __attribute__((visibility("default")))
+#endif
+
+static syscommon_plugin_backend_deviced_input_funcs *g_input_funcs = NULL;
+
+EXPORT
+int syscommon_plugin_deviced_input_get_backend(void)
+{
+ int ret = 0;
+
+ if (g_input_funcs)
+ return 0;
+
+ ret = syscommon_plugin_common_get_backend(
+ SYSCOMMON_PLUGIN_MODULE_DEVICED_INPUT,
+ (void **)&g_input_funcs);
+ if (ret < 0) {
+ _E("Failed to get deviced_input backend: %d", ret);
+ return ret;
+ }
+
+ _I("Success to get deviced_input backend: %d", ret);
+
+ return 0;
+}
+
+EXPORT
+int syscommon_plugin_deviced_input_put_backend(void)
+{
+ int ret = 0;
+
+ if (!g_input_funcs)
+ return 0;
+
+ ret = syscommon_plugin_common_put_backend(
+ SYSCOMMON_PLUGIN_MODULE_DEVICED_INPUT,
+ (void *)g_input_funcs);
+ if (ret < 0) {
+ _E("Failed to put deviced_input backend: %d", ret);
+ return ret;
+ }
+ g_input_funcs = NULL;
+
+ _I("Success to put deviced_input backend: %d", ret);
+
+ return 0;
+}
+
+EXPORT
+void syscommon_plugin_deviced_input_event_cb(struct timeval time, unsigned short type,
+ unsigned short keycode, unsigned int keyvalue)
+{
+ if (!g_input_funcs) {
+ _E("Failed to get device_input backend : -ENOTSUP\n");
+ return;
+ }
+
+ if (!g_input_funcs->input_event_cb) {
+ _E("Failed to execute (*input_event_cb) : -ENOTSUP\n");
+ return;
+ }
+
+ g_input_funcs->input_event_cb(time, type, keycode, keyvalue);
+}