GBD and BlueALSA TroubleShooting - andy3471/GBD GitHub Wiki
Auto Power-on After Boot
To power-on the Bluetooth device automatically at boot:
$ cat /etc/bluetooth/main.conf
...
[Policy]
AutoEnable=true
Disabling PIN Requirement for BT Device Pairing
The system (e.g. via bluetoothctl(1)
) may request a PIN code when pairing BT devices. To disable this
behaviour try running:
$ hciconfig hci0 sspmode 1
$ hciconfig hci0 sspmode
hci0: Type: Primary Bus: UART
BD Address: 11:22:33:68:BC:15 ACL MTU: 1021:8 SCO MTU: 64:1
Simple Pairing mode: Enabled
Other useful hciconfig(1)
commands:
-
To power up a BT device:
$ sudo hciconfig hci0 up
Note that this operation can also be done via the
power on
command in thebluetoothctl(1)
terminal. -
Setting the name of the BT device, e.g.:
$ sudo hciconfig hci0 name “raspberry”
Pinging a BT device
Recall that before pinging another BT device of address MACADDR
, the local BT device should be powered up in
the first place, e.g.:
$ sudo hciconfig hci0 up
then ping:
$ sudo l2ping MACADDR
Making RPi BT Device Discoverable
The RPi BT device might not be discoverable by default.
[bluetooth]# show
Controller 11:22:33:68:BC:15
Name: raspberrypi
Alias: raspberrypi
Class: 0x6c0000
Powered: yes
Discoverable: no
...
In other words, it will not show up when another BT device (that has never paired with it) performs a scan. The following command can be used to make the RPi BT device discoverable, but only for a brief duration of time:
[bluetooth]# discoverable on
Changing discoverable on succeeded
[CHG] Controller 11:22:33:68:BC:15 Discoverable: yes
To make it always discoverable (for headless operation), set the
DiscoverableTimeout
option in /etc/bluetooth/main.conf
to 0:
$ cat /etc/bluetooth/main.conf to 0
...
# How long to stay in discoverable mode before going back to non-discoverable
# The value is in seconds. Default is 180, i.e. 3 minutes.
# 0 = disable timer, i.e. stay discoverable forever
DiscoverableTimeout = 0
Reboot (or restart bluetoothd
) and verify:
[bluetooth]# show
Controller 11:22:33:68:BC:15
Name: raspberrypi
Alias: raspberrypi
Class: 0x6c0000
Powered: yes
Discoverable: yes
...
See also link
A2DP Agent Authentication Issues
Scenario: A BT device may connect/pair successfully with the RPi, but still fail to transmit audio via BT. For instance, one Android phone still played sound via its speaker even after connecting and pairing with the RPi. Yet playing BT audio via a laptop (Ubuntu 16.04) worked.
On the RPi, running
$ journalctl -xf -u bluetooth.service
bluetoothd[674]: Authentication attempt without agent
suggested that some kind of authentication by an A2DP agent was required.
In such situations, try using this (Python based) a2dp-agent
presented on this page.
RFKILL (Radio Frequency Management)
Check whether Bluetooth has been blocked by rfkill(8)
:
$ rfkill list
0: phy0: Wireless LAN
Soft blocked: no
Hard blocked: no
1: hci0: Bluetooth
Soft blocked: no
Hard blocked: no
To soft-unblock:
$ sudo rfkill unblock hci0
or, for all available Bluetooth devices:
$ sudo rfkill unblock bluetooth
Hard-unblock usually requires pressing/setting some kind of H/W button/jumper.
DISABLING PULSEAUDIO BT
-
Disable PA BT modules by commenting the following lines in
/etc/pulse/default.pa
(or equivalent file):### Automatically load driver modules for Bluetooth hardware #.ifexists module-bluetooth-policy.so #load-module module-bluetooth-policy #.endif #.ifexists module-bluetooth-discover.so #load-module module-bluetooth-discover #.endif
-
Unload PA BT modules by restarting PA (as non-root user)
-
if auto-respace is enabled:
$ pulseaudio -k
-
if auto-respawn is disabled:
$ pulseaudio --kill $ pulseaudio --start
-
-
Restart
bluetooth.service
$ sudo service bluetooth restart
-
Restart BlueALSA
$ sudo service bluealsa restart
Recall that
bluealsa.service
should include the--a2dp-force-audio-cd
switch as described in section A2DP.
Also check this link out.