Installing a USB Bluetooth dongle on a Beagleboard xM running Android ICS
by Anton Weber
Some Android ready devices do not ship with any wireless modules on board. The easiest way to upgrade them for Bluetooth or WiFi connectivity are USB dongles.
I tried myself using a Beagleboard xM (runnign Android ICS) and a Bluetooth USB dongle with a Broadcom BCM2045 chip. Unfortunately it is not just a matter of plug and play, especially not on the kernel that ships with the rowboat Android port.
Preparing the source
We need to modify the board configuration in <android_root>/device/ti/beagleboard/BoardConfig.mk and set:
BOARD_HAVE_BLUETOOTH := true
so the Android build system includes all Bluetooth components.
We also want to add Bluetooth support and the Broadcom driver to the kernel. This is done by enabling following options in the <android_root>/kernel/.config
# BT components
# Broadcom driver
Here comes the tricky part. Android uses a component named Bluedroid to power up/shut down the Bluetooth device through the rfkill interface. The problem is that Texas Instrument's kernel does not support rfkill.
A workaround is to give the Android system the impression, it is still in control, without actually using rfkill. For that we remove the affected lines and always return 1 on check_bluetooth_power().
Another problem is, that Bluedroid is starting or stopping the hciattach service on every call of bt_enable() and bt_disable(). hciattach is used to connect serial Bluetooth devices (e.g. connected through UART) to the Bluez stack. Since we are using USB instead, we don't need this service any longer. So we can get rid of these lines too.
The full patch is in the download section.
After this we can start the build and grab a few coffees while the build system does it's job.
Configuring the system
Once all files are on the SD card, there are only a few steps left.
We need to start the Bluetooth service when booting up the system. So we add it to the init.rc:
service dbus /system/bin/dbus-daemon --system --nofork
socket dbus stream 660 bluetooth bluetooth
group bluetooth net_bt_admin
service bluetoothd /system/bin/bluetoothd -n
socket bluetooth stream 660 bluetooth bluetooth
socket dbus_bluetooth stream 660 bluetooth bluetooth
# init.rc does not yet support applying capabilities, so run as root and
# let bluetoothd drop uid to bluetooth with the right linux capabilities
group bluetooth net_bt_admin misc
Enable Bluetooth feature
Now everything is installed and set up properly and the Bluetooth adapter is ready for use. The system just doesn't know it yet. We have to add the right <feature> tag in one of the files in /system/etc/permissions/. I created a new beagleboard_xm.xml file in that directory containing:
<feature name="android.hardware.bluetooth" />
And that's it!
References and Links
Most instructions were taken from the Texas Instruments Android DevKit Porting Guide.