diff options
-rw-r--r-- | Android.bp | 18 | ||||
-rw-r--r-- | BoardConfigCommon.mk | 1 | ||||
-rw-r--r-- | bluetooth/Android.bp | 41 | ||||
-rw-r--r-- | bluetooth/android.hardware.bluetooth@1.0-service.hikey.rc | 4 | ||||
-rw-r--r-- | bluetooth/bdroid_buildcfg.h | 23 | ||||
-rw-r--r-- | bluetooth/bluetooth_hci.cc | 152 | ||||
-rw-r--r-- | bluetooth/bluetooth_hci.h | 63 | ||||
-rw-r--r-- | bluetooth/hci_packetizer_hikey.cc | 121 | ||||
-rw-r--r-- | bluetooth/hci_packetizer_hikey.h | 38 | ||||
-rw-r--r-- | bluetooth/service.cc | 36 | ||||
-rw-r--r-- | device-common.mk | 3 | ||||
-rw-r--r-- | init.common.rc | 2 | ||||
-rw-r--r-- | sepolicy/file_contexts | 2 | ||||
-rw-r--r-- | vintf.xml | 8 | ||||
-rw-r--r-- | wpan/bluedroid_wilink/Android.mk | 39 | ||||
-rw-r--r-- | wpan/bluedroid_wilink/libbt-vendor-ti.c | 117 | ||||
-rw-r--r-- | wpan/ti-wpan-products.mk | 3 | ||||
-rw-r--r-- | wpan/uim/Android.mk | 1 |
18 files changed, 487 insertions, 185 deletions
diff --git a/Android.bp b/Android.bp new file mode 100644 index 00000000..f31b4441 --- /dev/null +++ b/Android.bp @@ -0,0 +1,18 @@ +// +// Copyright (C) 2017 The Android Open Source Project +// +// 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. + +subdirs = [ + "bluetooth", +] diff --git a/BoardConfigCommon.mk b/BoardConfigCommon.mk index ccd77752..3b744b32 100644 --- a/BoardConfigCommon.mk +++ b/BoardConfigCommon.mk @@ -19,7 +19,6 @@ WITH_DEXPREOPT ?= true USE_OPENGL_RENDERER := true # BT configs -BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR := device/linaro/hikey/bluetooth BOARD_HAVE_BLUETOOTH := true # generic wifi diff --git a/bluetooth/Android.bp b/bluetooth/Android.bp new file mode 100644 index 00000000..aecdcb7e --- /dev/null +++ b/bluetooth/Android.bp @@ -0,0 +1,41 @@ +// +// Copyright (C) 2017 The Android Open Source Project +// +// 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. + +cc_binary { + name: "android.hardware.bluetooth@1.0-service.hikey", + proprietary: true, + relative_install_path: "hw", + srcs: [ + "bluetooth_hci.cc", + "hci_packetizer_hikey.cc", + "service.cc", + ], + shared_libs: [ + "android.hardware.bluetooth@1.0", + "libbase", + "libcutils", + "libhardware", + "libhwbinder", + "libhidlbase", + "libhidltransport", + "liblog", + "libutils", + ], + static_libs: [ + "android.hardware.bluetooth-async", + "android.hardware.bluetooth-hci", + ], + init_rc: ["android.hardware.bluetooth@1.0-service.hikey.rc"], +} diff --git a/bluetooth/android.hardware.bluetooth@1.0-service.hikey.rc b/bluetooth/android.hardware.bluetooth@1.0-service.hikey.rc new file mode 100644 index 00000000..6f31efdf --- /dev/null +++ b/bluetooth/android.hardware.bluetooth@1.0-service.hikey.rc @@ -0,0 +1,4 @@ +service bluetooth-1-0 /vendor/bin/hw/android.hardware.bluetooth@1.0-service.hikey + class hal + user bluetooth + group bluetooth diff --git a/bluetooth/bdroid_buildcfg.h b/bluetooth/bdroid_buildcfg.h deleted file mode 100644 index a2ce34bd..00000000 --- a/bluetooth/bdroid_buildcfg.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2012 The Android Open Source Project - * - * 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 _BDROID_BUILDCFG_H -#define _BDROID_BUILDCFG_H - -#define BTM_DEF_LOCAL_NAME "Android Bluedroid" -#define PRELOAD_START_TIMEOUT_MS 30000 - -#endif diff --git a/bluetooth/bluetooth_hci.cc b/bluetooth/bluetooth_hci.cc new file mode 100644 index 00000000..64107656 --- /dev/null +++ b/bluetooth/bluetooth_hci.cc @@ -0,0 +1,152 @@ +// +// Copyright 2016 The Android Open Source Project +// +// 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. +// + +#define LOG_TAG "android.hardware.bluetooth@1.0.hikey" + +#include "bluetooth_hci.h" + +#include <utils/Log.h> + +#include <android-base/logging.h> + +#include "hci_internals.h" + +namespace { + +using android::hardware::bluetooth::V1_0::hikey::BluetoothHci; +using android::hardware::hidl_vec; + +BluetoothHci* g_bluetooth_hci = nullptr; + +size_t write_safely(int fd, const uint8_t* data, size_t length) { + size_t transmitted_length = 0; + while (length > 0) { + ssize_t ret = + TEMP_FAILURE_RETRY(write(fd, data + transmitted_length, length)); + + if (ret == -1) { + if (errno == EAGAIN) continue; + ALOGE("%s error writing to UART (%s)", __func__, strerror(errno)); + break; + + } else if (ret == 0) { + // Nothing written :( + ALOGE("%s zero bytes written - something went wrong...", __func__); + break; + } + + transmitted_length += ret; + length -= ret; + } + + return transmitted_length; +} + +} // namespace + +namespace android { +namespace hardware { +namespace bluetooth { +namespace V1_0 { +namespace hikey { + +Return<void> BluetoothHci::initialize( + const ::android::sp<IBluetoothHciCallbacks>& cb) { + ALOGI("BluetoothHci::initialize()"); + + CHECK(cb != nullptr); + event_cb_ = cb; + + hci_tty_fd_ = open("/dev/hci_tty", O_RDWR); + if (hci_tty_fd_ < 0) { + ALOGE("%s: Can't open hci_tty", __func__); + event_cb_->initializationComplete(Status::INITIALIZATION_ERROR); + } + + CHECK(g_bluetooth_hci == nullptr) << __func__ << " is not reentrant"; + g_bluetooth_hci = this; + + fd_watcher_.WatchFdForNonBlockingReads( + hci_tty_fd_, [this](int fd) { hci_packetizer_.OnDataReadyHikey(fd); }); + + event_cb_->initializationComplete(Status::SUCCESS); + return Void(); +} + +Return<void> BluetoothHci::close() { + ALOGW("BluetoothHci::close()"); + ::close(hci_tty_fd_); + hci_tty_fd_ = -1; + g_bluetooth_hci = nullptr; + return Void(); +} + +Return<void> BluetoothHci::sendHciCommand(const hidl_vec<uint8_t>& packet) { + uint8_t type = HCI_PACKET_TYPE_COMMAND; + int rv = write_safely(hci_tty_fd_, &type, sizeof(type)); + if (rv == sizeof(type)) + rv = write_safely(hci_tty_fd_, packet.data(), packet.size()); + return Void(); +} + +Return<void> BluetoothHci::sendAclData(const hidl_vec<uint8_t>& packet) { + uint8_t type = HCI_PACKET_TYPE_ACL_DATA; + int rv = write_safely(hci_tty_fd_, &type, sizeof(type)); + if (rv == sizeof(type)) + rv = write_safely(hci_tty_fd_, packet.data(), packet.size()); + return Void(); +} + +Return<void> BluetoothHci::sendScoData(const hidl_vec<uint8_t>& packet) { + uint8_t type = HCI_PACKET_TYPE_SCO_DATA; + int rv = write_safely(hci_tty_fd_, &type, sizeof(type)); + if (rv == sizeof(type)) + rv = write_safely(hci_tty_fd_, packet.data(), packet.size()); + return Void(); +} + +BluetoothHci* BluetoothHci::get() { return g_bluetooth_hci; } + +void BluetoothHci::OnPacketReady() { + BluetoothHci::get()->HandleIncomingPacket(); +} + +void BluetoothHci::HandleIncomingPacket() { + HciPacketType hci_packet_type = hci_packetizer_.GetPacketType(); + hidl_vec<uint8_t> hci_packet = hci_packetizer_.GetPacket(); + + switch (hci_packet_type) { + case HCI_PACKET_TYPE_EVENT: + event_cb_->hciEventReceived(hci_packet); + break; + case HCI_PACKET_TYPE_ACL_DATA: + event_cb_->aclDataReceived(hci_packet); + break; + case HCI_PACKET_TYPE_SCO_DATA: + event_cb_->scoDataReceived(hci_packet); + break; + default: { + bool hci_packet_type_corrupted = true; + CHECK(hci_packet_type_corrupted == false); + } + } +} + +} // namespace hikey +} // namespace V1_0 +} // namespace bluetooth +} // namespace hardware +} // namespace android diff --git a/bluetooth/bluetooth_hci.h b/bluetooth/bluetooth_hci.h new file mode 100644 index 00000000..91fad272 --- /dev/null +++ b/bluetooth/bluetooth_hci.h @@ -0,0 +1,63 @@ +// +// Copyright 2017 The Android Open Source Project +// +// 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. +// + +#pragma once + +#include <android/hardware/bluetooth/1.0/IBluetoothHci.h> + +#include <hidl/MQDescriptor.h> + +#include "async_fd_watcher.h" +#include "hci_packetizer_hikey.h" + +namespace android { +namespace hardware { +namespace bluetooth { +namespace V1_0 { +namespace hikey { + +using ::android::hardware::Return; +using ::android::hardware::hidl_vec; + +class BluetoothHci : public IBluetoothHci { + public: + Return<void> initialize( + const ::android::sp<IBluetoothHciCallbacks>& cb) override; + Return<void> sendHciCommand(const hidl_vec<uint8_t>& packet) override; + Return<void> sendAclData(const hidl_vec<uint8_t>& packet) override; + Return<void> sendScoData(const hidl_vec<uint8_t>& packet) override; + Return<void> close() override; + + static void OnPacketReady(); + + static BluetoothHci* get(); + + private: + ::android::sp<IBluetoothHciCallbacks> event_cb_; + int hci_tty_fd_; + + void HandleIncomingPacket(); + + async::AsyncFdWatcher fd_watcher_; + + HciPacketizerHikey hci_packetizer_{BluetoothHci::OnPacketReady}; +}; + +} // namespace hikey +} // namespace V1_0 +} // namespace bluetooth +} // namespace hardware +} // namespace android diff --git a/bluetooth/hci_packetizer_hikey.cc b/bluetooth/hci_packetizer_hikey.cc new file mode 100644 index 00000000..9b54b8e0 --- /dev/null +++ b/bluetooth/hci_packetizer_hikey.cc @@ -0,0 +1,121 @@ +// +// Copyright 2017 The Android Open Source Project +// +// 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. +// + +#include "hci_packetizer_hikey.h" + +#include <sys/ioctl.h> +#include <utils/Log.h> + +#include <android-base/logging.h> + +namespace { + +const size_t preamble_size_for_type[] = { + 0, HCI_COMMAND_PREAMBLE_SIZE, HCI_ACL_PREAMBLE_SIZE, HCI_SCO_PREAMBLE_SIZE, + HCI_EVENT_PREAMBLE_SIZE}; +const size_t packet_length_offset_for_type[] = { + 0, HCI_LENGTH_OFFSET_CMD, HCI_LENGTH_OFFSET_ACL, HCI_LENGTH_OFFSET_SCO, + HCI_LENGTH_OFFSET_EVT}; + +size_t HciGetPacketLengthForType(HciPacketType type, const uint8_t* preamble) { + size_t offset = packet_length_offset_for_type[type]; + if (type != HCI_PACKET_TYPE_ACL_DATA) return preamble[offset]; + return (((preamble[offset + 1]) << 8) | preamble[offset]); +} + +} // namespace + +namespace android { +namespace hardware { +namespace bluetooth { +namespace V1_0 { +namespace hikey { + +void HciPacketizerHikey::OnDataReadyHikey(int fd) { + int tty_bytes = 0; + if (ioctl(fd, FIONREAD, &tty_bytes) == -1) + ALOGE("%s:FIONREAD %s", __func__, strerror(errno)); + ALOGV("%s:tty_bytes = %d", __func__, tty_bytes); + uint8_t* tmp_buffer = new uint8_t[tty_bytes]; + size_t bytes_read = TEMP_FAILURE_RETRY(read(fd, tmp_buffer, tty_bytes)); + CHECK(static_cast<int>(bytes_read) == tty_bytes); + + size_t index = 0; + while (index < bytes_read - 1) { + switch (hci_parser_state_) { + case HCI_IDLE: { + hci_packet_type_ = static_cast<HciPacketType>(tmp_buffer[index++]); + CHECK(hci_packet_type_ >= HCI_PACKET_TYPE_ACL_DATA && + hci_packet_type_ <= HCI_PACKET_TYPE_EVENT) + << "hci_packet_type_ = " + << static_cast<unsigned int>(hci_packet_type_); + hci_parser_state_ = HCI_TYPE_READY; + hci_packet_bytes_remaining_ = preamble_size_for_type[hci_packet_type_]; + hci_packet_bytes_read_ = 0; + break; + } + + case HCI_TYPE_READY: { + size_t bytes_to_copy = (bytes_read - index < hci_packet_bytes_remaining_ + ? bytes_read - index + : hci_packet_bytes_remaining_); + memcpy(hci_packet_preamble_ + hci_packet_bytes_read_, + &tmp_buffer[index], bytes_to_copy); + hci_packet_bytes_remaining_ -= bytes_to_copy; + hci_packet_bytes_read_ += bytes_to_copy; + index += bytes_to_copy; + ALOGV("%s:TYPE index = %d", __func__, static_cast<int>(index)); + if (hci_packet_bytes_remaining_ == 0) { + size_t packet_length = + HciGetPacketLengthForType(hci_packet_type_, hci_packet_preamble_); + hci_packet_.resize(preamble_size_for_type[hci_packet_type_] + + packet_length); + memcpy(hci_packet_.data(), hci_packet_preamble_, + preamble_size_for_type[hci_packet_type_]); + hci_packet_bytes_remaining_ = packet_length; + hci_parser_state_ = HCI_PAYLOAD; + hci_packet_bytes_read_ = 0; + } + break; + } + + case HCI_PAYLOAD: { + size_t bytes_to_copy = (bytes_read - index < hci_packet_bytes_remaining_ + ? bytes_read - index + : hci_packet_bytes_remaining_); + memcpy(hci_packet_.data() + preamble_size_for_type[hci_packet_type_] + + hci_packet_bytes_read_, + &tmp_buffer[index], bytes_to_copy); + hci_packet_bytes_remaining_ -= bytes_to_copy; + hci_packet_bytes_read_ += bytes_to_copy; + index += bytes_to_copy; + ALOGV("%s:PAYLOAD index = %d", __func__, static_cast<int>(index)); + if (hci_packet_bytes_remaining_ == 0) { + hci_packet_ready_cb_(); + hci_parser_state_ = HCI_IDLE; + } + break; + } + } + } + delete[] tmp_buffer; +} + +} // namespace hikey +} // namespace V1_0 +} // namespace bluetooth +} // namespace hardware +} // namespace android diff --git a/bluetooth/hci_packetizer_hikey.h b/bluetooth/hci_packetizer_hikey.h new file mode 100644 index 00000000..12fdde28 --- /dev/null +++ b/bluetooth/hci_packetizer_hikey.h @@ -0,0 +1,38 @@ +// +// Copyright 2017 The Android Open Source Project +// +// 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. +// + +#pragma once + +#include "hci_packetizer.h" + +namespace android { +namespace hardware { +namespace bluetooth { +namespace V1_0 { +namespace hikey { + +class HciPacketizerHikey : public hci::HciPacketizer { + public: + HciPacketizerHikey(hci::HciPacketReadyCallback packet_cb) + : HciPacketizer(packet_cb){}; + void OnDataReadyHikey(int fd); +}; + +} // namespace hikey +} // namespace V1_0 +} // namespace bluetooth +} // namespace hardware +} // namespace android diff --git a/bluetooth/service.cc b/bluetooth/service.cc new file mode 100644 index 00000000..5c591543 --- /dev/null +++ b/bluetooth/service.cc @@ -0,0 +1,36 @@ +// +// Copyright 2017 The Android Open Source Project +// +// 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. +// + +#define LOG_TAG "android.hardware.bluetooth@1.0-service.hikey" + +#include <android/hardware/bluetooth/1.0/IBluetoothHci.h> +#include <hidl/HidlSupport.h> +#include <hidl/HidlTransportSupport.h> + +#include "bluetooth_hci.h" + +using ::android::hardware::configureRpcThreadpool; +using ::android::hardware::bluetooth::V1_0::IBluetoothHci; +using ::android::hardware::bluetooth::V1_0::hikey::BluetoothHci; +using ::android::hardware::joinRpcThreadpool; +using ::android::sp; + +int main(int /* argc */, char** /* argv */) { + sp<IBluetoothHci> bluetooth = new BluetoothHci; + configureRpcThreadpool(1, true); + bluetooth->registerAsService(); + joinRpcThreadpool(); +} diff --git a/device-common.mk b/device-common.mk index 218d01bf..72f15a45 100644 --- a/device-common.mk +++ b/device-common.mk @@ -40,7 +40,7 @@ PRODUCT_PACKAGES += audio.a2dp.default \ PRODUCT_PACKAGES += \ android.hardware.audio@2.0-impl \ android.hardware.audio.effect@2.0-impl \ - android.hardware.bluetooth@1.0-impl \ + android.hardware.bluetooth@1.0-service.hikey \ android.hardware.broadcastradio@1.0-impl \ android.hardware.soundtrigger@2.0-impl @@ -89,6 +89,7 @@ PRODUCT_COPY_FILES += \ frameworks/native/data/etc/android.hardware.wifi.xml:system/etc/permissions/android.hardware.wifi.xml \ frameworks/native/data/etc/android.hardware.bluetooth.xml:system/etc/permissions/android.hardware.bluetooth.xml \ frameworks/native/data/etc/android.hardware.bluetooth_le.xml:system/etc/permissions/android.hardware.bluetooth_le.xml \ + device/linaro/hikey/vintf.xml:vendor/manifest.xml \ device/linaro/hikey/wpa_supplicant.conf:system/etc/wifi/wpa_supplicant.conf \ device/linaro/hikey/audio/audio_policy.conf:system/etc/audio_policy.conf diff --git a/init.common.rc b/init.common.rc index a13fa3ca..318ffc9b 100644 --- a/init.common.rc +++ b/init.common.rc @@ -88,7 +88,7 @@ on property:usb_speed.switch=full write /sys/kernel/debug/f72c0000.usb/config "1" #userspace daemon needed for bluetooth -service uim /system/bin/uim +service uim /vendor/bin/uim class main user bluetooth group bluetooth net_bt_admin system diff --git a/sepolicy/file_contexts b/sepolicy/file_contexts index 5379f904..7b692d1c 100644 --- a/sepolicy/file_contexts +++ b/sepolicy/file_contexts @@ -5,5 +5,5 @@ /dev/dri/card0 u:object_r:gpu_device:s0 /dev/hci_tty u:object_r:hci_attach_dev:s0 /dev/ttyAMA1 u:object_r:hci_attach_dev:s0 -/system/bin/uim u:object_r:hci_attach_exec:s0 +/system/vendor/bin/uim u:object_r:hci_attach_exec:s0 /system/vendor/bin/hw/android\.hardware\.bluetooth@1\.0-service\.hikey u:object_r:hal_bluetooth_hikey_exec:s0 diff --git a/vintf.xml b/vintf.xml new file mode 100644 index 00000000..bdd4753b --- /dev/null +++ b/vintf.xml @@ -0,0 +1,8 @@ +<manifest version="1.0"> + <hal format="hidl"> + <name>android.hardware.bluetooth</name> + <transport>hwbinder</transport> + <impl level="generic"></impl> + <version>1.0</version> + </hal> +</manifest> diff --git a/wpan/bluedroid_wilink/Android.mk b/wpan/bluedroid_wilink/Android.mk deleted file mode 100644 index 6b578386..00000000 --- a/wpan/bluedroid_wilink/Android.mk +++ /dev/null @@ -1,39 +0,0 @@ -# -# Copyright 2001-2012 Texas Instruments, Inc. - http://www.ti.com/ -# -# 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. -# - -ifeq (hikey, $(TARGET_PRODUCT)) -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_C_INCLUDES := system/bt/hci/include hardware/libhardware/include - -LOCAL_CFLAGS := -g -c -W -Wall -O2 -D_POSIX_SOURCE - -LOCAL_SRC_FILES := libbt-vendor-ti.c - -LOCAL_SHARED_LIBRARIES := \ - libnativehelper \ - libcutils \ - libutils \ - liblog - -LOCAL_PRELINK_MODULE := false -LOCAL_MODULE := libbt-vendor -LOCAL_MODULE_TAGS := optional -#LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_SHARED_LIBRARIES) - -include $(BUILD_SHARED_LIBRARY) -endif diff --git a/wpan/bluedroid_wilink/libbt-vendor-ti.c b/wpan/bluedroid_wilink/libbt-vendor-ti.c deleted file mode 100644 index 46705bd4..00000000 --- a/wpan/bluedroid_wilink/libbt-vendor-ti.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright 2001-2012 Texas Instruments, Inc. - http://www.ti.com/ - * - * Bluetooth Vendor Library for TI's WiLink Chipsets - * - * 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. - */ - -#define LOG_TAG "bt_vendor" - -#include <stdio.h> -#include <dlfcn.h> -#include <utils/Log.h> -#include <pthread.h> -#include <fcntl.h> -#include <errno.h> -#include <bt_vendor_lib.h> -#include <bt_hci_bdroid.h> -#include <hardware/bluetooth.h> - -bt_vendor_callbacks_t *bt_vendor_cbacks = NULL; -unsigned int hci_tty_fd = -1; -void hw_config_cback(HC_BT_HDR *p_evt_buf); - -/******************************************************************************* - * - * Function hw_config_cback - * - * Description Callback function for controller configuration - * - * Returns None - * - * *******************************************************************************/ -void hw_config_cback(HC_BT_HDR * __unused p_evt_buf) -{ - ALOGV("hw_config_cback"); -} - -int ti_init(const bt_vendor_callbacks_t* p_cb, unsigned char * __unused local_bdaddr) -{ - ALOGV("vendor Init"); - - if (p_cb == NULL) - { - ALOGE("init failed with no user callbacks!"); - return BT_STATUS_FAIL; - } - - bt_vendor_cbacks = (bt_vendor_callbacks_t *) p_cb; - - return 0; -} - -void ti_cleanup(void) -{ - ALOGV("vendor cleanup"); - - bt_vendor_cbacks = NULL; -} - -int ti_op(bt_vendor_opcode_t opcode, void *param) -{ - int fd; - int *fd_array = (int *)param; - - ALOGV("vendor op - %d", opcode); - switch(opcode) - { - case BT_VND_OP_USERIAL_OPEN: - fd = open("/dev/hci_tty", O_RDWR); - if (fd < 0) { - ALOGE(" Can't open hci_tty"); - return -1; - } - fd_array[CH_CMD] = fd; - hci_tty_fd = fd; /* for userial_close op */ - return 1; /* CMD/EVT/ACL on same fd */ - case BT_VND_OP_USERIAL_CLOSE: - close(hci_tty_fd); - return 0; - /* Since new stack expects fwcfg_cb we are returning SUCCESS here - * in actual, firmware download is already happened when /dev/hci_tty - * opened. - */ - case BT_VND_OP_FW_CFG: - bt_vendor_cbacks->fwcfg_cb(BT_VND_OP_RESULT_SUCCESS); - return 0; - case BT_VND_OP_EPILOG: - bt_vendor_cbacks->epilog_cb(BT_VND_OP_RESULT_SUCCESS); - break; - default: - break; - } - - return 0; -} - -const bt_vendor_interface_t BLUETOOTH_VENDOR_LIB_INTERFACE = { - .init = ti_init, - .op = ti_op, - .cleanup = ti_cleanup, -}; - -int main() -{ - return 0; -} diff --git a/wpan/ti-wpan-products.mk b/wpan/ti-wpan-products.mk index ffee1f31..8e720fba 100644 --- a/wpan/ti-wpan-products.mk +++ b/wpan/ti-wpan-products.mk @@ -1,5 +1,4 @@ # This file lists the firmware, software that are specific to # WiLink connectivity chip on OMAPx platforms. -PRODUCT_PACKAGES += uim \ - libbt-vendor +PRODUCT_PACKAGES += uim diff --git a/wpan/uim/Android.mk b/wpan/uim/Android.mk index 2beec72a..81501749 100644 --- a/wpan/uim/Android.mk +++ b/wpan/uim/Android.mk @@ -10,6 +10,7 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/ LOCAL_MODULE_TAGS := eng LOCAL_MODULE := uim +LOCAL_PROPRIETARY_MODULE := true include $(BUILD_EXECUTABLE) |