From 1acb40aa520c434566da06eef2736cddbfcd7d66 Mon Sep 17 00:00:00 2001 From: Jan Altensen Date: Sun, 10 May 2020 18:18:35 +0200 Subject: [PATCH] libbt: resolve compilation errors Change-Id: I03c1093fadc0c48e762bd3fa35b891a3abb17d77 --- Android.mk | 23 ++++-------- include/bt_vendor_slsi.h | 10 ++--- src/bt_vendor_slsi.c | 80 ++-------------------------------------- 3 files changed, 14 insertions(+), 99 deletions(-) diff --git a/Android.mk b/Android.mk index 30fabbc..a2090da 100644 --- a/Android.mk +++ b/Android.mk @@ -25,34 +25,27 @@ LOCAL_SRC_FILES := \ src/bt_vendor_slsi.c LOCAL_C_INCLUDES += \ + $(LOCAL_PATH)/include \ $(BDROID_DIR)/hci/include \ $(BDROID_DIR)/stack/include \ $(BDROID_DIR)/include \ - $(LOCAL_DIR)/include \ + $(BDROID_DIR)/device/include \ $(BDROID_DIR) \ - $(LOCAL_DIR)/include \ - $(BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR) + $(bdroid_C_INCLUDES) LOCAL_CFLAGS += $(bdroid_CFLAGS) -ifneq ($(TARGET_BUILD_VARIANT),user) -LOCAL_CFLAGS += -DBTVENDOR_DBG=TRUE -endif - -ifeq ($(CONFIG_SAMSUNG_SCSC_WIFIBT),true) -# Enable BT/WIFI related code changes in Android source files -LOCAL_CFLAGS += -DCONFIG_SAMSUNG_SCSC_WIFIBT -endif - LOCAL_SHARED_LIBRARIES := \ - libcutils + libcutils \ + liblog + +LOCAL_HEADER_LIBRARIES := libutils_headers LOCAL_MODULE := libbt-vendor LOCAL_MODULE_OWNER := samsung LOCAL_MODULE_TAGS := optional - LOCAL_MODULE_CLASS := SHARED_LIBRARIES -LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_SHARED_LIBRARIES) +LOCAL_PROPRIETARY_MODULE := true include $(BUILD_SHARED_LIBRARY) diff --git a/include/bt_vendor_slsi.h b/include/bt_vendor_slsi.h index a8107eb..94238d3 100644 --- a/include/bt_vendor_slsi.h +++ b/include/bt_vendor_slsi.h @@ -6,14 +6,10 @@ #ifndef BT_VENDOR_SLSI_H__ #define BT_VENDOR_SLSI_H__ -#ifndef CONFIG_SAMSUNG_SCSC_WIFIBT -#error "CONFIG_SAMSUNG_SCSC_WIFIBT not defined" -#endif - -#include +#include -#include "bt_types.h" -#include "btm_api.h" +//#include "bt_types.h" +//#include "btm_api.h" #ifndef BTVENDOR_DBG #define BTVENDOR_DBG FALSE diff --git a/src/bt_vendor_slsi.c b/src/bt_vendor_slsi.c index 4e93300..7c8486a 100644 --- a/src/bt_vendor_slsi.c +++ b/src/bt_vendor_slsi.c @@ -9,6 +9,8 @@ #define LOG_TAG "BT_VENDOR" +#include +#include #include #include #include @@ -19,26 +21,8 @@ #include "bt_vendor_slsi.h" -/** - * SSB-5242 Route HCI I/F over ABD to driver on PC. - */ -#ifndef ENABLE_HCI_TUNNELLING -#define ENABLE_HCI_TUNNELLING FALSE -#endif /* !ENABLE_HCI_TUNNELLING */ -#if defined(ENABLE_HCI_TUNNELLING) && (ENABLE_HCI_TUNNELLING == TRUE) -#include -#include -#endif - #define BLUETOOTH_ADDRESS_FILE "/sys/module/scsc_bt/parameters/bluetooth_address" -/** - * SSB-5242 Route HCI I/F over ABD to driver on PC. - */ -#if defined(ENABLE_HCI_TUNNELLING) && (ENABLE_HCI_TUNNELLING == TRUE) -static int hci_tunnelling_port_num = 10157; -#endif - static const bt_vendor_callbacks_t *vcb; static unsigned long long bt_addr; @@ -81,69 +65,11 @@ static void set_bluetooth_address(unsigned long long value) /* * Internal interface */ - -/** - * SSB-5242 Route HCI I/F over ABD to driver on PC. - */ -#if defined(ENABLE_HCI_TUNNELLING) && (ENABLE_HCI_TUNNELLING == TRUE) -static int socket_open_client(int port_num) -{ - struct sockaddr_in serv_addr; - struct hostent *server; - int fd = -1; - - BTVENDORI("HCI Tunnelling: socket_open_client(): port: 0x%08x.", port_num); - - fd = socket(AF_INET, SOCK_STREAM, 0); - - if (fd < 0) - { - BTVENDORE("HCI Tunnelling: socket_open_client(): error from socket(), errno:0x%08x:%s.", errno, strerror(errno)); - fd = -1; - return fd; - } - - BTVENDORI("HCI Tunnelling: socket_open_client(): port: 0x%08x, fd: 0x%08x.", port_num, fd); - - server = gethostbyname("localhost"); - - if (server == NULL) - { - BTVENDORE("HCI Tunnelling: socket_open_client(): error from gethostbyname(), errno:0x%08x:%s, fd: 0x%08x.", errno, strerror(errno), fd); - fd = -1; - return fd; - } - - bzero((char *) &serv_addr, sizeof(serv_addr)); - serv_addr.sin_family = AF_INET; - bcopy((char *) server->h_addr, (char *) &serv_addr.sin_addr.s_addr, server->h_length); - serv_addr.sin_port = htons(port_num); - - if (connect(fd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) < 0) - { - BTVENDORE("HCI Tunnelling: socket_open_client(): error from connect(), errno:0x%08x:%s, fd: 0x%08x.", errno, strerror(errno), fd); - fd = -1; - return fd; - } - - BTVENDORI("HCI Tunnelling: socket_open_client(): OK, fd:0x%08x.", fd); - - return fd; -} -#endif - static int hci_open(int *fds) { int h4_fd; BTVENDORI("HCI open"); - -/** - * SSB-5242 Route HCI I/F over ADB to driver on PC. - */ -#if defined(ENABLE_HCI_TUNNELLING) && (ENABLE_HCI_TUNNELLING == TRUE) - h4_fd = socket_open_client(hci_tunnelling_port_num); -#else if (bt_addr != 0) { set_bluetooth_address(bt_addr); @@ -151,7 +77,7 @@ static int hci_open(int *fds) BTVENDORI("Opening h4 device %s", h4_file); h4_fd = open(h4_file, O_RDWR); -#endif + if (h4_fd == -1) { BTVENDORE("Open h4 device failed: %s (%d)", strerror(errno), errno); -- 2.20.1