4 * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
6 * Licensed under the Apache License, Version 2.0 (the License);
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
23 #include <sys/types.h>
30 #define HAPTIC_MODULE_PATH "/usr/lib/libhaptic-module.so"
32 /* Haptic Plugin Interface */
33 static void *dlopen_handle;
34 static const struct haptic_plugin_ops *plugin_intf;
36 static bool is_valid(void)
39 const struct haptic_plugin_ops *(*get_haptic_plugin_interface) () = NULL;
41 if (stat(HAPTIC_MODULE_PATH, &buf)) {
42 _E("file(%s) is not presents", HAPTIC_MODULE_PATH);
46 dlopen_handle = dlopen(HAPTIC_MODULE_PATH, RTLD_NOW);
48 _E("dlopen failed: %s", dlerror());
52 get_haptic_plugin_interface = dlsym(dlopen_handle, "get_haptic_plugin_interface");
53 if (!get_haptic_plugin_interface) {
54 _E("dlsym failed : %s", dlerror());
58 plugin_intf = get_haptic_plugin_interface();
60 _E("get_haptic_plugin_interface() failed");
64 _I("Support external haptic device");
69 dlclose(dlopen_handle);
73 _I("Do not support external haptic device");
77 static const struct haptic_plugin_ops *load(void)
82 static void release(void)
85 dlclose(dlopen_handle);
92 static const struct haptic_ops ext_ops = {
93 .type = HAPTIC_EXTERNAL,
99 HAPTIC_OPS_REGISTER(&ext_ops)