BluetoothEnablement

Overview

This page will describe necessary steps to enable Bluetooth with the BlueZ stack on a new device we're porting Ubuntu Touch onto.

WARNING: To get bluetooth working on an Android based device with the BlueZ stack real engineering is needed. This is not just a apply-patch-then-it-will-work.

Add patches to get newer BlueZ kernel stack

We have two reference kernels which have all patches included you need to get the newer BlueZ stack into your device kernel tree. Those are available at

Depending on the changes already applied to your kernel tree there might be more changes required.

Required Kernel build options

The following kernel config options are mandatory:

CONFIG_BRIDGE
CONFIG_CRYPTO_CMAC
CONFIG_CRYPTO_USER_API
CONFIG_CRYPTO_USER_API_HASH
CONFIG_CRYPTO_USER_API_SKCIPHER

If your kernel does support those you might need to import further patches from an upstream kernel to add support for those things.

Configure a kernel with the backported BlueZ kernel stack

For a 3.4 kernel we add the following to our defconfig:

# CONFIG_BACKPORT_6LOWPAN is not set
# CONFIG_BACKPORT_BPAUTO_BUILD_CRYPTO_CCM is not set
CONFIG_BACKPORT_BPAUTO_USERSEL_BUILD_ALL=y
CONFIG_BACKPORT_BT=y
CONFIG_BACKPORT_BT_BNEP=y
CONFIG_BACKPORT_BT_BNEP_MC_FILTER=y
CONFIG_BACKPORT_BT_BNEP_PROTO_FILTER=y
CONFIG_BACKPORT_BT_BREDR=y
CONFIG_BACKPORT_BT_DEBUGFS=y
# CONFIG_BACKPORT_BT_HCIBCM203X is not set
# CONFIG_BACKPORT_BT_HCIBFUSB is not set
# CONFIG_BACKPORT_BT_HCIBPA10X is not set
# CONFIG_BACKPORT_BT_HCIBTSDIO is not set
# CONFIG_BACKPORT_BT_HCIBTUSB is not set
CONFIG_BACKPORT_BT_HCISMD=y
CONFIG_BACKPORT_BT_HCIVHCI=m
CONFIG_BACKPORT_BT_HIDP=y
CONFIG_BACKPORT_BT_LE=y
# CONFIG_BACKPORT_BT_MRVL is not set
CONFIG_BACKPORT_BT_RFCOMM=y
# CONFIG_BACKPORT_BT_SELFTEST is not set
CONFIG_BACKPORT_DIR="backports/"
# CONFIG_BACKPORT_IEEE802154 is not set
CONFIG_BACKPORT_INTEGRATE=y
CONFIG_BACKPORT_KERNEL_3_5=y
CONFIG_BACKPORT_KERNEL_3_6=y
CONFIG_BACKPORT_KERNEL_3_7=y
CONFIG_BACKPORT_KERNEL_3_8=y
CONFIG_BACKPORT_KERNEL_3_9=y
CONFIG_BACKPORT_KERNEL_3_10=y
CONFIG_BACKPORT_KERNEL_3_11=y
CONFIG_BACKPORT_KERNEL_3_12=y
CONFIG_BACKPORT_KERNEL_3_13=y
CONFIG_BACKPORT_KERNEL_3_14=y
CONFIG_BACKPORT_KERNEL_3_15=y
CONFIG_BACKPORT_KERNEL_3_16=y
CONFIG_BACKPORT_KERNEL_3_17=y
CONFIG_BACKPORT_KERNEL_3_18=y
CONFIG_BACKPORT_KERNEL_3_19=y
CONFIG_BACKPORT_KERNEL_3_5=y
CONFIG_BACKPORT_KERNEL_3_6=y
CONFIG_BACKPORT_KERNEL_3_7=y
CONFIG_BACKPORT_KERNEL_3_8=y
CONFIG_BACKPORT_KERNEL_3_9=y
CONFIG_BACKPORT_KERNEL_4_0=y
CONFIG_BACKPORT_KERNEL_4_1=y
CONFIG_BACKPORT_KERNEL_4_2=y
CONFIG_BACKPORT_KERNEL_NAME="Linux"
CONFIG_BACKPORT_KERNEL_VERSION="v4.2-rc7-0-g2c6625c"
CONFIG_BACKPORT_LINUX=y
CONFIG_BACKPORT_VERSION="v4.2-rc1-1-3-g0d0798b"

and for a 3.10 kernel it looks like this

# CONFIG_BACKPORT_6LOWPAN is not set
# CONFIG_BACKPORT_BPAUTO_BUILD_CRYPTO_CCM is not set
CONFIG_BACKPORT_BPAUTO_USERSEL_BUILD_ALL=y
CONFIG_BACKPORT_BT=y
CONFIG_BACKPORT_BT_BNEP=y
CONFIG_BACKPORT_BT_BNEP_MC_FILTER=y
CONFIG_BACKPORT_BT_BNEP_PROTO_FILTER=y
CONFIG_BACKPORT_BT_BREDR=y
CONFIG_BACKPORT_BT_DEBUGFS=y
# CONFIG_BACKPORT_BT_HCIBCM203X is not set
# CONFIG_BACKPORT_BT_HCIBFUSB is not set
# CONFIG_BACKPORT_BT_HCIBPA10X is not set
# CONFIG_BACKPORT_BT_HCIBTSDIO is not set
# CONFIG_BACKPORT_BT_HCIBTUSB is not set
CONFIG_BACKPORT_BT_HCISMD=y
CONFIG_BACKPORT_BT_HCIVHCI=m
CONFIG_BACKPORT_BT_HIDP=y
CONFIG_BACKPORT_BT_LE=y
# CONFIG_BACKPORT_BT_MRVL is not set
CONFIG_BACKPORT_BT_RFCOMM=y
# CONFIG_BACKPORT_BT_SELFTEST is not set
CONFIG_BACKPORT_DIR="backports/"
# CONFIG_BACKPORT_IEEE802154 is not set
CONFIG_BACKPORT_INTEGRATE=y
CONFIG_BACKPORT_KERNEL_3_11=y
CONFIG_BACKPORT_KERNEL_3_12=y
CONFIG_BACKPORT_KERNEL_3_13=y
CONFIG_BACKPORT_KERNEL_3_14=y
CONFIG_BACKPORT_KERNEL_3_15=y
CONFIG_BACKPORT_KERNEL_3_16=y
CONFIG_BACKPORT_KERNEL_3_17=y
CONFIG_BACKPORT_KERNEL_3_18=y
CONFIG_BACKPORT_KERNEL_3_19=y
CONFIG_BACKPORT_KERNEL_4_0=y
CONFIG_BACKPORT_KERNEL_4_1=y
CONFIG_BACKPORT_KERNEL_4_2=y
CONFIG_BACKPORT_KERNEL_NAME="Linux"
CONFIG_BACKPORT_KERNEL_VERSION="v4.2-rc7-0-g2c6625c"
CONFIG_BACKPORT_LINUX=y
CONFIG_BACKPORT_VERSION="v4.2-rc1-1-3-g0d0798b"

Hardware specific Bluetooth driver

The above only brings the Bluetooth stack into the kernel but doesn't connect it with the hardware. For that you need to add a driver to backports/driver/bluetooth/ and connect it properly with the Bluetooth stack. There are examples available.

References

Touch/BluetoothEnablement (last edited 2016-01-08 07:52:34 by pD9ED71F2)