summaryrefslogtreecommitdiffstats
path: root/hci/src
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2012-07-17 19:16:52 -0700
committerColin Cross <ccross@android.com>2012-07-17 19:16:52 -0700
commit6b69af7c683e1e3edd25891d73eba5914f885d4b (patch)
tree7f8de1c567e6e39d610614f795b06cfd6c8051dd /hci/src
parentdff2b120f73b1a2d12ef33de55cb553c86135b92 (diff)
downloadexternal_bluetooth_bluedroid-6b69af7c683e1e3edd25891d73eba5914f885d4b.zip
external_bluetooth_bluedroid-6b69af7c683e1e3edd25891d73eba5914f885d4b.tar.gz
external_bluetooth_bluedroid-6b69af7c683e1e3edd25891d73eba5914f885d4b.tar.bz2
Use dlopen to avoid compile time linking against libbt-vendor.so
libbt-vendor.so is in vendor/, and shouldn't be compile-time linked against from external/. Use dlopen instead. Change-Id: Iefc2d5232506ce8e60a6e5dd93328332549daa1e
Diffstat (limited to 'hci/src')
-rw-r--r--hci/src/bt_hw.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/hci/src/bt_hw.c b/hci/src/bt_hw.c
index 89afa51..4878260 100644
--- a/hci/src/bt_hw.c
+++ b/hci/src/bt_hw.c
@@ -55,6 +55,7 @@
#define LOG_TAG "bt_hw"
+#include <dlfcn.h>
#include <utils/Log.h>
#include <pthread.h>
#include "bt_vendor_lib.h"
@@ -226,7 +227,6 @@ static const bt_vendor_callbacks_t vnd_callbacks = {
usrl_ctrl_cb
};
-
/******************************************************************************
**
** Function init_vnd_if
@@ -238,7 +238,24 @@ static const bt_vendor_callbacks_t vnd_callbacks = {
******************************************************************************/
void init_vnd_if(unsigned char *local_bdaddr)
{
- if ((bt_vnd_if=(bt_vendor_interface_t *) bt_vendor_get_interface())!=NULL)
+ bt_vendor_interface_t (*bt_vendor_get_interface_func)(void);
+ void *dlhandle;
+
+ dlhandle = dlopen("libbt-vendor.so", RTLD_NOW);
+ if (!dlhandle)
+ {
+ ALOGE("!!! Failed to load libbt-vendor.so !!!");
+ return;
+ }
+
+ bt_vendor_get_interface_func = dlsym(dlhandle, "bt_vendor_get_interface");
+ if (!bt_vendor_get_interface_func)
+ {
+ ALOGE("!!! Failed to get bt_vendor_get_interface !!!");
+ return;
+ }
+
+ if ((bt_vnd_if=(bt_vendor_interface_t *) bt_vendor_get_interface_func)!=NULL)
{
bt_vnd_if->init(&vnd_callbacks, local_bdaddr);
}