Depuis que j’utilise une mini enceinte Bluetooth ça m’a obligé à creuser le fonctionnement.
Environnement
PC sous Linux Debian 10 (Buster]
Logiciels utilisés
j’ai épuré les outils pour ne garder que gnome-bluetooth
apt list --installed | grep blue
bluetooth/testing,testing,unstable,unstable,now 5.50-1 all [installé]
bluewho/stable,stable,testing,testing,unstable,unstable,now 0.1-2 all [installé]
bluez-firmware/testing,testing,unstable,unstable,now 1.2-4 all [installé]
bluez-obexd/testing,unstable,now 5.50-1 amd64 [installé]
bluez/testing,unstable,now 5.50-1 amd64 [installé]
gir1.2-gnomebluetooth-1.0/testing,unstable,now 3.28.2-3 amd64 [installé, automatique]
gnome-bluetooth/testing,unstable,now 3.28.2-3 amd64 [installé]
libbluetooth3/testing,unstable,now 5.50-1 amd64 [installé]
libgnome-bluetooth13/testing,unstable,now 3.28.2-3 amd64 [installé]
pulseaudio-module-bluetooth/testing,unstable,now 12.2-4 amd64 [installé]
python-bluez/testing,unstable,now 0.22+really0.22-1 amd64 [installé, automatique]
Configuration
j’ai mis l’activation à 1 dans /etc/default/bluetooth
# Defaults for bluez # start bluetooth on boot? # compatibility note: if this variable is _not_ found bluetooth will start BLUETOOTH_ENABLED=1
Vérification
systemctl status bluetooth
● bluetooth.service - Bluetooth service
Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2018-09-22 10:12:12 CEST; 11min ago
Docs: man:bluetoothd(8)
Main PID: 548 (bluetoothd)
Status: "Running"
Tasks: 1 (limit: 4317)
Memory: 3.0M
CGroup: /system.slice/bluetooth.service
└─548 /usr/lib/bluetooth/bluetoothd
sept. 22 10:12:08 debian bluetoothd[548]: Bluetooth daemon 5.50 sept. 22 10:12:12 debian systemd[1]: Started Bluetooth service. sept. 22 10:12:12 debian bluetoothd[548]: Starting SDP server sept. 22 10:12:12 debian bluetoothd[548]: Version mismatch for sixaxis
sept. 22 10:12:12 debian bluetoothd[548]: Bluetooth management interface 1.14 initialized
sept. 22 10:12:13 debian bluetoothd[548]: Sap driver initialization failed.
sept. 22 10:12:13 debian bluetoothd[548]: sap-server: Operation not permitted (1)
sept. 22 10:12:47 debian bluetoothd[548]: Endpoint registered: sender=:1.38 path=/MediaEndpoint/A2DPSource
sept. 22 10:12:47 debian bluetoothd[548]: Endpoint registered: sender=:1.38 path=/MediaEndpoint/A2DPSink
sept. 22 10:15:56 debian bluetoothd[548]: /org/bluez/hci0/dev_F4_4E_FD_A7_12_0D/fd0: fd(32) ready
Plus d’info sur la configuration Bluetooth
Tout est dans /etc/bluetooth
voir le manuel du daemon bluetoothd
voir le manuel Bluetooth Manager
Configuration pour Pulseaudio
J’ai masqué la mise en veille
root@debian:/etc/pulse# grep suspend default.pa
### Automatically suspend sinks/sources that become idle for too long
#load-module module-suspend-on-idle
Quelques commandes d’administration
hciconfig
hci0: Type: Primary
Bus: USB BD Address: CC:52:AF:67:BA:34 ACL MTU: 1021:8 SCO MTU: 64:1
UP RUNNING PSCAN
RX bytes:1124 acl:0 sco:0 events:63 errors:0
TX bytes:3653 acl:0 sco:0 commands:63 errors:0
Au début le Bluetooth est actif sans aucun équipement connecté.
#bluetoothctl
Agent registered
[bluetooth]#
[bluetooth]# show
Controller CC:52:AF:67:BA:34 (public)
Name: debian
Alias: debian
Class: 0x000c010c
Powered: yes
Discoverable: no
Pairable: yes
UUID: Headset AG (00001112-0000-1000-8000-00805f9b34fb)
UUID: Audio Source (0000110a-0000-1000-8000-00805f9b34fb)
UUID: Audio Sink (0000110b-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control (0000110e-0000-1000-8000-00805f9b34fb)
UUID: PnP Information (00001200-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
UUID: Headset (00001108-0000-1000-8000-00805f9b34fb)
Modalias: usb:v1D6Bp0246d0532
Discovering: no
[bluetooth]#
[bluetooth]# list
Controller CC:52:AF:67:BA:34 debian [default]
Ici je connecte mon enceinte Soundcloud, la commande l’indique.
[CHG] Device F4:4E:FD:A7:12:0D Connected: yes
[SoundCore mini2]# info
Device F4:4E:FD:A7:12:0D (public)
Name: SoundCore mini2
Alias: SoundCore mini2
Class: 0x00240404
Icon: audio-card
Paired: yes
Trusted: yes
Blocked: no
Connected: yes
LegacyPairing: no
UUID: Audio Source (0000110a-0000-1000-8000-00805f9b34fb)
UUID: Audio Sink (0000110b-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
UUID: Advanced Audio Distribu.. (0000110d-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control (0000110e-0000-1000-8000-00805f9b34fb)
UUID: Handsfree (0000111e-0000-1000-8000-00805f9b34fb)
[SoundCore mini2]#exit
#btmgmt
[mgmt]# info
Index list with 1 item
hci0: Primary controller
addr CC:52:AF:67:BA:34 version 5 manufacturer 15 class 0x0c010c
supported settings: powered connectable fast-connectable discoverable bondable link-security ssp br/edr hs debug-keys
current settings: powered fast-connectable bondable ssp br/edr
name debian
short name
[mgmt]# exit
Ajout de configuration
Comme mon équipement le supporte j’ai activé la connexion rapide.
Dans /etc/bluetooth/main.conf
FastConnectable = true
Vérification
#btmgmt
[mgmt]# info
Index list with 1 item
hci0: Primary controller addr CC:52:AF:67:BA:34 version 5 manufacturer 15 class 0x0c010c
supported settings: powered connectable fast-connectable
discoverable bondable link-security ssp br/edr hs debug-keys
current settings: powered connectable fast-connectable discoverable bondable ssp br/edr
name debian short name
[mgmt]# exit
Vérifier les équipements
Tout est dans /var/lib/bluetooth
Les équipements sont identifiés par leur adresse MAC
Utilisation
Tout se fait par les menus Gnome de la barre d’état et les paramètres Gnome Bluetooth

Les réglages audio se font par l’outil de Pulseaudio, Pavucontrol


Donc c’est nickel, lorsque j’allume mon enceinte Bluetooth, le son bascule automatiquement des haut-parleurs du PC vers l’enceinte Bluetooth (vue comme des écouteurs) et le logo Bluetooth apparaît dans la barre d’état.

En cas de blocage
Si le Bluetooth ne s’active pas il s’agit peut-être d’un blocage matériel.
Sur mon PC HP appuyer sur la touche « Antenne Radio » du clavier mets le wifi en mode avion (normal).
Mais re-appuyer sur la touche « Antenne Radio » du clavier remets le wifi et le Bluetooth en service.
Ça m’a sauvé en évitant de rebooter.
Vérification du module utilisé
avec lsusb et lsusb -t j’ai la référence de l’équipement Bluetooth et le module utilisé
Bus 007 Device 002: ID 0a5c:21b4 Broadcom Corp. BCM2070 Bluetooth 2.1 + EDR /: Bus 07.Port 1: Dev 1, Class=root_hub, Driver=ohci-pci/4p, 12M |__ Port 1: Dev 2, If 1, Class=Wireless, Driver=btusb, 12M
A noter qu’en déchargeant et rechargeant le module le Bluetooth passe aussi actif
root@debian:~# modprobe -r btusb root@debian:~# modprobe -i btusb
Ajout dans /etc/rc.local
#!/bin/sh -e
#
# rc.local
# # This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other # value on error.
# # In order to enable or disable this script just change the execution # bits.
#
# By default this script does nothing.
modprobe -r btusb
modprobe -i btusb
exit 0
Interdire l’autosuspend du module btusb
Pour qu’il soit alimenté au maximum, je passe le paramètre btusb.enable_autosuspend=n au noyau dans /etc/default/grub
Plus d’infos sur l’alimentation usb
Vérification
root@debian:/# cat /sys/bus/usb/devices/7-1/power/control
on