The Fuchsia Bluetooth system aims to provide a dual-mode implementation of the Bluetooth Host Subsystem (5.0+) supporting a framework for developing Low Energy and Traditional profiles.

Source code shortcuts:

For more orientation, see

Getting Started

API Examples

Examples using Fuchsia's Bluetooth Low Energy APIs for all four LE roles can be found in Garnet and Topaz. All of these are currently compiled into Fuchsia by default.

  • LE scanner: see eddystone_agent. This is a suggestion agent that proposes URL links that are obtained from Eddystone beacons. This is built in topaz by default.
  • LE broadcaster: see eddystone_advertiser. This is a Flutter module that can advertise any entered URL as an Eddystone beacon.
  • LE peripheral: see the ble_rect and bt-le-battery-service examples.
  • LE central: see ble_scanner.

Control API

Dual-mode (LE + Classic) GAP operations that are typically exposed to privileged clients are performed using the control.fidl API. This API is intended for managing local adapters, device discovery & discoverability, pairing/bonding, and other settings.

bt-cli is a command-line front-end for this API:

$ bt-cli
bluetooth> list-adapters
  Adapter 0
    id: bf004a8b-d691-4298-8c79-130b83e047a1
    address: 00:1A:7D:DA:0A

We also have a Flutter module that acts as a Bluetooth system menu based on this API at topaz/app/bluetooth_settings.


See the bluetooth/tools package for more information on available command line tools for testing/debugging.

Running Tests

Unit tests

The bluetooth_tests package contains Bluetooth test binaries. This package is defined in the tests BUILD file.

Host subsystem tests are compiled into a single GoogleTest binary, which gets installed at /system/test/bluetooth_unittests.

Running on real hardware
  • Run all the tests:

    $ runtests -t bt-host-unittests
  • Or use the --gtest_filter flag to run a subset of the tests:

    # This only runs the L2CAP unit tests.
    $ /pkgfs/packages/bluetooth_tests/0/test/bt-host-unittests --gtest_filter=L2CAP_*

    (We specify the full path in this case, because runtests doesn't allow us to pass through arbitrary arguments to the test binary.)

  • And use the --verbose flag to set log verbosity:

    # This logs all messages logged using FXL_VLOG (up to level 2)
    $ /pkgfs/packages/bluetooth_tests/0/test/bt-host-unittests --verbose=2
Running on QEMU

If you don't have physical hardware available, you can run the tests in QEMU using the same commands as above. A couple of tips will help run the tests a little more quickly.

  • Run the VM with hardware virtualization support: fx run -k
  • Disable unnecessary logging for the tests:
    $ /pkgfs/packages/bluetooth_tests/0/test/bt-host-unittests --quiet=10

With these two tips, the full bt-host-unittests suite runs in ~2 seconds.

Integration Tests

TODO(armansito): Describe integration tests

Controlling Log Verbosity


The most reliable way to enable higher log verbosity is with kernel command line parameters. These can be configured through the fx set command:

fx set x64 --args="kernel_cmdline_files=[\"$FUCHSIA_DIR/kernel_cmdline.txt\"]"

Add the commands to the $FUCHSIA_DIR/kernel_cmdline.txt, e.g. to enable full logging for the usb transport, intel hci and host drivers:

$ cat $FUCHSIA_DIR/kernel_cmdline.txt

(Hci drivers other than Intel can also be set. Other hci drivers include bt_hci_atheros, bt_hci_passthrough, and bt_hci_fake)

Using fx set writes these values into the image, so they will survive a restart.

For more detail on driver logging, see Zircon driver logging


The Bluetooth system service is invoked by sysmgr to resolve service requests. The mapping between environment service names and their handlers is defined in bin/sysmgr/config/services.config. Add the --verbose option to the Bluetooth entries to increase verbosity, for example:

    "bluetooth::control::AdapterManager": [ "bluetooth", "--verbose=2" ],
    "bluetooth::gatt::Server": [ "bluetooth", "--verbose=2" ],
    "bluetooth::low_energy::Central": [ "bluetooth", "--verbose=2" ],
    "bluetooth::low_energy::Peripheral": [ "bluetooth", "--verbose=2" ],


The bthost driver currently uses the FXL logging system. To enable maximum log verbosity, set the BT_DEBUG macro to 1 in drivers/bluetooth/host/