Android - Porting Guide

Android Platform Development Kit

Introduction

Android's Bluetooth stack uses BlueZ version 3.36 for GAP, SDP, and RFCOMM profiles, and is a SIG-qualified Bluetooth 2.0 host stack.

Bluez is GPL licensed, so the Android framework interacts with userspace bluez code through D-BUS IPC to avoid proprietary code.

Headset and Handsfree (v1.5) profiles are implemented in the Android framework and are both tightly coupled with the Phone App. These profiles are also SIG qualified.

The diagram below offers a library-oriented view of the Bluetooth stack. Click Bluetooth Process Diagram for a process-oriented view.

Solid elements represent Android blocks and dashed elements represent partner-specific blocks.

Porting

BlueZ is Bluetooth 2.0 compatible and should work with any 2.0 chipset. There are two integration points:

  • UART driver
  • Bluetooth Power On / Off

UART Driver

The BlueZ kernel sub-system attaches to your hardware-specific UART driver using the hciattach daemon.

For example, for MSM7201A, this is drivers/serial/msm_serial.c. You may also need to edit command line options to hciattach via init.rc.

Bluetooth Power On / Off

The method for powering on and off your bluetooth chip varies from Android V 1.0 to post 1.0.

  • 1.0: Android framework writes a 0 or 1 to /sys/modules/board_[PLATFORM]/parameters/bluetooth_power_on.
  • Post 1.0: Android framework uses the linux rfkill API. See arch/arm/mach-msm/board-trout-rfkill.c for an example.

Tools

BlueZ provides a rich set of command line tools for debugging and interacting with the Bluetooth sub-system, including:

  • hciconfig
  • hcitool
  • hcidump
  • sdptool
  • dbus-send
  • dbus-monitor

v0.6 - 25 November 2008