我正在尝试将Raspberry Pi 3的声音播放到蓝牙扬声器,但无法正常工作。
该pi连接到蓝牙扬声器(在连接时通过扬声器上的自动音频进行确认,“ raspberrypi已连接”,并且在pi上检查echo "info 04:52:C7:5A:3B:A1" | bluetoothctl
也会显示已连接)。
扬声器音量不会静音,其他设备可以连接到它并播放它。选中alsamixer
会验证音频没有被静音。
但是使用播放通过蓝牙扬声器播放声音只会导致震耳欲聋的静音。虽然看起来可行:
$ aplay -D bluealsa:HCI=hci0,DEV=04:52:C7:5A:3B:A1,PROFILE=a2dp /usr/share/sounds/alsa/Front_Center.wav
Playing WAVE '/usr/share/sounds/alsa/Front_Center.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
我正在寻找可能包含信息但未找到任何内容的日志文件。
我按照说明here进行了设置。此设置的详细信息是:
/etc/dbus-1/system.d/bluetooth.conf
,并向root
元素添加了以下几行:
<allow send_interface="org.bluez.ThermometerWatcher1"/>
<allow send_interface="org.bluez.HeartRateWatcher1"/>
<allow send_interface="org.bluez.CyclingSpeedWatcher1"/>
busconfig
元素中:
<policy group="bluetooth"><allow send_destination="org.bluez"/></policy>
我尝试将HCI,设备和配置文件详细信息移到.asoundrc和/etc/asound.conf文件中,但它们产生的结果相同(控制台输出表明成功,但是当我使用播放时,扬声器没有声音)。
sudo systemctl status blueto*
在蓝牙服务上显示一条错误消息:Failed to set privacy: Rejected (0x0b)
,显然是与引导有关的问题(link),该问题已通过手动重新启动蓝牙服务来解决使用systemctl引导后(丑陋,但暂时可以解决)。
Nov 10 21:02:16 rpi_3e5ccf bluealsa[789]: /usr/bin/bluealsa: Unsupported AT message: SET: command:+CLIP, value:1
Nov 10 21:02:16 rpi_3e5ccf bluealsa[789]: /usr/bin/bluealsa: Unsupported AT message: CMD: command:+CLCC, value:(null)
Nov 10 21:02:16 rpi_3e5ccf bluealsa[789]: /usr/bin/bluealsa: Unsupported AT message: SET: command:+CSRSF, value:0,0,0,1,0,0,0
答案 0 :(得分:1)
最终,我无法调试它并感到不耐烦,所以只擦了SD并从头开始。我遵循的详细步骤如下,这意味着我现在可以使用aplay播放音频,而无需指定设备,例如:
aplay /usr/share/sound/alsa/Front_Center.wav
1)设置SD卡映像
2)从主机到pi的ssh-copy-id,以便使用SSH
3)在pi上设置软件:
passwd
sudo apt update; sudo apt dist-upgrade
sudo apt install vim git screen htop rpi-update
sudo apt autoremove
sudo systemctl set-default multi-user.target # don't start X windows on boot
sudo BRANCH=next rpi-update
sudo reboot
4)更新bluez
sudo apt install libdbus-1-dev libglib2.0-dev libudev-dev libical-dev libreadline-dev
wget http://www.kernel.org/pub/linux/bluetooth/bluez-5.50.tar.xz
tar -xf bluez-5.50.tar.xz` cd bluez-5.50/
./configure --prefix=/usr --mandir=/usr/share/man --sysconfdir=/etc --localstatedir=/var --enable-experimental
make -j4
sudo make install
sudo cp /etc/dbus-1/system.d/bluetooth.conf /etc/dbus-1/system.d/bluetooth.conf.bak
,然后编辑:
root
:<allow send_interface="org.bluez.ThermometerWatcher1"/><allow send_interface="org.bluez.HeartRateWatcher1"/><allow send_interface="org.bluez.CyclingSpeedWatcher1"/>
busconfig
的新子代:<policy group="bluetooth"><allow send_destination="org.bluez"/></policy>
5)使蓝牙正常工作
sudo adduser pi bluetooth
sudo reboot
scan on
trust 04:52:C7:5A:3B:A1
connect 04:52:C7:5A:3B:A1
aplay -D bluealsa:HCI=hci0,DEV=04:52:C7:5A:3B:A1,PROFILE=a2dp /usr/share/sounds/alsa/Front_Center.wav # test it works at all
6)通过创建以下/etc/asound.conf文件来使蓝牙工作而无需指定设备:
pcm.bose {
type plug
slave {
pcm {
type bluealsa
interface hci0
device 04:52:C7:5A:3B:A1
profile "a2dp"
}
}
hint {
show on
description "Bose speaker"
}
}
pcm.!default {
type plug
slave.pcm "bose"
}
ctl.!default {
type hw
card 0
}
出于参考和信誉,此内容基于以下三个来源的信息:
在回复上面@Parthiban的评论时,这是正在运行的系统的dbus-monitor输出:
signal time=1541964336.104905 sender=org.freedesktop.DBus -> destination=:1.1 serial=2 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameAcquired
string ":1.1"
signal time=1541964336.105032 sender=org.freedesktop.DBus -> destination=:1.1 serial=4 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameLost
string ":1.1"
method call time=1541964336.106756 sender=:1.0 -> destination=org.freedesktop.DBus serial=3 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=RequestName
string "org.freedesktop.systemd1"
uint32 7
signal time=1541964336.106880 sender=org.freedesktop.DBus -> destination=(null destination) serial=5 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameOwnerChanged
string "org.freedesktop.systemd1"
string ""
string ":1.0"
signal time=1541964336.107024 sender=org.freedesktop.DBus -> destination=:1.0 serial=4 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameAcquired
string "org.freedesktop.systemd1"
method return time=1541964336.107096 sender=org.freedesktop.DBus -> destination=:1.0 serial=5 reply_serial=3
uint32 1
method call time=1541964336.108116 sender=:1.0 -> destination=org.freedesktop.DBus serial=4 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=ListNames
method return time=1541964336.108179 sender=org.freedesktop.DBus -> destination=:1.0 serial=6 reply_serial=4
array [
string "org.freedesktop.DBus"
string "org.freedesktop.systemd1"
string ":1.0"
]