bluez/android
2014-03-02 22:19:34 +01:00
..
client android/client: Fix set_info command 2014-02-12 11:26:56 +02:00
cutils android: The property_set wrapper is actually written by Intel 2014-01-14 12:35:42 -08:00
hardware android: Load bluetooth.default.so as a module 2014-01-10 15:07:23 +02:00
system android/audio: Add kitkat audio headers 2013-12-16 17:41:56 +02:00
a2dp.c android: Create comon header for IPC 2014-02-28 15:22:45 +01:00
a2dp.h android: Refactor IPC init 2014-02-28 15:22:45 +01:00
android-tester.c android/tester: Add breaks at last cases of switch statements 2014-02-27 15:05:31 +01:00
Android.mk android/a2dp: Use common IPC for audio socket 2014-02-28 15:22:45 +01:00
audio-ipc-api.txt android: Update Audio IPC documentation 2014-01-24 22:59:45 +01:00
audio-msg.h android: Create comon header for IPC 2014-02-28 15:22:45 +01:00
avctp.c android/avctp: Fix leaking passthrough handler 2014-03-02 20:42:57 +02:00
avctp.h audio/AVCTP: Add keys that can be mapped to uinput 2014-02-05 16:22:22 +02:00
avdtp.c android/avdtp: Fix coding style 2014-02-10 14:08:45 +02:00
avdtp.h android/AVDTP: Remove get_all parameter for get_capability callback 2013-12-23 16:29:31 +01:00
avrcp-lib.c android: Fix ntoh24 and hton24 for big endian platforms 2014-03-01 12:01:21 -08:00
avrcp-lib.h android: Fix ntoh24 and hton24 for big endian platforms 2014-03-01 12:01:21 -08:00
avrcp.c android: Refactor IPC init 2014-02-28 15:22:45 +01:00
avrcp.h android: Refactor IPC init 2014-02-28 15:22:45 +01:00
bluetooth.c android: Create comon header for IPC 2014-02-28 15:22:45 +01:00
bluetooth.h android: Refactor IPC init 2014-02-28 15:22:45 +01:00
bluetoothd-snoop.c android: Update copyright and license details 2014-02-11 10:42:56 -08:00
bluetoothd-wrapper.c android: Add support for Valgrind in debug variants 2014-02-11 17:31:39 +01:00
hal-a2dp.c android/a2dp: Unregister ipc handlers if init fails 2013-12-08 17:47:42 +02:00
hal-audio.c android/hal-audio: Fix error code handling in audio_ipc_init 2014-03-01 17:22:23 +01:00
hal-avrcp.c android: Create comon header for IPC 2014-02-28 15:22:45 +01:00
hal-bluetooth.c android: Create comon header for IPC 2014-02-28 15:22:45 +01:00
hal-handsfree.c android: Create comon header for IPC 2014-02-28 15:22:45 +01:00
hal-hidhost.c android: Create comon header for IPC 2014-02-28 15:22:45 +01:00
hal-ipc-api.txt android/hal-gatt-api: Add Server Characteristic Added Notification 2014-03-02 22:19:34 +01:00
hal-ipc.c android/hal-ipc: Fix double include of errno.h 2014-03-01 17:22:23 +01:00
hal-ipc.h android/hal: Add initial code for IPC message handlers 2013-11-19 16:42:01 +02:00
hal-log.h android/tester: Make HAL logging wrapper print to stderr instead of stdout 2013-12-11 13:10:07 +02:00
hal-msg.h android/hal-gatt-api: Add Server Characteristic Added Notification 2014-03-02 22:19:34 +01:00
hal-pan.c android/hal-pan: Fix empty parameters list in functio definition 2014-02-28 19:08:49 +01:00
hal-socket.c android: Update socket service id name to match service name 2014-02-24 13:45:09 +01:00
hal-utils.c android: Remove support for old Android versions 2014-01-14 12:57:18 +01:00
hal-utils.h android/debug: Move debug functions to hal-utils.c 2013-11-14 10:27:15 +02:00
hal.h android/hal-socket: Match functions names with HAL name 2014-02-19 18:37:03 +01:00
handsfree.c android: Create comon header for IPC 2014-02-28 15:22:45 +01:00
handsfree.h android: Refactor IPC init 2014-02-28 15:22:45 +01:00
hidhost.c android: Create comon header for IPC 2014-02-28 15:22:45 +01:00
hidhost.h android: Refactor IPC init 2014-02-28 15:22:45 +01:00
init.bluetooth.rc android: Add sample init.bluetooth.rc file 2014-01-17 20:41:45 +01:00
ipc-common.h android: Create comon header for IPC 2014-02-28 15:22:45 +01:00
ipc-tester.c android/ipc-tester: Fix structure passed to core unregister tests 2014-02-28 19:01:15 +01:00
ipc.c android: Create comon header for IPC 2014-02-28 15:22:45 +01:00
ipc.h android/a2dp: Use common IPC for audio socket 2014-02-28 15:22:45 +01:00
main.c android: Fix not cleaup AVRCP service 2014-03-02 20:42:57 +02:00
Makefile.am android/a2dp: Use common IPC for audio socket 2014-02-28 15:22:45 +01:00
pan.c android: Create comon header for IPC 2014-02-28 15:22:45 +01:00
pan.h android: Refactor IPC init 2014-02-28 15:22:45 +01:00
pics-a2dp.txt android/pics: Add PICS and PIXIT for A2DP 2014-01-13 11:04:26 +01:00
pics-avctp.txt android/pts: Update PICS and PTS for AVCTP 2014-02-05 10:46:59 +01:00
pics-avrcp.txt android/pics: Add PICS and PIXIT for AVRCP 2014-01-13 11:04:26 +01:00
pics-did.txt android/pics: Update PICS to PTS 5.0 for DID 2014-01-08 14:17:09 +01:00
pics-gap.txt android/pics: Update PICS to PTS 5.0 for GAP 2014-01-08 14:17:09 +01:00
pics-hfp.txt android/pics: Add PICS and PIXIT for HFP 2014-02-28 13:10:41 +01:00
pics-hid.txt android/pics: Update PICS to PTS 5.0 2014-01-08 14:17:09 +01:00
pics-hsp.txt android/pics: Add PICS and PIXIT for HSP 2014-02-28 13:09:25 +01:00
pics-l2cap.txt android/pics: Update PICS to PTS 5.0 2014-01-08 14:17:09 +01:00
pics-map.txt android/pts: Add PTS PICS and PIXIT for MAP 2013-12-17 13:34:40 +02:00
pics-opp.txt android/pics: Update PICS to PTS 5.0 2014-01-08 14:17:09 +01:00
pics-pan.txt android/pics: Update PICS to PTS 5.0 2014-01-08 14:17:09 +01:00
pics-pbap.txt android/pics: Fix PBAP settings 2014-02-19 17:05:46 +01:00
pixit-a2dp.txt android/pics: Add PICS and PIXIT for A2DP 2014-01-13 11:04:26 +01:00
pixit-avctp.txt android/pics: Add PICS and PIXIT for AVCTP 2014-01-16 09:04:41 +01:00
pixit-avrcp.txt android/pics: Add PICS and PIXIT for AVRCP 2014-01-13 11:04:26 +01:00
pixit-did.txt android/pixit: Add PTS version to respective pixit 2014-01-08 15:50:23 +01:00
pixit-gap.txt android/pixit: Add PTS version to respective pixit 2014-01-08 15:50:23 +01:00
pixit-hfp.txt android/pics: Add PICS and PIXIT for HFP 2014-02-28 13:10:41 +01:00
pixit-hid.txt android/pixit: Add PTS version to respective pixit 2014-01-08 15:50:23 +01:00
pixit-hsp.txt android/pics: Add PICS and PIXIT for HSP 2014-02-28 13:09:25 +01:00
pixit-l2cap.txt android/pixit: Add PTS version to respective pixit 2014-01-08 15:50:23 +01:00
pixit-map.txt android/pixit: Update MAP setting 2014-02-19 17:05:46 +01:00
pixit-opp.txt android/pixit: Add PTS version to respective pixit 2014-01-08 15:50:23 +01:00
pixit-pan.txt android/pixit: correct PIXIT value 2014-02-21 11:18:37 +01:00
pixit-pbap.txt android/pixit: Add PTS version to respective pixit 2014-01-08 15:50:23 +01:00
pts-a2dp.txt android/pts: Update test results for A2DP 2014-02-21 17:54:36 +01:00
pts-avctp.txt android/pts: Update PICS and PTS for AVCTP 2014-02-05 10:46:59 +01:00
pts-avrcp.txt android/pts: Add Android version to PTS tests 2014-01-31 14:41:38 +01:00
pts-did.txt android/pts: Add Android version to PTS tests 2014-01-31 14:41:38 +01:00
pts-gap.txt android/pts: Add Android version to PTS tests 2014-01-31 14:41:38 +01:00
pts-hid.txt android/pts: Correct typo 2014-01-31 14:41:38 +01:00
pts-l2cap.txt android/pts: Add Android version to PTS tests 2014-01-31 14:41:38 +01:00
pts-map.txt android/pts: Update MAP tests results 2014-02-24 22:12:52 +01:00
pts-opp.txt android/pts: Add Android version to PTS tests 2014-01-31 14:41:38 +01:00
pts-pan.txt android/pts: PTS test results for PAN 2014-02-21 11:18:37 +01:00
pts-pbap.txt android/pts: Fix lines over 80 characters 2014-02-24 22:23:34 +01:00
README android/README: Add note on libglib under Valgrind 2014-02-19 20:26:52 +01:00
socket-api.txt android/doc: Add socket-api.txt document 2013-12-08 17:32:05 +02:00
socket.c android/socket: Fix errno handling in rfsock_set_buffer 2014-03-01 17:22:23 +01:00
socket.h android: Refactor IPC init 2014-02-28 15:22:45 +01:00
system-emulator.c android: Add --leak-check=full option to valgrin in system-emulator 2014-02-22 21:56:46 +01:00
test-ipc.c android: Create comon header for IPC 2014-02-28 15:22:45 +01:00
utils.h android: Update copyright and license details 2014-02-11 10:42:56 -08:00

BlueZ for Android
*****************

Since Android 4.2 there exists a well standardized HAL interface that the
Bluetooth stack is expected to provide and which enables the easy replacement
of the stack of choice on Android. Android BlueZ is intended as a drop-in
replacement to Android provided Bluetooth stack.

More details about BlueZ for Android architecture and components can be found
in android/hal-ipc-api.txt file.

Supported Android version: 4.4

===============================
Building and running on Android
===============================

Steps needed to build and run Android Open Source Project 4.4.2 with
integrated BlueZ.

Build requirements
==================

- GLib - Android 4.2 or later don't provide GLib and one must provide it in
'external/bluetooth/glib' folder of Android tree. Sample Android GLib port
is available at https://code.google.com/p/aosp-bluez.glib/

- SBC - A2DP code requires SBC library (version 1.2 or higher) present in
'external/bluetooth/sbc' directory. Library is build from Android.mk provided
by BlueZ. SBC code is available at git://git.kernel.org/pub/scm/bluetooth/sbc

- Bionic support - Currently only 'master' branch available at
https://android.googlesource.com/platform/bionic provides all required
functionality and running BlueZ on release branch requires backporting missing
features (currently only epoll_create1 call for Android 4.4.2). Sample
Bionic for Android 4.4.2 with all required features backported is available at
https://code.google.com/p/aosp-bluez.platform-bionic/

Runtime requirements
====================

BlueZ HAL library requires 'bluetoothd' and 'bluetoothd-snoop' services to be
available on Android system. Some permissions settings are also required.

This can be done by importing init.bluetooth.rc file in init.rc file of targeted
board:
import init.bluetooth.rc

For convenience examples are provided at:
https://code.google.com/p/aosp-bluez.device-lge-mako/    (Nexus 4)
https://code.google.com/p/aosp-bluez.device-asus-flo/    (Nexus 7 2013)

Downloading and building
========================

Building for Android requires full Android AOSP source tree. Sample Android
4.4.2 tree with all required components present is available at
http://code.google.com/p/aosp-bluez/

This tree provides support for Nexus4 (target aosp_mako-userdebug) and
Nexus 7 2013 (target aosp_flo-userdebug). Tree does not provide binary blobs
needed to run Android on supported devices. Those can be obtained from
https://developers.google.com/android/nexus/drivers. Binary blobs needs to be
unpacked (EULA acceptance required) into 'vendor' directory of Android tree.

Downloading:
repo init -u https://code.google.com/p/aosp-bluez.platform-manifest -b kitkat
repo sync

Building:
source build/envsetup.sh
lunch aosp_mako-userdebug    or    lunch aosp_flo-userdebug
make -j8

Flashing:
adb reboot bootloader
fastboot flashall -w

After full build is done it is possible to rebuild only BlueZ:
'cd external/bluetooth/bluez/android/'
'mm' (or 'mm -B' to force rebuilding of all files)
'adb sync' to update target device.

Linux Kernel requirements
=========================

BlueZ for Android uses Linux Bluetooth subsystem and it must be enabled in
kernel. Minimal required version of management interface is 1.3. This
corresponds to Linux 3.9 but latest available version is recommended. Other
requirements include UHID and network bridge support.

Following kernel options should be enabled:
CONFIG_BT
CONFIG_BT_RFCOMM
CONFIG_BT_RFCOMM_TTY
CONFIG_BT_BNEP
CONFIG_BT_BNEP_MC_FILTER
CONFIG_BT_BNEP_PROTO_FILTER
CONFIG_BRIDGE
CONFIG_UHID

Also BT chip driver needs to be enabled e.g:
CONFIG_BT_HCIBTUSB

If it is not possible to use new enough Linux kernel one can use updated
bluetooth subsytem from Backports project. More information about Backports can
be found at https://backports.wiki.kernel.org. Sample kernels using backports
for running BlueZ on Android are available at
https://code.google.com/p/aosp-bluez.

Running with Valgrind
=====================

BlueZ for Android is preconfigured to be easily run under Valgrind memcheck.
Appropriate configuration and required modules are automatically included when
building either userdebug or eng variant of Android platform.

Valgrind can be enabled in runtime by setting "persist.sys.bluetooth.valgrind"
property to either literal "true" or any numeric value >0. For example:
adb root
adb shell setprop persist.sys.bluetooth.valgrind true

After changing property value Bluetooth need to be restarted to apply changes
(this can be done using UI, just disable and enable it again). Property is
persistent, i.e. there's no need to enable Valgrind again after reboot.

It's recommended to have unstripped libglib.so installed which will enable
complete backtraces in Valgrind output. Otherwise, in many cases backtrace
will break at e.g. g_free() function without prior callers. It's possible to
have proper library installed automatically by appropriate entry in Android.mk,
see https://code.google.com/p/aosp-bluez.glib/ for an example.

=============================
Building and running on Linux
=============================

It is possible to build and test BlueZ for Android daemon on Linux (eg. PC).
Simply follow instructions available at README file in BlueZ top directory.
Android daemon binary is located at android/bluetoothd. See next section on
how to test Android daemon on Linux.

============
Testing tool
============

BT HAL test tools located in android/haltest is provided for HAL level testing
of both Android daemon and HAL library. Start it with '-n' parameter and type
'bluetooth init' in prompt to initialize HAL library. Running without parameter
will make haltest try to initialize all services after start. On Android
required bluetoothd service will be started automatically. On Linux it is
required to start android/bluetoothd manually before init command timeout or
use provided android/system-emulator, which takes care of launching daemon
automatically on HAL library initialization. To deinitialize HAL library and
stop daemon type 'bluetooth cleanup'. Type 'help' for more information. Tab
completion is also supported.

=====================
Implementation status
=====================

Summary of HALs implementation status.

complete    - implementation is feature complete and Android Framework is able
              to use it normally
partial     - implementation is in progress and not all required features are
              present, Android Framework is able to use some of features
initial     - only initial implementations is present, Android Framework is
              able to initialize but most likely not able to use it
not started - no implementation, Android Framework is not able to initialize it

Profile ID    HAL header         Status
---------------------------------------
core          bluetooth.h        complete
a2dp          bt_av.h            complete
gatt          bt_gatt.h          not started
              bt_gatt_client.h   not started
              bt_gatt_server.h   not started
handsfree     bt_hf.h            initial
hidhost       bt_hh.h            complete
health        bt_hl.h            not started
pan           bt_pan.h           complete
avrcp         bt_rc.h            partial
socket        bt_sock.h          complete

===========================
Implementation shortcomings
===========================

It is possible that some of HAL functionality (although being marked as
complete) is missing implementation due to reasons like feature feasibility or
necessity for latest Android Framework. This sections provides list of such
deficiencies. Note that HAL library is always expected to fully implement HAL
API so missing implementation might happen only in daemon.

HAL Bluetooth
=============

methods:
dut_mode_send                      never called from Android Framework
le_test_mode                       never called from Android Framework
get_remote_service_record          never called from Android Framework

callbacks:
dut_mode_recv_cb
le_test_mode_cb

properties:
BT_PROPERTY_SERVICE_RECORD         not supported for adapter and device, for
                                   device this property is to be returned as
                                   response to get_remote_service_record,
                                   not sure what to return on get_property
                                   calls (records of all services?)

BT_PROPERTY_REMOTE_VERSION_INFO    information required by this property (LMP
                                   information) are not accessible from mgmt
                                   interface, also marking this property as
                                   settable is probably a typo in HAL header

Socket HAL
==========

Support only for BTSOCK_RFCOMM socket type.