Connection Failed: br-connection-profile-unavailable
有用的线索
https://forums.gentoo.org/viewtopic-p-8810212.html?sid=cf51355a4687ecd59cef7586b7e6b97a
在自己机器上,用普通用户看pa-info输出和/etc/pulse/default.pa中有没有bluetooth相关的关键字
pulseaudio-daemon有bluetooth相关的库
...
equery f media-sound/pulseaudio-daemon
/usr/lib64/pulseaudio/modules/module-bluetooth-discover.so
/usr/lib64/pulseaudio/modules/module-bluetooth-policy.so
...
这些库是要被用的
D.Gen|icefire|2024-03-24 21:32:16[ice@ etc]ps aux | grep pulseaudio
ice 4269 0.5 0.0 1315988 23320 ? Sl 20:46 0:15 /usr/bin/pulseaudio --start --log-target=syslog
ice 19165 0.0 0.0 8628 1788 pts/1 S+ 21:32 0:00 grep --color pulseaudio
D.Gen|icefire|2024-03-24 21:32:29[ice@ etc]lsof -p 4269 | grep bluetooth
pulseaudi 4269 ice mem REG 8,5 14192 8009114 /usr/lib64/pulseaudio/modules/module-bluetooth-discover.so
pulseaudi 4269 ice mem REG 8,5 18496 8009230 /usr/lib64/pulseaudio/modules/module-bluetooth-policy.so
D.Gen|icefire|2024-03-24 21:32:31[ice@ etc]lsof /usr/lib64/pulseaudio/modules/module-bluetooth-discover.so
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
pulseaudi 4269 ice mem REG 8,5 14192 8009114 /usr/lib64/pulseaudio/modules/module-bluetooth-discover.so
D.Gen|icefire|2024-03-24 21:32:49[ice@ etc]lsof /usr/lib64/pulseaudio/modules/module-bluetooth-policy.so
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
pulseaudi 4269 ice mem REG 8,5 18496 8009230 /usr/lib64/pulseaudio/modules/module-bluetooth-policy.so
要被加载,是要有配置文件指出
对应的配置文件是/etc/pulse/default.pa,如果以前安装pulseaudio-daemon没有bluetooth,,/etc/pulse/default.pa会不load bluetooth,重新安装pulseaudio-daemon with bluetooth,/etc/pulse/default.pa有可能,不会自动加上load-module module-bluetooth-policy, load-module module-bluetooth-policy
我是把/etc/pulse/._cfg0001_default.pacopy成/etc/pulse/default.pa。
D.Gen|icefire|2024-03-24 21:39:05[ice@ etc]sed -n '58,65p' /etc/pulse/default.pa
### 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-policy
.endif
基于pulseaudio
好不容易把Connection Failed: br-connection-profile-unavailable搞掉,报错变成了:
org.freedesktop.DBus.Error.AccessDenied
搜索,找到这个解决方案
https://github.com/sputnikdev/eclipse-smarthome-bluetooth-binding/issues/9
结合自己实际情况,修改/etc/dbus-1/system.d/bluetooth.conf配置
把root的配置copy一个
<policy user="root">
<allow own="org.bluez"/>
<allow send_destination="org.bluez"/>
<allow send_interface="org.bluez.Agent1"/>
<allow send_interface="org.bluez.MediaEndpoint1"/>
<allow send_interface="org.bluez.MediaPlayer1"/>
<allow send_interface="org.bluez.Profile1"/>
<allow send_interface="org.bluez.GattCharacteristic1"/>
<allow send_interface="org.bluez.GattDescriptor1"/>
<allow send_interface="org.bluez.LEAdvertisement1"/>
<allow send_interface="org.freedesktop.DBus.ObjectManager"/>
<allow send_interface="org.freedesktop.DBus.Properties"/>
</policy>
普通用户的配置
<policy user="ice">
<allow own="org.bluez"/>
<allow send_destination="org.bluez"/>
<allow send_interface="org.bluez.Agent1"/>
<allow send_interface="org.bluez.Device1"/>
<allow send_interface="org.bluez.MediaEndpoint1"/>
<allow send_interface="org.bluez.MediaPlayer1"/>
<allow send_interface="org.bluez.Profile1"/>
<allow send_interface="org.bluez.GattCharacteristic1"/>
<allow send_interface="org.bluez.GattDescriptor1"/>
<allow send_interface="org.bluez.LEAdvertisement1"/>
<allow send_interface="org.freedesktop.DBus.ObjectManager"/>
<allow send_interface="org.freedesktop.DBus.Properties"/>
</policy>
特别注意:org.bluez.Device1要加上,这个是在报错信息给出的,一定 要加上
成功
pactl list的l输出
D.Gen|icefire|2024-03-24 21:13:58[ice@ ~]pactl list | grep -i bluez_card
Name: bluez_card.C0_EA_C3_16_6C_E7
最终成功连接
bluetooth]# devices
Device A4:45:19:BD:4B:A2 VimerRedmiK30
Device 74:E6:81:55:1C:71 74-E6-81-55-1C-71
Device D4:84:57:CA:C7:FD midea
Device 7A:46:F4:0E:EB:7A 7A-46-F4-0E-EB-7A
Device C0:EA:C3:16:6C:E7 iKF-King Pro
[bluetooth]# scan off
[bluetooth]# [CHG] Device C0:EA:C3:16:6C:E7 RSSI is nil
[bluetooth]# [CHG] Device D4:84:57:CA:C7:FD RSSI is nil
[bluetooth]# [CHG] Device 74:E6:81:55:1C:71 RSSI is nil
[bluetooth]# [CHG] Device 7A:46:F4:0E:EB:7A TxPower is nil
[bluetooth]# [CHG] Device 7A:46:F4:0E:EB:7A RSSI is nil
[bluetooth]# [CHG] Controller 00:1A:7D:DA:71:02 Discovering: no
[bluetooth]# Discovery stopped
[bluetooth]# devices
Device A4:45:19:BD:4B:A2 VimerRedmiK30
Device 74:E6:81:55:1C:71 74-E6-81-55-1C-71
Device D4:84:57:CA:C7:FD midea
Device 7A:46:F4:0E:EB:7A 7A-46-F4-0E-EB-7A
Device C0:EA:C3:16:6C:E7 iKF-King Pro
[bluetooC0:EA:C3:16:6C:E7A:C3:16:6C:E7
Attempting to connect to C0:EA:C3:16:6C:E7
[CHG] Device C0:EA:C3:16:6C:E7 Connected: yes
[iKF-King Pro]# [CHG] Device C0:EA:C3:16:6C:E7 Modalias: bluetooth:v05D6p000Ad0240
[iKF-King Pro]# [CHG] Device C0:EA:C3:16:6C:E7 UUIDs: 00001101-0000-1000-8000-00805f9b34fb
[iKF-King Pro]# [CHG] Device C0:EA:C3:16:6C:E7 UUIDs: 0000110b-0000-1000-8000-00805f9b34fb
[iKF-King Pro]# [CHG] Device C0:EA:C3:16:6C:E7 UUIDs: 0000110c-0000-1000-8000-00805f9b34fb
[iKF-King Pro]# [CHG] Device C0:EA:C3:16:6C:E7 UUIDs: 0000110e-0000-1000-8000-00805f9b34fb
[iKF-King Pro]# [CHG] Device C0:EA:C3:16:6C:E7 UUIDs: 0000111e-0000-1000-8000-00805f9b34fb
[iKF-King Pro]# [CHG] Device C0:EA:C3:16:6C:E7 UUIDs: 00001200-0000-1000-8000-00805f9b34fb
[iKF-King Pro]# [CHG] Device C0:EA:C3:16:6C:E7 UUIDs: fe010000-1234-5678-abcd-00805f9b34fb
[iKF-King Pro]# [CHG] Device C0:EA:C3:16:6C:E7 ServicesResolved: yes
[iKF-King Pro]# [CHG] Device C0:EA:C3:16:6C:E7 Bonded: yes
[iKF-King Pro]# [CHG] Device C0:EA:C3:16:6C:E7 Paired: yes
[iKF-King Pro]# [NEW] Endpoint /org/bluez/hci0/dev_C0_EA_C3_16_6C_E7/sep1
[iKF-King Pro]# [NEW] Endpoint /org/bluez/hci0/dev_C0_EA_C3_16_6C_E7/sep2
[iKF-King Pro]# [NEW] Endpoint /org/bluez/hci0/dev_C0_EA_C3_16_6C_E7/sep3
[iKF-King Pro]# [NEW] Transport /org/bluez/hci0/dev_C0_EA_C3_16_6C_E7/sep1/fd1
[iKF-King Pro]# Connection successful
加载模块失败
modprobe: FATAL: Module btusb not found in directory /lib/modules/6.1.67-gentoo.ice-3-20171001
解决:
depmod -a
taobao
/mast/packageLinux/bluetooth_driver/taobao/
hciconfig hci0 up
重新插拔
/etc/init.d/bluetooth restart
modprobe rtk_btusb