首页 > 解决方案 > DBUS ofono无法与pulseaudio通信

问题描述

我正在尝试使用 ofono-1.18 和 pulseaudio-12.0 设置 bluez-5.50,以便通过蓝牙处理电话。但是,我在 dbus-monitor 上遇到了以下问题。

error time=1539324786.794398 sender=org.freedesktop.DBus -> destination=:1.28 error_name=org.freedesktop.DBus.Error.AccessDenied reply_serial=23
   string "Rejected send message, 1 matched rules; type="method_return", sender=":1.28" (uid=0 pid=22288 comm="pulseaudio --realtime ") interface="(unset)" member="(unset)" error name="(unset)" requested_reply="0" destination=":1.25" (uid=0 pid=22285 comm="/usr/sbin/ofonod -d -n ")"

我的 /etc/dbus-1/system.conf 如下:

<policy user="root">
    <allow own="org.pulseaudio"/>
    <allow own="org.pulseaudio.Server"/>
    <allow own="org.ofono"/>
    <allow send_destination="org.ofono"/>
    <allow send_interface="org.ofono.SimToolkitAgent"/>
    <allow send_interface="org.ofono.PushNotificationAgent"/>
    <allow send_interface="org.ofono.SmartMessagingAgent"/>
    <allow send_interface="org.ofono.PositioningRequestAgent"/>
    <allow send_interface="org.ofono.HandsfreeAudioAgent"/>
    <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.ThermometerWatcher1"/>
    <allow send_interface="org.bluez.AlertAgent1"/>
    <allow send_interface="org.bluez.Profile1"/>
    <allow send_interface="org.bluez.HeartRateWatcher1"/>
    <allow send_interface="org.bluez.CyclingSpeedWatcher1"/>
    <allow send_interface="org.bluez.GattCharacteristic1"/>
    <allow send_interface="org.bluez.GattDescriptor1"/>
    <allow send_interface="org.freedesktop.DBus.ObjectManager"/>
    <allow send_interface="org.freedesktop.DBus.Properties"/>
  </policy>

据我了解,pulseaudio 和ofono 无法通信,尽管我从ofono 到pulseaudio 得到声音输出。另一个原因可能是 pulseaudio 是用 pulseaudio --start 启动的,但其他守护进程是用 systemd 服务启动的。

过了一会儿,ofon断开了,连蓝牙都断开了。我怀疑这个 dbus 错误可能是造成这种情况的原因。任何指导表示赞赏。

标签: audiobluetoothdbusbluezpulseaudio

解决方案


  1. 确保安装了ofono
sudo apt-get install ofono
  1. 确保pulse创建了用户并且它是bluetooth组的一部分

  2. 授予权限将此添加到/etc/dbus-1/system.d/ofono.conf(内部<busconfig></busconfig>):

<policy user="pulse">
    <allow send_destination="org.ofono"/> 
</policy>

推荐阅读