Hi everyone,
I try to configure Bluetooth connection with my smartphone to a container.
I take a look around the forum but can’t find an idea (I don’t know the Bluetooth protocol very well).
From my understanding : bluetoothd communicate with the Bluetooth device and run on the BalenaOS host and them the container communicate with the daemon through dbus with an agent (bluetoothctl for example).
I can pair my device but can’t connect it. I try to adapt what was done in the Bluetooth BalenaSound container but got an error :
bash-5.0# /usr/bin/bluealsa -i hci0 -p a2dp-sink
/usr/bin/bluealsa: E: Couldn't acquire D-Bus name: org.bluealsa
info : Raspberry Pi 3 A+ , Alpine Linux 3.11
package installed :
apk add --no-cache bluez bluez-deprecated alsa-utils alsa-utils-doc alsa-lib alsaconf
apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing bluez-alsa
bluetoothctl seems good :
bash-5.0# bluetoothctl
Agent registered
[bluetooth]# show
Controller B8:27:EB:14:A6:97 (public)
Name: 5fc958d
Alias: chambre
Class: 0x00000000
Powered: yes
Discoverable: yes
DiscoverableTimeout: 0x00000000
Pairable: yes
UUID: Generic Attribute Profile (00001801-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: Generic Access Profile (00001800-0000-1000-8000-00805f9b34fb)
Modalias: usb:v1D6Bp0246d0532
Discovering: no
Advertising Features:
ActiveInstances: 0x00
SupportedInstances: 0x05
SupportedIncludes: tx-power
SupportedIncludes: appearance
SupportedIncludes: local-name
and I paired my device :
[NEW] Device 58:CB:52:16:4B:35 Thibault
[CHG] Device 58:CB:52:16:4B:35 Modalias: bluetooth:v00E0p1200d1436
[CHG] Device 58:CB:52:16:4B:35 UUIDs: 00001105-0000-1000-8000-00805f9b34fb
[CHG] Device 58:CB:52:16:4B:35 UUIDs: 0000110a-0000-1000-8000-00805f9b34fb
[CHG] Device 58:CB:52:16:4B:35 UUIDs: 0000110c-0000-1000-8000-00805f9b34fb
[CHG] Device 58:CB:52:16:4B:35 UUIDs: 0000110e-0000-1000-8000-00805f9b34fb
[CHG] Device 58:CB:52:16:4B:35 UUIDs: 00001112-0000-1000-8000-00805f9b34fb
[CHG] Device 58:CB:52:16:4B:35 UUIDs: 00001115-0000-1000-8000-00805f9b34fb
[CHG] Device 58:CB:52:16:4B:35 UUIDs: 00001116-0000-1000-8000-00805f9b34fb
[CHG] Device 58:CB:52:16:4B:35 UUIDs: 0000111f-0000-1000-8000-00805f9b34fb
[CHG] Device 58:CB:52:16:4B:35 UUIDs: 0000112d-0000-1000-8000-00805f9b34fb
[CHG] Device 58:CB:52:16:4B:35 UUIDs: 0000112f-0000-1000-8000-00805f9b34fb
[CHG] Device 58:CB:52:16:4B:35 UUIDs: 00001132-0000-1000-8000-00805f9b34fb
[CHG] Device 58:CB:52:16:4B:35 UUIDs: 00001200-0000-1000-8000-00805f9b34fb
[CHG] Device 58:CB:52:16:4B:35 UUIDs: 00001800-0000-1000-8000-00805f9b34fb
[CHG] Device 58:CB:52:16:4B:35 UUIDs: 00001801-0000-1000-8000-00805f9b34fb
[CHG] Device 58:CB:52:16:4B:35 UUIDs: b3b7e28e-a000-3e17-bd86-6e97b9e28c11
[CHG] Device 58:CB:52:16:4B:35 ServicesResolved: yes
[CHG] Device 58:CB:52:16:4B:35 Paired: yes
[CHG] Device 58:CB:52:16:4B:35 ServicesResolved: no
[CHG] Device 58:CB:52:16:4B:35 Connected: no
[bluetooth]# paired-devices
Device 58:CB:52:16:4B:35 Thibault
One thing I don’t uderstand is why the device disconnect after the pairing phase :
[CHG] Device 58:CB:52:16:4B:35 ServicesResolved: no
[CHG] Device 58:CB:52:16:4B:35 Connected: no
And I can’t connect after that :
[bluetooth]# connect 58:CB:52:16:4B:35
Attempting to connect to 58:CB:52:16:4B:35
Failed to connect: org.bluez.Error.Failed
I also try to trust the device then connect from the shell or from the phone can’t make it work :
[bluetooth]# trust 58:CB:52:16:4B:35
[CHG] Device 58:CB:52:16:4B:35 Trusted: yes
Changing 58:CB:52:16:4B:35 trust succeeded
[bluetooth]# connect 58:CB:52:16:4B:35
Attempting to connect to 58:CB:52:16:4B:35
Failed to connect: org.bluez.Error.Failed
there is some info from the device :
[bluetooth]# info 58:CB:52:16:4B:35
Device 58:CB:52:16:4B:35 (public)
Name: Thibault
Alias: Thibault
Class: 0x005a020c
Icon: phone
Paired: yes
Trusted: yes
Blocked: no
Connected: no
LegacyPairing: no
UUID: OBEX Object Push (00001105-0000-1000-8000-00805f9b34fb)
UUID: Audio Source (0000110a-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control (0000110e-0000-1000-8000-00805f9b34fb)
UUID: Headset AG (00001112-0000-1000-8000-00805f9b34fb)
UUID: PANU (00001115-0000-1000-8000-00805f9b34fb)
UUID: NAP (00001116-0000-1000-8000-00805f9b34fb)
UUID: Handsfree Audio Gateway (0000111f-0000-1000-8000-00805f9b34fb)
UUID: SIM Access (0000112d-0000-1000-8000-00805f9b34fb)
UUID: Phonebook Access Server (0000112f-0000-1000-8000-00805f9b34fb)
UUID: Message Access Server (00001132-0000-1000-8000-00805f9b34fb)
UUID: PnP Information (00001200-0000-1000-8000-00805f9b34fb)
UUID: Generic Access Profile (00001800-0000-1000-8000-00805f9b34fb)
UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
UUID: Vendor specific (b3b7e28e-a000-3e17-bd86-6e97b9e28c11)
Modalias: bluetooth:v00E0p1200d1436