Until now, deviced contains the all plugin backend package for each profile like
headless, headed and so on. In order to move the plugin to the seprate
git repository, handle the input plugin-backend by using
plugin-api-deviced API (input plugin-api).
[Sequence flow between packages]
- deviced (input core)
-> plugin-api-deviced(input plugin-api)
-> plugin-backend-deviced-* (input plugin-backend, e.g., plugin-backend-deviced-headless)
Change-Id: Ic01198cc2b3e512ce059c96894ac0b94039e286a
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
capi-system-device
libsystemd
libsyscommon
+ libsyscommon-plugin-api-deviced
wayland-client
tizen-extension-client
tizen-dpms-client
+++ /dev/null
-/*
- * deviced
- *
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __INPUT_PLUGIN_INTERFACE_H__
-#define __INPUT_PLUGIN_INTERFACE_H__
-
-struct input_plugin_interface {
- int (*init) (void *);
- void (*exit) (void *);
-};
-
-#define INPUT_PLUGIN_INTERFACE_SYMBOL input_plugin_interface_sym
-
-#endif// __INPUT_PLUGIN_INTERFACE_H__
+++ /dev/null
-#include <unistd.h>
-#include <dlfcn.h>
-#include <shared/log.h>
-
-#include "input-plugin-interface.h"
-
-#define INPUT_PLUGIN_PATH LIBPATH"/deviced/input-handler.so"
-
-#define __stringify(s) #s
-#define stringify(s) __stringify(s)
-
-static void *g_input_plugin_handle;
-static struct input_plugin_interface *g_input_plugin;
-
-int input_plugin_init(void *data)
-{
- if (access(INPUT_PLUGIN_PATH, F_OK) != 0) {
- _D("There is no input plugin, %s", INPUT_PLUGIN_PATH);
- return -ENOENT;
- }
-
- if (!g_input_plugin_handle) {
- g_input_plugin_handle = dlopen(INPUT_PLUGIN_PATH, RTLD_NOW | RTLD_GLOBAL);
- if (!g_input_plugin_handle) {
- _E("Failed to load input plugin shared object, %s", dlerror());
- return -ENOTSUP;
- }
- }
-
- if (!g_input_plugin) {
- g_input_plugin = dlsym(g_input_plugin_handle, stringify(INPUT_PLUGIN_INTERFACE_SYMBOL));
- if (!g_input_plugin) {
- _E("Failed to load input plugin symbol, %s", dlerror());
- return -ENOTSUP;
- }
- }
-
- if (!g_input_plugin->init)
- return -EOPNOTSUPP;
-
- return g_input_plugin->init(data);
-}
-
-void input_plugin_exit(void *data)
-{
- if (g_input_plugin && g_input_plugin->exit)
- g_input_plugin->exit(data);
-
- g_input_plugin = NULL;
-
- if (g_input_plugin_handle)
- dlclose(g_input_plugin_handle);
-
- g_input_plugin_handle = NULL;
-}
+++ /dev/null
-/*
- * deviced
- *
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __INPUT_PLUGIN_H__
-#define __INPUT_PLUGIN_H__
-
-int input_plugin_init(void *data);
-void input_plugin_exit(void *data);
-
-#endif //__INPUT_PLUGIN_H__
#include <libinput.h>
#include <dlfcn.h>
+#include <system/syscommon-plugin-deviced-input.h>
+
#include "shared/devices.h"
#include "shared/log.h"
#include "input.h"
#include "input-dbus.h"
-#include "input-plugin.h"
#include "input-parser.h"
#include "input-device-manager.h"
};
static GList *input_event_handler_list;
+static int g_input_plugin_event_handler_id;
static void invoke_input_event_callback(gpointer data, gpointer udata)
{
g_list_free(l);
}
+static int input_plugin_init(void *data)
+{
+ int ret = 0;
+
+ ret = syscommon_plugin_deviced_input_get_backend();
+ if (ret < 0) {
+ _E("failed to get input plugin-backend\n");
+ return ret;
+ }
+
+ input_register_event_callback(syscommon_plugin_deviced_input_event_cb,
+ NULL, NULL, &g_input_plugin_event_handler_id);
+
+ return 0;
+}
+
+static void input_plugin_exit(void *data)
+{
+ int ret = 0;
+
+ input_unregister_event_callback(g_input_plugin_event_handler_id);
+
+ ret = syscommon_plugin_deviced_input_put_backend();
+ if (ret < 0) {
+ _E("failed to put input plugin-backend\n");
+ return;
+ }
+
+ return;
+}
+
static void input_init(void *data)
{
int ret;