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)
#define LOG_TAG "BT_VENDOR"
+#include <unistd.h>
+#include <stdio.h>
#include <endian.h>
#include <errno.h>
#include <fcntl.h>
#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 <netinet/in.h>
-#include <netdb.h>
-#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;
/*
* 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);
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);