I spent a day working on this to connect a BT speaker (BETRON KB-S08 or KBS08) and eventually got it working without using the GUI.
[In this post I've left in many comments after the command lines, so it's best to copy all of this to a text file and then copy and post the commands]
1. To start with I used a Jessie image from a RasPi 1 B+ created on 1/1/17 from NOOBS_v2_1_0.zip, and using Win32DiskImager on a PC, copied it to my new Pi 3 SD card and it worked.
2. I then followed the instructions here:
https://www.raspberrypi.org/magpi/bluet ... erry-pi-3/:
sudo apt-get update - 4 packages updated
sudo apt-get dist-upgrade - 126 upgrades; 51 newly installed
sudo apt-get install pi-bluetooth blueman
but instead of this:
sudo apt-get install pulseaudio pavucontrol pulseaudio-module-bluetooth
I did this:
sudo apt-get install bluez pulseaudio-module-bluetooth python-gobject python-gobject-2 bluez-tools
The speaker worked via the GUI (right click on the speaker icon and select the KBS08) but not through the command line (note: I may of tested the GUI later, after doing some of the following).
3. I then visited loads of websites and made the following changes. They may or may not be critical. Changes were made from a Windows PC using Putty. Note: zz:zz:zz:zz:zz:zz is the MAC address of the speakers.
bluetoothctl - fines BT controller at xx:xx:xx:xx:xx:xx raspberrypi
agent on - replies agent registered
default-agent - replies successful
scan on - replies no default controller available
[NEW] Device zz:zz:zz:zz:zz:zz zz-zz-zz-zz-zz-zz
[CHG] Device zz:zz:zz:zz:zz:zz Name: B-BETRON KB-S08
[CHG] Device zz:zz:zz:zz:zz:zz Alias: B-BETRON KB-S08
pair B-BETRON KB-S08 - using alias says not available
pair zz:zz:zz:zz:zz:zz - pairing successful using MAC address
trust zz:zz:zz:zz:zz:zz - RasPi should remember this device
connect zz:zz:zz:zz:zz:zz - sometimes works sometimes fails to connect: oreg.bluez.Error.Failed
- was never asked for any pairing number
- KB-S08 speaker will announce if it is connected.
quit - says DEL controller at xx:xx:xx:xx:xx:xx raspberrypi
sudo usermod –a –G lp pi - add user pi to the Pulse audio group
sudo nano /etc/bluetooth/audio.conf - enable A2DP in Bluetooth configuration:
Enable=Source,Sink,Media,Socket - add this line under [General] section and exit and save
sudo nano /etc/pulse/daemon.conf - modify Pulse daemon configuration file to change its resampling method.:
; resample-method = speex-float-3 - make sure this line starts with a semi-colan
resample-method = trivial - then add this line afterwards; exit & save
sudo nano /etc/bluetooth/main.conf
Enable=Source,Sink,Media - add this line in the [General] section:
Class = 0x00041C - modify this line to set the Bluetooth Class as headphones & speakers; exit & save
pulseaudio --start - start pulseaudio
pacmd set-default-sink bluez_sink.12_04_78_71_6B_56 - set default sink
wget
http://www.freespecialeffects.co.uk/sou ... lice_s.wav - download this audio file
aplay police_s.wav - speakers should play the sound
--------------------------------------------------------
To check run:
pacmd list-cards
You should see something like this:
index: 3
name: <bluez_card.zz_zz_zz_zz_zz_zz>
driver: <module-bluez5-device.c>
owner module: 27
properties:
device.description = "B-BETRON KB-S08"
device.string = "zz:zz:zz:zz:zz:zz"
device.api = "bluez"
device.class = "sound"
device.bus = "bluetooth"
device.form_factor = "headset"
bluez.path = "/org/bluez/hci0/dev_zz_zz_zz_zz_zz_zz"
bluez.class = "0x240404"
bluez.alias = "B-BETRON KB-S08"
device.icon_name = "audio-headset-bluetooth"
device.intended_roles = "phone"
profiles:
a2dp: High Fidelity Playback (A2DP Sink) (priority 10, available: unknown)
off: Off (priority 0, available: yes)
active profile: <a2dp>
sinks:
bluez_sink.zz_zz_zz_zz_zz_zz/#3: B-BETRON KB-S08
sources:
bluez_sink.zz_zz_zz_zz_zz_zz.monitor/#4: Monitor of B-BETRON KB-S08
ports:
headset-output: Headset (priority 0, latency offset 0 usec, available: unknown)
properties:
headset-input: Headset (priority 0, latency offset 0 usec, available: no)
properties:
Key sections are: active profile, sinks & sources
------------------------------------------------------------
IN FUTURE AFTER POWER ON you will need to do this:
Switch on speakers
pulseaudio --start
pacmd set-default-sink bluez_sink.zz_zz_zz_zz_zz_zz
aplay police_s.wav speakers should play
Best to set up a bash script and add to the Pi start up.
Hope this helps.
Alan