To keep all in one place, further steps outlined here for reference:
Terminal 1
tc@box:~$ sudo /usr/local/lib/bluetooth/bluetoothd -nd
bluetoothd[1501]: Bluetooth daemon 5.50
bluetoothd[1501]: src/main.c:parse_config() parsing /usr/local/etc/bluetooth/main.conf
bluetoothd[1501]: src/main.c:parse_config() Key file does not have key “DiscoverableTimeout” in group “General”
bluetoothd[1501]: src/main.c:parse_config() Key file does not have key “PairableTimeout” in group “General”
bluetoothd[1501]: src/main.c:parse_config() Key file does not have key “Privacy” in group “General”
bluetoothd[1501]: src/main.c:parse_config() name=pCP
bluetoothd[1501]: src/main.c:parse_config() Key file does not have key “Class” in group “General”
bluetoothd[1501]: src/main.c:parse_config() Key file does not have key “DeviceID” in group “General”
bluetoothd[1501]: src/main.c:parse_config() Key file does not have key “ReverseServiceDiscovery” in group “General”
bluetoothd[1501]: src/main.c:parse_config() Key file does not have key “MinEncKeySize” in group “GATT”
bluetoothd[1501]: src/adapter.c:adapter_init() sending read version command
bluetoothd[1501]: Starting SDP server
bluetoothd[1501]: src/sdpd-service.c:register_device_id() Adding device id record for 0002:1d6b:0246:0532
bluetoothd[1501]: src/plugin.c:plugin_init() Loading builtin plugins
bluetoothd[1501]: src/plugin.c:add_plugin() Loading hostname plugin
bluetoothd[1501]: src/plugin.c:add_plugin() Loading wiimote plugin
bluetoothd[1501]: src/plugin.c:add_plugin() Loading autopair plugin
bluetoothd[1501]: src/plugin.c:add_plugin() Loading policy plugin
bluetoothd[1501]: src/plugin.c:add_plugin() Loading a2dp plugin
bluetoothd[1501]: src/plugin.c:add_plugin() Loading avrcp plugin
bluetoothd[1501]: src/plugin.c:add_plugin() Loading network plugin
bluetoothd[1501]: src/plugin.c:add_plugin() Loading input plugin
bluetoothd[1501]: src/plugin.c:add_plugin() Loading hog plugin
bluetoothd[1501]: src/plugin.c:add_plugin() Loading gap plugin
bluetoothd[1501]: src/plugin.c:add_plugin() Loading scanparam plugin
bluetoothd[1501]: src/plugin.c:add_plugin() Loading deviceinfo plugin
bluetoothd[1501]: src/plugin.c:add_plugin() Loading battery plugin
bluetoothd[1501]: src/plugin.c:plugin_init() Loading plugins /usr/local/lib/bluetooth/plugins
bluetoothd[1501]: profiles/input/suspend-none.c:suspend_init()
bluetoothd[1501]: profiles/network/manager.c:read_config() /usr/local/etc/bluetooth/network.conf: Key file does not have key “DisableSecurity” in group “General”
bluetoothd[1501]: profiles/network/manager.c:read_config() Config options: Security=true
bluetoothd[1501]: src/main.c:main() Entering main loop
bluetoothd[1501]: src/rfkill.c:rfkill_event() RFKILL event idx 0 type 1 op 0 soft 0 hard 0
bluetoothd[1501]: Bluetooth management interface 1.14 initialized
bluetoothd[1501]: src/adapter.c:read_version_complete() sending read supported commands command
bluetoothd[1501]: src/adapter.c:read_version_complete() sending read index list command
bluetoothd[1501]: src/rfkill.c:rfkill_event() RFKILL event idx 1 type 2 op 0 soft 0 hard 0
bluetoothd[1501]: src/adapter.c:read_commands_complete() Number of commands: 65
bluetoothd[1501]: src/adapter.c:read_commands_complete() Number of events: 35
bluetoothd[1501]: src/adapter.c:read_commands_complete() enabling kernel-side connection control
bluetoothd[1501]: src/adapter.c:read_index_list_complete() Number of controllers: 1
bluetoothd[1501]: src/adapter.c:read_index_list_complete() Found index 0
bluetoothd[1501]: src/adapter.c:index_added() index 0
bluetoothd[1501]: src/adapter.c:btd_adapter_new() System name: pCP
bluetoothd[1501]: src/adapter.c:btd_adapter_new() Major class: 0
bluetoothd[1501]: src/adapter.c:btd_adapter_new() Minor class: 0
bluetoothd[1501]: src/adapter.c:btd_adapter_new() Modalias: usb:v1D6Bp0246d0532
bluetoothd[1501]: src/adapter.c:btd_adapter_new() Discoverable timeout: 180 seconds
bluetoothd[1501]: src/adapter.c:btd_adapter_new() Pairable timeout: 0 seconds
bluetoothd[1501]: src/adapter.c:index_added() sending read info command for index 0
bluetoothd[1501]: src/adapter.c:read_info_complete() index 0 status 0x00
bluetoothd[1501]: src/adapter.c:clear_uuids() sending clear uuids command for index 0
bluetoothd[1501]: src/adapter.c:clear_devices() sending clear devices command for index 0
bluetoothd[1501]: src/adapter.c:set_mode() sending set mode command for index 0
bluetoothd[1501]: src/adapter.c:set_mode() sending set mode command for index 0
bluetoothd[1501]: src/adapter.c:set_mode() sending set mode command for index 0
bluetoothd[1501]: src/adapter.c:set_privacy() sending set privacy command for index 0
bluetoothd[1501]: src/adapter.c:set_privacy() setting privacy mode 0x00 for index 0
bluetoothd[1501]: src/gatt-database.c:btd_gatt_database_new() GATT Manager registered for adapter: /org/bluez/hci0
bluetoothd[1501]: src/advertising.c:btd_adv_manager_new() LE Advertising Manager created for adapter: /org/bluez/hci0
bluetoothd[1501]: profiles/audio/a2dp.c:media_server_probe() path /org/bluez/hci0
bluetoothd[1501]: plugins/hostname.c:hostname_probe()
bluetoothd[1501]: profiles/network/manager.c:panu_server_probe() path /org/bluez/hci0
bluetoothd[1501]: profiles/network/server.c:server_register() Registered interface org.bluez.NetworkServer1 on path /org/bluez/hci0
bluetoothd[1501]: profiles/network/manager.c:gn_server_probe() path /org/bluez/hci0
bluetoothd[1501]: profiles/network/manager.c:nap_server_probe() path /org/bluez/hci0
bluetoothd[1501]: profiles/audio/avrcp.c:avrcp_controller_server_probe() path /org/bluez/hci0
bluetoothd[1501]: src/adapter.c:adapter_service_add() /org/bluez/hci0
bluetoothd[1501]: src/sdpd-service.c:add_record_to_server() Adding record with handle 0x10001
bluetoothd[1501]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00000017-0000-1000-8000-00805f9
bluetoothd[1501]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00000100-0000-1000-8000-00805f9
bluetoothd[1501]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00001002-0000-1000-8000-00805f9
bluetoothd[1501]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 0000110e-0000-1000-8000-00805f9
bluetoothd[1501]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 0000110f-0000-1000-8000-00805f9
bluetoothd[1501]: src/adapter.c:adapter_service_insert() /org/bluez/hci0
bluetoothd[1501]: src/adapter.c:add_uuid() sending add uuid command for index 0
bluetoothd[1501]: profiles/audio/avrcp.c:avrcp_target_server_probe() path /org/bluez/hci0
bluetoothd[1501]: src/adapter.c:adapter_service_add() /org/bluez/hci0
bluetoothd[1501]: src/sdpd-service.c:add_record_to_server() Adding record with handle 0x10002
bluetoothd[1501]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00000017-0000-1000-8000-00805f9
bluetoothd[1501]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00000100-0000-1000-8000-00805f9
bluetoothd[1501]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00001002-0000-1000-8000-00805f9
bluetoothd[1501]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 0000110c-0000-1000-8000-00805f9
bluetoothd[1501]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 0000110e-0000-1000-8000-00805f9
bluetoothd[1501]: src/adapter.c:adapter_service_insert() /org/bluez/hci0
bluetoothd[1501]: src/adapter.c:add_uuid() sending add uuid command for index 0
bluetoothd[1501]: profiles/audio/a2dp.c:a2dp_sink_server_probe() path /org/bluez/hci0
bluetoothd[1501]: profiles/audio/a2dp.c:a2dp_source_server_probe() path /org/bluez/hci0
bluetoothd[1501]: src/adapter.c:btd_adapter_unblock_address() hci0 00:00:00:00:00:00
bluetoothd[1501]: src/adapter.c:load_link_keys() hci0 keys 0 debug_keys 0
bluetoothd[1501]: src/adapter.c:load_ltks() hci0 keys 0
bluetoothd[1501]: src/adapter.c:load_irks() hci0 irks 0
bluetoothd[1501]: src/adapter.c:load_conn_params() hci0 conn params 0
bluetoothd[1501]: src/adapter.c:adapter_service_insert() /org/bluez/hci0
bluetoothd[1501]: src/adapter.c:add_uuid() sending add uuid command for index 0
bluetoothd[1501]: src/adapter.c:set_did() hci0 source 2 vendor 1d6b product 246 version 532
bluetoothd[1501]: src/adapter.c:adapter_register() Adapter /org/bluez/hci0 registered
bluetoothd[1501]: src/adapter.c:set_dev_class() sending set device class command for index 0
bluetoothd[1501]: src/adapter.c:set_name() sending set local name command for index 0
bluetoothd[1501]: src/adapter.c:set_mode() sending set mode command for index 0
bluetoothd[1501]: src/adapter.c:new_settings_callback() Settings: 0x000000c0
bluetoothd[1501]: src/adapter.c:settings_changed() Changed settings: 0x00000040
bluetoothd[1501]: src/adapter.c:new_settings_callback() Settings: 0x000002c0
bluetoothd[1501]: src/adapter.c:settings_changed() Changed settings: 0x00000200
bluetoothd[1501]: src/adapter.c:new_settings_callback() Settings: 0x00000ac0
bluetoothd[1501]: src/adapter.c:settings_changed() Changed settings: 0x00000800
bluetoothd[1501]: src/adapter.c:set_privacy_complete() Successfuly set privacy for index 0
bluetoothd[1501]: src/adapter.c:load_link_keys_complete() link keys loaded for hci0
bluetoothd[1501]: src/adapter.c:load_ltks_complete() LTKs loaded for hci0
bluetoothd[1501]: src/adapter.c:load_irks_complete() IRKs loaded for hci0
bluetoothd[1501]: src/adapter.c:load_conn_params_complete() Connection Parameters loaded for hci0
bluetoothd[1501]: src/adapter.c:local_name_changed_callback() Name: pCP
bluetoothd[1501]: src/adapter.c:local_name_changed_callback() Short name:
bluetoothd[1501]: src/adapter.c:local_name_changed_callback() Current alias: pCP
bluetoothd[1501]: src/adapter.c:new_settings_callback() Settings: 0x00000ad0
bluetoothd[1501]: src/adapter.c:settings_changed() Changed settings: 0x00000010
bluetoothd[1501]: src/agent.c:agent_ref() 0xfe5a70: ref=1
bluetoothd[1501]: src/agent.c:register_agent() agent :1.1
bluetoothd[1501]: src/adapter.c:property_set_mode() sending Set Powered command for index 0
bluetoothd[1501]: src/adapter.c:property_set_mode_complete() Success (0x00)
bluetoothd[1501]: src/adapter.c:new_settings_callback() Settings: 0x00000ad1
bluetoothd[1501]: src/adapter.c:settings_changed() Changed settings: 0x00000001
bluetoothd[1501]: src/adapter.c:adapter_start() adapter /org/bluez/hci0 has been enabled
bluetoothd[1501]: src/adapter.c:trigger_passive_scanning()
bluetoothd[1501]: src/agent.c:agent_disconnect() Agent :1.1 disconnected
bluetoothd[1501]: src/agent.c:agent_destroy() agent :1.1
bluetoothd[1501]: src/agent.c:agent_unref() 0xfe5a70: ref=0
If you get this dbus error or similar:
tc@box:~$ sudo /usr/local/lib/bluetooth/bluetoothd -nd
bluetoothd[1490]: Bluetooth daemon 5.50
bluetoothd[1490]: src/main.c:parse_config() parsing /usr/local/etc/bluetooth/main.conf
bluetoothd[1490]: src/main.c:parse_config() Key file does not have key “DiscoverableTimeout” in group “General”
bluetoothd[1490]: src/main.c:parse_config() Key file does not have key “PairableTimeout” in group “General”
bluetoothd[1490]: src/main.c:parse_config() Key file does not have key “Privacy” in group “General”
bluetoothd[1490]: src/main.c:parse_config() name=pCP
bluetoothd[1490]: src/main.c:parse_config() Key file does not have key “Class” in group “General”
bluetoothd[1490]: src/main.c:parse_config() Key file does not have key “DeviceID” in group “General”
bluetoothd[1490]: src/main.c:parse_config() Key file does not have key “ReverseServiceDiscovery” in group “General”
bluetoothd[1490]: src/main.c:parse_config() Key file does not have key “MinEncKeySize” in group “GATT”
D-Bus setup failed: Connection ":1.0" is not allowed to own the service "org.bluez" due to security policies in the configuration file
bluetoothd[1490]: Unable to get on D-Bus
Fix by creating conf file:
/etc/dbus-1/system.d/org.bluez.conf
<!DOCTYPE busconfig PUBLIC
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<policy user="root">
<allow own="org.bluez"/>
</policy>
</busconfig>
Need to restart dbus:
tc@box:~$ sudo /usr/local/etc/init.d/dbus restart
stopped /usr/local/bin/dbus-daemon (pid 1137)
tc@box:~$ sudo /usr/local/etc/init.d/dbus status
dbus is running.
Terminal 2 (thanks to Juanito)
tc@box:~$ ./hciattach.sh
bcm43xx_init
Flash firmware /usr/local/lib/firmware/brcm/BCM43430A1.hcd
Set BDADDR UART: b8:27:eb:ba:37:af
Set Controller UART speed to 921600 bit/s
Device setup complete
/usr/local/bin/hciattach /dev/ttyAMA0 bcm43xx 921600 noflow - b8:27:eb:ba:37:af
tc@box:~$ cat ./hciattach.sh
sudo modprobe hci_uart
HCIATTACH=/usr/local/bin/hciattach
SERIAL=`grep Serial /proc/cpuinfo | cut -c19-`
B1=`echo $SERIAL | cut -c3-4`
B2=`echo $SERIAL | cut -c5-6`
B3=`echo $SERIAL | cut -c7-8`
BDADDR=`printf b8:27:eb:%02x:%02x:%02x $((0x$B1 ^ 0xaa)) $((0x$B2 ^ 0xaa)) $((0x$B3 ^ 0xaa))`
# Rpi3 Serial port
SERIAL_DEV="/dev/ttyAMA0"
if [ "$(cat /proc/device-tree/aliases/uart0)" = "$(cat /proc/device-tree/aliases/serial1)" ] ; then
if [ "$(wc -c /proc/device-tree/soc/gpio@7e200000/uart0_pins/brcm\,pins | cut -f 1 -d ' ')" = "16" ] ; then
$HCIATTACH $SERIAL_DEV bcm43xx 3000000 flow - $BDADDR
echo "$HCIATTACH $SERIAL_DEV bcm43xx 3000000 flow - $BDADDR"
else
$HCIATTACH $SERIAL_DEV bcm43xx 921600 noflow - $BDADDR
echo "$HCIATTACH $SERIAL_DEV bcm43xx 921600 noflow - $BDADDR"
fi
else
$HCIATTACH $SERIAL_DEV bcm43xx 460800 noflow - $BDADDR
echo "$HCIATTACH $SERIAL_DEV bcm43xx 460800 noflow - $BDADDR"
fi
Run
tc@box:~$ bluetoothctl
Agent registered
[bluetooth]# power on
Changing power on succeeded
[CHG] Controller B8:27:EB:BA:37:AF Powered: yes
[bluetooth]# exit
tc@box:~$ cat /mnt/mmcblk0p1/cmdline3.txt
zswap.compressor=lz4 zswap.zpool=z3fold dwc_otg.lpm_enable=0 console=tty1 root=/dev/ram0 elevator=deadline rootwait quiet nortc loglevel=3 noembed
tc@box:~$ cat /mnt/mmcblk0p1/config.txt
# For more options and information see
# http://www.raspberrypi.org/documentation/configuration/config-txt.md
# Some settings may impact device functionality. See link above for details
[PI0]
initramfs 11.0beta1a.gz followkernel
kernel kernel41981.img
cmdline cmdline.txt
[PI1]
initramfs 11.0beta1a.gz followkernel
kernel kernel41981.img
cmdline cmdline.txt
[PI2]
initramfs 11.0beta1av7.gz followkernel
kernel kernel41981v7.img
cmdline cmdline.txt
[PI3]
initramfs 11.0beta1av7.gz followkernel
kernel kernel41981v7.img
cmdline cmdline3.txt
[PI4]
initramfs 11.0beta1av7l.gz followkernel
kernel kernel41981v7l.img
cmdline cmdline3.txt
[ALL]
# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1
# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
#disable_overscan=1
# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16
# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720
# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1
# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1
# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2
# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4
# uncomment for composite PAL
#sdtv_mode=2
#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800
#----------------------------------------------------
# Enable peripheral buses
dtparam=i2c=on,spi=on,i2s=on
# Enable onboard audio
dtparam=audio=on
# Enable serial console
enable_uart=1
[PI3]
#dtoverlay=pi3-disable-bt
#dtoverlay=pi3-miniuart-bt