bluez, pulseaudio, and ofono crashes and problems in iMX8 - Wayland

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I have been trying to develop an application that has media playback, media control, and telephony with i.MX8 QuadMax MEK board. I use Yocto fsl-imx-wayland distro, which uses Wayland desktop with Weston compositor. Moreover, I use bluez-5.41, ofono-1.18, pulseaudio-12.2 and libqofono-0.92. The application runs in Ubuntu pretty smoothly with no apparent problems. The application also runs on i.MX8 Yocto bsp, until some daemons decide to crash. So it's not that my application doesn't work as expected, it is that I'm getting very weird ofono slow-downs, disconnections, crashes as well as pulseaudio errors on iMX8 platform, all occasionally.



I start bluetooth, ofono, and pulseaudio by using the following command:



# Start dbus and export bus address
export $(dbus-launch) && tee /opt/bluetooth.log &
systemctl restart ofono
pulseaudio --realtime 2>&1


The reason I export dbus session address is because pulseaudio complains when --system mode is used. I wish there were a pulseaudio daemon available, but I don't think its daemonized yet.
My dbus configuration in /etc/dbus-1/system.conf is as follows:



<busconfig>
<!-- ../system.conf have denied everything, so we just punch some holes -->

<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>

<policy at_console="true">
<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>

<policy user="pulse">
<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>

<policy group="lp">
<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>
</busconfig>


My pulse configuration in /etc/pulse/default.pa is as follows:



#!/usr/bin/pulseaudio -nF
#
# This file is part of PulseAudio.
#
# PulseAudio is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# PulseAudio is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.

# This startup script is used only if PulseAudio is started per-user
# (i.e. not in system mode)

.fail

### Automatically restore the volume of streams and devices
#load-module module-device-restore
load-module module-stream-restore restore_device=false
load-module module-card-restore

### Automatically augment property information from .desktop files
### stored in /usr/share/application
load-module module-augment-properties

### Should be after module-*-restore but before module-*-detect
#load-module module-switch-on-port-available


### Load audio drivers statically
### (it's probably better to not load these drivers manually, but instead
### use module-udev-detect -- see below -- for doing this automatically)
#load-module module-alsa-sink device=hw:1,0
#load-module module-alsa-source
#load-module module-oss device="/dev/dsp" sink_name=output source_name=input
#load-module module-oss-mmap device="/dev/dsp" sink_name=output source_name=input
#load-module module-null-sink
#load-module module-pipe-sink

### Automatically load driver modules depending on the hardware available
.ifexists module-udev-detect.so
load-module module-udev-detect
.else
### Use the static hardware detection module (for systems that lack udev support)
load-module module-detect
.endif

### Automatically connect sink and source if JACK server is present
.ifexists module-jackdbus-detect.so
.nofail
load-module module-jackdbus-detect channels=2
.fail
.endif

### Automatically load driver modules for Bluetooth hardware
.ifexists module-bluetooth-policy.so
load-module module-bluetooth-policy ag=true
# auto_switch=2
.endif

.ifexists module-bluetooth-discover.so
load-module module-bluetooth-discover headset=auto
# headset=ofono
.endif

### Load several protocols
.ifexists module-esound-protocol-unix.so
load-module module-esound-protocol-unix
.endif
load-module module-native-protocol-unix auth-anonymous=1

### Network access (may be configured with paprefs, so leave this commented
### here if you plan to use paprefs)
#load-module module-esound-protocol-tcp
#load-module module-native-protocol-tcp
#load-module module-zeroconf-publish

### Load the RTP receiver module (also configured via paprefs, see above)
#load-module module-rtp-recv

### Load the RTP sender module (also configured via paprefs, see above)
#load-module module-null-sink sink_name=rtp format=s16be channels=2 rate=44100 sink_properties="device.description='RTP Multicast Sink'"
#load-module module-rtp-send source=rtp.monitor


### Load additional modules from GConf settings. This can be configured with the paprefs tool.
### Please keep in mind that the modules configured by paprefs might conflict with manually
### loaded modules.
#.ifexists module-gconf.so
#.nofail
#load-module module-gconf
#.fail
#.endif

### Automatically restore the default sink/source when changed by the user
### during runtime
### NOTE: This should be loaded as early as possible so that subsequent modules
### that look up the default sink/source get the right value
load-module module-default-device-restore

### Automatically move streams to the default sink if the sink they are
### connected to dies, similar for sources
load-module module-rescue-streams

### Make sure we always have a sink around, even if it is a null sink.
load-module module-always-sink

### Honour intended role device property
load-module module-intended-roles

### Automatically suspend sinks/sources that become idle for too long
load-module module-suspend-on-idle

### If autoexit on idle is enabled we want to make sure we only quit
### when no local session needs us anymore.
.ifexists module-console-kit.so
load-module module-console-kit
.endif
.ifexists module-systemd-login.so
load-module module-systemd-login
.endif

### Enable positioned event sounds
load-module module-position-event-sounds

### Cork music/video streams when a phone stream is active
load-module module-role-cork

### Modules to allow autoloading of filters (such as echo cancellation)
### on demand. module-filter-heuristics tries to determine what filters
### make sense, and module-filter-apply does the heavy-lifting of
### loading modules and rerouting streams.
load-module module-filter-heuristics
load-module module-filter-apply

### Make some devices default
# Make HDMI default #Check with pactl list short sinks
set-default-sink alsa_output.platform-sound-hdmi.stereo-fallback
#set-default-source input


I only commented the following,



#load-module module-switch-on-connect
#load-module module-switch-on-port-available


and added



load-module module-bluetooth-policy ag=true
load-module module-bluetooth-discover headset=auto


Unfortunately, with the commented-out modules, when I get a call and call ends, a2dp sink changes to a device that I don't want. So set-default-sink do not work. So commenting these out works for me. Maybe it triggers something bigger. I'd like to get your opinion.



I have the following in my ~/.asoundrc ALSA configuration. This might not be the best way to define asoundrc, since I also use pulseaudio. I'd also use your opinions here.



# Making the HDMI device default
pcm.!default
type hw
card 2
device 0



I have the following cards:



**** List of PLAYBACK Hardware Devices ****
card 0: cs42888audio [cs42888-audio], device 0: HiFi cs42888-0
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: wm8960audio [wm8960-audio], device 0: HiFi wm8960-hifi-0
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: wm8960audio [wm8960-audio], device 1: HiFi-ASRC-FE (*)
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: imxaudiohdmi [imx-audio-hdmi], device 0: imx8 hdmi snd-soc-dummy-dai-0
Subdevices: 1/1
Subdevice #0: subdevice #0


Last but not least, I use CSR v4.0 bluetooth module (china made), I also suspect maybe disconnection problems have something to do with the module.



Now, coming to the problems I'm having..



Almost everytime I launch pulseaudio with pulseaudio --realtime, I get the following messages:



W: [pulseaudio] module-loopback.c: Configured latency of 200.00 ms is smaller than minimum latency, using minimum instead
W: [pulseaudio] module-loopback.c: Cannot set requested sink latency of 68.25 ms, adjusting to 100.00 ms
W: [pulseaudio] module-loopback.c: Cannot set requested source latency of 143.25 ms, adjusting to 250.00 ms


I also get the following occasionaly when connection switches from HFP to A2DP or vice versa:



alsa-util.c: Got POLLNVAL from ALSA
alsa-util.c: Got POLLNVAL from ALSA


When I launch my application (which basically only uses dbus in order to communicate with bluez & ofono), the application runs for a while. With the perfect luck, I get around 5 minutes of smooth media transmission, phone rings and I'm able to talk to the person, then phone hangs up and everything continues as expected. What I'm saying is it is not really deterministic when the errors or problems occur. That's making the solution very difficult to find, and problem very difficult to reproduce. It's just the courtesy of bluez, pulseaudio and ofono. Sometimes, it happens when I have a 4minute+ call on the phone and hang up, the a2dp does not come back live and I get the following constantly in bluez log:



bluetoothd[10544]: ../bluez-5.41/profiles/audio/avdtp.c:avdtp_parse_cmd() Received START_CMD
bluetoothd[10544]: ../bluez-5.41/profiles/audio/avdtp.c:avdtp_start_cmd() Rejecting (49)
bluetoothd[10544]: ../bluez-5.41/profiles/audio/avdtp.c:session_cb()


Sometimes when I send hang up command through DBUS, for example, I get the following in dbus-monitor --system. It says org.freedesktop.DBus.Error.AccessDenied, but I think this error might stem from the fact that ofono had already crashed and now I'm unable to send commands:



method return time=1539068262.046519 sender=:1.26 -> destination=:1.23 serial=21 reply_serial=114
error time=1539068262.046600 sender=org.freedesktop.DBus -> destination=:1.26 error_name=org.freedesktop.DBus.Error.AccessDenied reply_serial=21
string "Rejected send message, 1 matched rules; type="method_return", sender=":1.26" (uid=0 pid=30830 comm="pulseaudio --realtime ") interface="(unset)" member="(unset)" error name="(unset)" requested_reply="0" destination=":1.23" (uid=0 pid=30827 comm="/usr/sbin/ofonod -d -n ")"


Similarly, when ofono Aborts with absolutely no error log whatsoever, I get something like the following in libqofono:



Hangup failed: QDBusError("org.freedesktop.DBus.Error.NoReply", "Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.")


Oh, and also, when I want to pause the HFP connection by simply hitting bluetooth switch while I'm in a call, and get it back on, I get the following and then audio is lost:



E: [bluetooth] module-bluez5-device.c: Failed to read data from SCO socket: Connection reset by peer
E: [pulseaudio] backend-ofono.c: Deferred setup failed on fd -1: Transport endpoint is not connected
W: [pulseaudio] backend-ofono.c: New audio connection invalid arguments (path=/card_1 fd=31, codec=1)


In the meantime, ofono gives no error that I can see:



...
ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8cde110 property DevicePath
ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8d7f7d0 property DevicePath
ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8cdfb20 property DevicePath
ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8d32130 property DevicePath
ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8d2fdd0 property DevicePath
ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8cde110 property DevicePath
ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8d7f7d0 property DevicePath
ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8cdfb20 property DevicePath
ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8d32130 property DevicePath
ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8d2fdd0 property DevicePath
ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8cde110 property DevicePath
ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8d7f7d0 property DevicePath
ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8cdfb20 property DevicePath
ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
ofonod[8891]: ../ofono-1.18/drivers/hfpmodem/voicecall.c:clip_notify() clip_notify: +xxxxxxxxx 145 0
ofonod[8891]: ../ofono-1.18/src/voicecall.c:ofono_voicecall_notify() Got a voicecall event, status: 4, id: 1, number: +xxxxxxxxxx called_number: , called_name
ofonod[8891]: ../ofono-1.18/src/voicecall.c:ofono_voicecall_notify() Did not find a call with id: 1
ofonod[8891]: ../ofono-1.18/src/voicecall.c:ofono_voicecall_notify() Got a voicecall event, status: 0, id: 1, number: +xxxxxxxxxx called_number: , called_name
ofonod[8891]: ../ofono-1.18/src/voicecall.c:ofono_voicecall_notify() Found call with id: 1
ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
ofonod[8891]: ../ofono-1.18/src/voicecall.c:ofono_voicecall_disconnected() Got disconnection event for id: 1, reason: 2
ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:agent_disconnect() Agent :1.16 disconnected
ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:am_agent_register() Agent :1.22 registered with the CODECs: CVSD
ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:am_agent_register() Wideband speech disabled: no mSBC support
ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1


All in all, I am really stuck trying to make bluez, ofono, and pulseaudio work at the same time. I really would appreciate a couple of pointers as to what might be the core cause of these problems.



Is it my pulseaudio & alsa configuration being not correct? Is it the dbus permissions? Is it the CSRv4.0 bluetooth dongle? or is it faulty drivers in a pre-release board (i.MX8 QuadMax MEK)? Is it the bluez, ofono, or pulseaudio versions that I'm using being buggy? Or is it the fact that pulseaudio not being fully supported in wayland?










share|improve this question



























    up vote
    0
    down vote

    favorite












    I have been trying to develop an application that has media playback, media control, and telephony with i.MX8 QuadMax MEK board. I use Yocto fsl-imx-wayland distro, which uses Wayland desktop with Weston compositor. Moreover, I use bluez-5.41, ofono-1.18, pulseaudio-12.2 and libqofono-0.92. The application runs in Ubuntu pretty smoothly with no apparent problems. The application also runs on i.MX8 Yocto bsp, until some daemons decide to crash. So it's not that my application doesn't work as expected, it is that I'm getting very weird ofono slow-downs, disconnections, crashes as well as pulseaudio errors on iMX8 platform, all occasionally.



    I start bluetooth, ofono, and pulseaudio by using the following command:



    # Start dbus and export bus address
    export $(dbus-launch) && tee /opt/bluetooth.log &
    systemctl restart ofono
    pulseaudio --realtime 2>&1


    The reason I export dbus session address is because pulseaudio complains when --system mode is used. I wish there were a pulseaudio daemon available, but I don't think its daemonized yet.
    My dbus configuration in /etc/dbus-1/system.conf is as follows:



    <busconfig>
    <!-- ../system.conf have denied everything, so we just punch some holes -->

    <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>

    <policy at_console="true">
    <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>

    <policy user="pulse">
    <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>

    <policy group="lp">
    <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>
    </busconfig>


    My pulse configuration in /etc/pulse/default.pa is as follows:



    #!/usr/bin/pulseaudio -nF
    #
    # This file is part of PulseAudio.
    #
    # PulseAudio is free software; you can redistribute it and/or modify it
    # under the terms of the GNU Lesser General Public License as published by
    # the Free Software Foundation; either version 2 of the License, or
    # (at your option) any later version.
    #
    # PulseAudio is distributed in the hope that it will be useful, but
    # WITHOUT ANY WARRANTY; without even the implied warranty of
    # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    # General Public License for more details.
    #
    # You should have received a copy of the GNU Lesser General Public License
    # along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.

    # This startup script is used only if PulseAudio is started per-user
    # (i.e. not in system mode)

    .fail

    ### Automatically restore the volume of streams and devices
    #load-module module-device-restore
    load-module module-stream-restore restore_device=false
    load-module module-card-restore

    ### Automatically augment property information from .desktop files
    ### stored in /usr/share/application
    load-module module-augment-properties

    ### Should be after module-*-restore but before module-*-detect
    #load-module module-switch-on-port-available


    ### Load audio drivers statically
    ### (it's probably better to not load these drivers manually, but instead
    ### use module-udev-detect -- see below -- for doing this automatically)
    #load-module module-alsa-sink device=hw:1,0
    #load-module module-alsa-source
    #load-module module-oss device="/dev/dsp" sink_name=output source_name=input
    #load-module module-oss-mmap device="/dev/dsp" sink_name=output source_name=input
    #load-module module-null-sink
    #load-module module-pipe-sink

    ### Automatically load driver modules depending on the hardware available
    .ifexists module-udev-detect.so
    load-module module-udev-detect
    .else
    ### Use the static hardware detection module (for systems that lack udev support)
    load-module module-detect
    .endif

    ### Automatically connect sink and source if JACK server is present
    .ifexists module-jackdbus-detect.so
    .nofail
    load-module module-jackdbus-detect channels=2
    .fail
    .endif

    ### Automatically load driver modules for Bluetooth hardware
    .ifexists module-bluetooth-policy.so
    load-module module-bluetooth-policy ag=true
    # auto_switch=2
    .endif

    .ifexists module-bluetooth-discover.so
    load-module module-bluetooth-discover headset=auto
    # headset=ofono
    .endif

    ### Load several protocols
    .ifexists module-esound-protocol-unix.so
    load-module module-esound-protocol-unix
    .endif
    load-module module-native-protocol-unix auth-anonymous=1

    ### Network access (may be configured with paprefs, so leave this commented
    ### here if you plan to use paprefs)
    #load-module module-esound-protocol-tcp
    #load-module module-native-protocol-tcp
    #load-module module-zeroconf-publish

    ### Load the RTP receiver module (also configured via paprefs, see above)
    #load-module module-rtp-recv

    ### Load the RTP sender module (also configured via paprefs, see above)
    #load-module module-null-sink sink_name=rtp format=s16be channels=2 rate=44100 sink_properties="device.description='RTP Multicast Sink'"
    #load-module module-rtp-send source=rtp.monitor


    ### Load additional modules from GConf settings. This can be configured with the paprefs tool.
    ### Please keep in mind that the modules configured by paprefs might conflict with manually
    ### loaded modules.
    #.ifexists module-gconf.so
    #.nofail
    #load-module module-gconf
    #.fail
    #.endif

    ### Automatically restore the default sink/source when changed by the user
    ### during runtime
    ### NOTE: This should be loaded as early as possible so that subsequent modules
    ### that look up the default sink/source get the right value
    load-module module-default-device-restore

    ### Automatically move streams to the default sink if the sink they are
    ### connected to dies, similar for sources
    load-module module-rescue-streams

    ### Make sure we always have a sink around, even if it is a null sink.
    load-module module-always-sink

    ### Honour intended role device property
    load-module module-intended-roles

    ### Automatically suspend sinks/sources that become idle for too long
    load-module module-suspend-on-idle

    ### If autoexit on idle is enabled we want to make sure we only quit
    ### when no local session needs us anymore.
    .ifexists module-console-kit.so
    load-module module-console-kit
    .endif
    .ifexists module-systemd-login.so
    load-module module-systemd-login
    .endif

    ### Enable positioned event sounds
    load-module module-position-event-sounds

    ### Cork music/video streams when a phone stream is active
    load-module module-role-cork

    ### Modules to allow autoloading of filters (such as echo cancellation)
    ### on demand. module-filter-heuristics tries to determine what filters
    ### make sense, and module-filter-apply does the heavy-lifting of
    ### loading modules and rerouting streams.
    load-module module-filter-heuristics
    load-module module-filter-apply

    ### Make some devices default
    # Make HDMI default #Check with pactl list short sinks
    set-default-sink alsa_output.platform-sound-hdmi.stereo-fallback
    #set-default-source input


    I only commented the following,



    #load-module module-switch-on-connect
    #load-module module-switch-on-port-available


    and added



    load-module module-bluetooth-policy ag=true
    load-module module-bluetooth-discover headset=auto


    Unfortunately, with the commented-out modules, when I get a call and call ends, a2dp sink changes to a device that I don't want. So set-default-sink do not work. So commenting these out works for me. Maybe it triggers something bigger. I'd like to get your opinion.



    I have the following in my ~/.asoundrc ALSA configuration. This might not be the best way to define asoundrc, since I also use pulseaudio. I'd also use your opinions here.



    # Making the HDMI device default
    pcm.!default
    type hw
    card 2
    device 0



    I have the following cards:



    **** List of PLAYBACK Hardware Devices ****
    card 0: cs42888audio [cs42888-audio], device 0: HiFi cs42888-0
    Subdevices: 1/1
    Subdevice #0: subdevice #0
    card 1: wm8960audio [wm8960-audio], device 0: HiFi wm8960-hifi-0
    Subdevices: 1/1
    Subdevice #0: subdevice #0
    card 1: wm8960audio [wm8960-audio], device 1: HiFi-ASRC-FE (*)
    Subdevices: 1/1
    Subdevice #0: subdevice #0
    card 2: imxaudiohdmi [imx-audio-hdmi], device 0: imx8 hdmi snd-soc-dummy-dai-0
    Subdevices: 1/1
    Subdevice #0: subdevice #0


    Last but not least, I use CSR v4.0 bluetooth module (china made), I also suspect maybe disconnection problems have something to do with the module.



    Now, coming to the problems I'm having..



    Almost everytime I launch pulseaudio with pulseaudio --realtime, I get the following messages:



    W: [pulseaudio] module-loopback.c: Configured latency of 200.00 ms is smaller than minimum latency, using minimum instead
    W: [pulseaudio] module-loopback.c: Cannot set requested sink latency of 68.25 ms, adjusting to 100.00 ms
    W: [pulseaudio] module-loopback.c: Cannot set requested source latency of 143.25 ms, adjusting to 250.00 ms


    I also get the following occasionaly when connection switches from HFP to A2DP or vice versa:



    alsa-util.c: Got POLLNVAL from ALSA
    alsa-util.c: Got POLLNVAL from ALSA


    When I launch my application (which basically only uses dbus in order to communicate with bluez & ofono), the application runs for a while. With the perfect luck, I get around 5 minutes of smooth media transmission, phone rings and I'm able to talk to the person, then phone hangs up and everything continues as expected. What I'm saying is it is not really deterministic when the errors or problems occur. That's making the solution very difficult to find, and problem very difficult to reproduce. It's just the courtesy of bluez, pulseaudio and ofono. Sometimes, it happens when I have a 4minute+ call on the phone and hang up, the a2dp does not come back live and I get the following constantly in bluez log:



    bluetoothd[10544]: ../bluez-5.41/profiles/audio/avdtp.c:avdtp_parse_cmd() Received START_CMD
    bluetoothd[10544]: ../bluez-5.41/profiles/audio/avdtp.c:avdtp_start_cmd() Rejecting (49)
    bluetoothd[10544]: ../bluez-5.41/profiles/audio/avdtp.c:session_cb()


    Sometimes when I send hang up command through DBUS, for example, I get the following in dbus-monitor --system. It says org.freedesktop.DBus.Error.AccessDenied, but I think this error might stem from the fact that ofono had already crashed and now I'm unable to send commands:



    method return time=1539068262.046519 sender=:1.26 -> destination=:1.23 serial=21 reply_serial=114
    error time=1539068262.046600 sender=org.freedesktop.DBus -> destination=:1.26 error_name=org.freedesktop.DBus.Error.AccessDenied reply_serial=21
    string "Rejected send message, 1 matched rules; type="method_return", sender=":1.26" (uid=0 pid=30830 comm="pulseaudio --realtime ") interface="(unset)" member="(unset)" error name="(unset)" requested_reply="0" destination=":1.23" (uid=0 pid=30827 comm="/usr/sbin/ofonod -d -n ")"


    Similarly, when ofono Aborts with absolutely no error log whatsoever, I get something like the following in libqofono:



    Hangup failed: QDBusError("org.freedesktop.DBus.Error.NoReply", "Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.")


    Oh, and also, when I want to pause the HFP connection by simply hitting bluetooth switch while I'm in a call, and get it back on, I get the following and then audio is lost:



    E: [bluetooth] module-bluez5-device.c: Failed to read data from SCO socket: Connection reset by peer
    E: [pulseaudio] backend-ofono.c: Deferred setup failed on fd -1: Transport endpoint is not connected
    W: [pulseaudio] backend-ofono.c: New audio connection invalid arguments (path=/card_1 fd=31, codec=1)


    In the meantime, ofono gives no error that I can see:



    ...
    ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8cde110 property DevicePath
    ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8d7f7d0 property DevicePath
    ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8cdfb20 property DevicePath
    ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8d32130 property DevicePath
    ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8d2fdd0 property DevicePath
    ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8cde110 property DevicePath
    ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8d7f7d0 property DevicePath
    ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8cdfb20 property DevicePath
    ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8d32130 property DevicePath
    ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8d2fdd0 property DevicePath
    ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8cde110 property DevicePath
    ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8d7f7d0 property DevicePath
    ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8cdfb20 property DevicePath
    ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
    ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
    ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
    ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
    ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
    ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
    ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
    ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
    ofonod[8891]: ../ofono-1.18/drivers/hfpmodem/voicecall.c:clip_notify() clip_notify: +xxxxxxxxx 145 0
    ofonod[8891]: ../ofono-1.18/src/voicecall.c:ofono_voicecall_notify() Got a voicecall event, status: 4, id: 1, number: +xxxxxxxxxx called_number: , called_name
    ofonod[8891]: ../ofono-1.18/src/voicecall.c:ofono_voicecall_notify() Did not find a call with id: 1
    ofonod[8891]: ../ofono-1.18/src/voicecall.c:ofono_voicecall_notify() Got a voicecall event, status: 0, id: 1, number: +xxxxxxxxxx called_number: , called_name
    ofonod[8891]: ../ofono-1.18/src/voicecall.c:ofono_voicecall_notify() Found call with id: 1
    ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
    ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
    ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
    ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
    ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
    ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
    ofonod[8891]: ../ofono-1.18/src/voicecall.c:ofono_voicecall_disconnected() Got disconnection event for id: 1, reason: 2
    ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
    ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
    ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
    ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
    ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
    ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
    ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
    ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
    ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
    ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
    ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
    ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
    ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
    ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
    ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:agent_disconnect() Agent :1.16 disconnected
    ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:am_agent_register() Agent :1.22 registered with the CODECs: CVSD
    ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:am_agent_register() Wideband speech disabled: no mSBC support
    ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
    ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1


    All in all, I am really stuck trying to make bluez, ofono, and pulseaudio work at the same time. I really would appreciate a couple of pointers as to what might be the core cause of these problems.



    Is it my pulseaudio & alsa configuration being not correct? Is it the dbus permissions? Is it the CSRv4.0 bluetooth dongle? or is it faulty drivers in a pre-release board (i.MX8 QuadMax MEK)? Is it the bluez, ofono, or pulseaudio versions that I'm using being buggy? Or is it the fact that pulseaudio not being fully supported in wayland?










    share|improve this question

























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I have been trying to develop an application that has media playback, media control, and telephony with i.MX8 QuadMax MEK board. I use Yocto fsl-imx-wayland distro, which uses Wayland desktop with Weston compositor. Moreover, I use bluez-5.41, ofono-1.18, pulseaudio-12.2 and libqofono-0.92. The application runs in Ubuntu pretty smoothly with no apparent problems. The application also runs on i.MX8 Yocto bsp, until some daemons decide to crash. So it's not that my application doesn't work as expected, it is that I'm getting very weird ofono slow-downs, disconnections, crashes as well as pulseaudio errors on iMX8 platform, all occasionally.



      I start bluetooth, ofono, and pulseaudio by using the following command:



      # Start dbus and export bus address
      export $(dbus-launch) && tee /opt/bluetooth.log &
      systemctl restart ofono
      pulseaudio --realtime 2>&1


      The reason I export dbus session address is because pulseaudio complains when --system mode is used. I wish there were a pulseaudio daemon available, but I don't think its daemonized yet.
      My dbus configuration in /etc/dbus-1/system.conf is as follows:



      <busconfig>
      <!-- ../system.conf have denied everything, so we just punch some holes -->

      <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>

      <policy at_console="true">
      <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>

      <policy user="pulse">
      <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>

      <policy group="lp">
      <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>
      </busconfig>


      My pulse configuration in /etc/pulse/default.pa is as follows:



      #!/usr/bin/pulseaudio -nF
      #
      # This file is part of PulseAudio.
      #
      # PulseAudio is free software; you can redistribute it and/or modify it
      # under the terms of the GNU Lesser General Public License as published by
      # the Free Software Foundation; either version 2 of the License, or
      # (at your option) any later version.
      #
      # PulseAudio is distributed in the hope that it will be useful, but
      # WITHOUT ANY WARRANTY; without even the implied warranty of
      # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
      # General Public License for more details.
      #
      # You should have received a copy of the GNU Lesser General Public License
      # along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.

      # This startup script is used only if PulseAudio is started per-user
      # (i.e. not in system mode)

      .fail

      ### Automatically restore the volume of streams and devices
      #load-module module-device-restore
      load-module module-stream-restore restore_device=false
      load-module module-card-restore

      ### Automatically augment property information from .desktop files
      ### stored in /usr/share/application
      load-module module-augment-properties

      ### Should be after module-*-restore but before module-*-detect
      #load-module module-switch-on-port-available


      ### Load audio drivers statically
      ### (it's probably better to not load these drivers manually, but instead
      ### use module-udev-detect -- see below -- for doing this automatically)
      #load-module module-alsa-sink device=hw:1,0
      #load-module module-alsa-source
      #load-module module-oss device="/dev/dsp" sink_name=output source_name=input
      #load-module module-oss-mmap device="/dev/dsp" sink_name=output source_name=input
      #load-module module-null-sink
      #load-module module-pipe-sink

      ### Automatically load driver modules depending on the hardware available
      .ifexists module-udev-detect.so
      load-module module-udev-detect
      .else
      ### Use the static hardware detection module (for systems that lack udev support)
      load-module module-detect
      .endif

      ### Automatically connect sink and source if JACK server is present
      .ifexists module-jackdbus-detect.so
      .nofail
      load-module module-jackdbus-detect channels=2
      .fail
      .endif

      ### Automatically load driver modules for Bluetooth hardware
      .ifexists module-bluetooth-policy.so
      load-module module-bluetooth-policy ag=true
      # auto_switch=2
      .endif

      .ifexists module-bluetooth-discover.so
      load-module module-bluetooth-discover headset=auto
      # headset=ofono
      .endif

      ### Load several protocols
      .ifexists module-esound-protocol-unix.so
      load-module module-esound-protocol-unix
      .endif
      load-module module-native-protocol-unix auth-anonymous=1

      ### Network access (may be configured with paprefs, so leave this commented
      ### here if you plan to use paprefs)
      #load-module module-esound-protocol-tcp
      #load-module module-native-protocol-tcp
      #load-module module-zeroconf-publish

      ### Load the RTP receiver module (also configured via paprefs, see above)
      #load-module module-rtp-recv

      ### Load the RTP sender module (also configured via paprefs, see above)
      #load-module module-null-sink sink_name=rtp format=s16be channels=2 rate=44100 sink_properties="device.description='RTP Multicast Sink'"
      #load-module module-rtp-send source=rtp.monitor


      ### Load additional modules from GConf settings. This can be configured with the paprefs tool.
      ### Please keep in mind that the modules configured by paprefs might conflict with manually
      ### loaded modules.
      #.ifexists module-gconf.so
      #.nofail
      #load-module module-gconf
      #.fail
      #.endif

      ### Automatically restore the default sink/source when changed by the user
      ### during runtime
      ### NOTE: This should be loaded as early as possible so that subsequent modules
      ### that look up the default sink/source get the right value
      load-module module-default-device-restore

      ### Automatically move streams to the default sink if the sink they are
      ### connected to dies, similar for sources
      load-module module-rescue-streams

      ### Make sure we always have a sink around, even if it is a null sink.
      load-module module-always-sink

      ### Honour intended role device property
      load-module module-intended-roles

      ### Automatically suspend sinks/sources that become idle for too long
      load-module module-suspend-on-idle

      ### If autoexit on idle is enabled we want to make sure we only quit
      ### when no local session needs us anymore.
      .ifexists module-console-kit.so
      load-module module-console-kit
      .endif
      .ifexists module-systemd-login.so
      load-module module-systemd-login
      .endif

      ### Enable positioned event sounds
      load-module module-position-event-sounds

      ### Cork music/video streams when a phone stream is active
      load-module module-role-cork

      ### Modules to allow autoloading of filters (such as echo cancellation)
      ### on demand. module-filter-heuristics tries to determine what filters
      ### make sense, and module-filter-apply does the heavy-lifting of
      ### loading modules and rerouting streams.
      load-module module-filter-heuristics
      load-module module-filter-apply

      ### Make some devices default
      # Make HDMI default #Check with pactl list short sinks
      set-default-sink alsa_output.platform-sound-hdmi.stereo-fallback
      #set-default-source input


      I only commented the following,



      #load-module module-switch-on-connect
      #load-module module-switch-on-port-available


      and added



      load-module module-bluetooth-policy ag=true
      load-module module-bluetooth-discover headset=auto


      Unfortunately, with the commented-out modules, when I get a call and call ends, a2dp sink changes to a device that I don't want. So set-default-sink do not work. So commenting these out works for me. Maybe it triggers something bigger. I'd like to get your opinion.



      I have the following in my ~/.asoundrc ALSA configuration. This might not be the best way to define asoundrc, since I also use pulseaudio. I'd also use your opinions here.



      # Making the HDMI device default
      pcm.!default
      type hw
      card 2
      device 0



      I have the following cards:



      **** List of PLAYBACK Hardware Devices ****
      card 0: cs42888audio [cs42888-audio], device 0: HiFi cs42888-0
      Subdevices: 1/1
      Subdevice #0: subdevice #0
      card 1: wm8960audio [wm8960-audio], device 0: HiFi wm8960-hifi-0
      Subdevices: 1/1
      Subdevice #0: subdevice #0
      card 1: wm8960audio [wm8960-audio], device 1: HiFi-ASRC-FE (*)
      Subdevices: 1/1
      Subdevice #0: subdevice #0
      card 2: imxaudiohdmi [imx-audio-hdmi], device 0: imx8 hdmi snd-soc-dummy-dai-0
      Subdevices: 1/1
      Subdevice #0: subdevice #0


      Last but not least, I use CSR v4.0 bluetooth module (china made), I also suspect maybe disconnection problems have something to do with the module.



      Now, coming to the problems I'm having..



      Almost everytime I launch pulseaudio with pulseaudio --realtime, I get the following messages:



      W: [pulseaudio] module-loopback.c: Configured latency of 200.00 ms is smaller than minimum latency, using minimum instead
      W: [pulseaudio] module-loopback.c: Cannot set requested sink latency of 68.25 ms, adjusting to 100.00 ms
      W: [pulseaudio] module-loopback.c: Cannot set requested source latency of 143.25 ms, adjusting to 250.00 ms


      I also get the following occasionaly when connection switches from HFP to A2DP or vice versa:



      alsa-util.c: Got POLLNVAL from ALSA
      alsa-util.c: Got POLLNVAL from ALSA


      When I launch my application (which basically only uses dbus in order to communicate with bluez & ofono), the application runs for a while. With the perfect luck, I get around 5 minutes of smooth media transmission, phone rings and I'm able to talk to the person, then phone hangs up and everything continues as expected. What I'm saying is it is not really deterministic when the errors or problems occur. That's making the solution very difficult to find, and problem very difficult to reproduce. It's just the courtesy of bluez, pulseaudio and ofono. Sometimes, it happens when I have a 4minute+ call on the phone and hang up, the a2dp does not come back live and I get the following constantly in bluez log:



      bluetoothd[10544]: ../bluez-5.41/profiles/audio/avdtp.c:avdtp_parse_cmd() Received START_CMD
      bluetoothd[10544]: ../bluez-5.41/profiles/audio/avdtp.c:avdtp_start_cmd() Rejecting (49)
      bluetoothd[10544]: ../bluez-5.41/profiles/audio/avdtp.c:session_cb()


      Sometimes when I send hang up command through DBUS, for example, I get the following in dbus-monitor --system. It says org.freedesktop.DBus.Error.AccessDenied, but I think this error might stem from the fact that ofono had already crashed and now I'm unable to send commands:



      method return time=1539068262.046519 sender=:1.26 -> destination=:1.23 serial=21 reply_serial=114
      error time=1539068262.046600 sender=org.freedesktop.DBus -> destination=:1.26 error_name=org.freedesktop.DBus.Error.AccessDenied reply_serial=21
      string "Rejected send message, 1 matched rules; type="method_return", sender=":1.26" (uid=0 pid=30830 comm="pulseaudio --realtime ") interface="(unset)" member="(unset)" error name="(unset)" requested_reply="0" destination=":1.23" (uid=0 pid=30827 comm="/usr/sbin/ofonod -d -n ")"


      Similarly, when ofono Aborts with absolutely no error log whatsoever, I get something like the following in libqofono:



      Hangup failed: QDBusError("org.freedesktop.DBus.Error.NoReply", "Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.")


      Oh, and also, when I want to pause the HFP connection by simply hitting bluetooth switch while I'm in a call, and get it back on, I get the following and then audio is lost:



      E: [bluetooth] module-bluez5-device.c: Failed to read data from SCO socket: Connection reset by peer
      E: [pulseaudio] backend-ofono.c: Deferred setup failed on fd -1: Transport endpoint is not connected
      W: [pulseaudio] backend-ofono.c: New audio connection invalid arguments (path=/card_1 fd=31, codec=1)


      In the meantime, ofono gives no error that I can see:



      ...
      ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8cde110 property DevicePath
      ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8d7f7d0 property DevicePath
      ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8cdfb20 property DevicePath
      ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8d32130 property DevicePath
      ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8d2fdd0 property DevicePath
      ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8cde110 property DevicePath
      ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8d7f7d0 property DevicePath
      ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8cdfb20 property DevicePath
      ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8d32130 property DevicePath
      ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8d2fdd0 property DevicePath
      ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8cde110 property DevicePath
      ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8d7f7d0 property DevicePath
      ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8cdfb20 property DevicePath
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
      ofonod[8891]: ../ofono-1.18/drivers/hfpmodem/voicecall.c:clip_notify() clip_notify: +xxxxxxxxx 145 0
      ofonod[8891]: ../ofono-1.18/src/voicecall.c:ofono_voicecall_notify() Got a voicecall event, status: 4, id: 1, number: +xxxxxxxxxx called_number: , called_name
      ofonod[8891]: ../ofono-1.18/src/voicecall.c:ofono_voicecall_notify() Did not find a call with id: 1
      ofonod[8891]: ../ofono-1.18/src/voicecall.c:ofono_voicecall_notify() Got a voicecall event, status: 0, id: 1, number: +xxxxxxxxxx called_number: , called_name
      ofonod[8891]: ../ofono-1.18/src/voicecall.c:ofono_voicecall_notify() Found call with id: 1
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
      ofonod[8891]: ../ofono-1.18/src/voicecall.c:ofono_voicecall_disconnected() Got disconnection event for id: 1, reason: 2
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:agent_disconnect() Agent :1.16 disconnected
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:am_agent_register() Agent :1.22 registered with the CODECs: CVSD
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:am_agent_register() Wideband speech disabled: no mSBC support
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1


      All in all, I am really stuck trying to make bluez, ofono, and pulseaudio work at the same time. I really would appreciate a couple of pointers as to what might be the core cause of these problems.



      Is it my pulseaudio & alsa configuration being not correct? Is it the dbus permissions? Is it the CSRv4.0 bluetooth dongle? or is it faulty drivers in a pre-release board (i.MX8 QuadMax MEK)? Is it the bluez, ofono, or pulseaudio versions that I'm using being buggy? Or is it the fact that pulseaudio not being fully supported in wayland?










      share|improve this question















      I have been trying to develop an application that has media playback, media control, and telephony with i.MX8 QuadMax MEK board. I use Yocto fsl-imx-wayland distro, which uses Wayland desktop with Weston compositor. Moreover, I use bluez-5.41, ofono-1.18, pulseaudio-12.2 and libqofono-0.92. The application runs in Ubuntu pretty smoothly with no apparent problems. The application also runs on i.MX8 Yocto bsp, until some daemons decide to crash. So it's not that my application doesn't work as expected, it is that I'm getting very weird ofono slow-downs, disconnections, crashes as well as pulseaudio errors on iMX8 platform, all occasionally.



      I start bluetooth, ofono, and pulseaudio by using the following command:



      # Start dbus and export bus address
      export $(dbus-launch) && tee /opt/bluetooth.log &
      systemctl restart ofono
      pulseaudio --realtime 2>&1


      The reason I export dbus session address is because pulseaudio complains when --system mode is used. I wish there were a pulseaudio daemon available, but I don't think its daemonized yet.
      My dbus configuration in /etc/dbus-1/system.conf is as follows:



      <busconfig>
      <!-- ../system.conf have denied everything, so we just punch some holes -->

      <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>

      <policy at_console="true">
      <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>

      <policy user="pulse">
      <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>

      <policy group="lp">
      <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>
      </busconfig>


      My pulse configuration in /etc/pulse/default.pa is as follows:



      #!/usr/bin/pulseaudio -nF
      #
      # This file is part of PulseAudio.
      #
      # PulseAudio is free software; you can redistribute it and/or modify it
      # under the terms of the GNU Lesser General Public License as published by
      # the Free Software Foundation; either version 2 of the License, or
      # (at your option) any later version.
      #
      # PulseAudio is distributed in the hope that it will be useful, but
      # WITHOUT ANY WARRANTY; without even the implied warranty of
      # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
      # General Public License for more details.
      #
      # You should have received a copy of the GNU Lesser General Public License
      # along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.

      # This startup script is used only if PulseAudio is started per-user
      # (i.e. not in system mode)

      .fail

      ### Automatically restore the volume of streams and devices
      #load-module module-device-restore
      load-module module-stream-restore restore_device=false
      load-module module-card-restore

      ### Automatically augment property information from .desktop files
      ### stored in /usr/share/application
      load-module module-augment-properties

      ### Should be after module-*-restore but before module-*-detect
      #load-module module-switch-on-port-available


      ### Load audio drivers statically
      ### (it's probably better to not load these drivers manually, but instead
      ### use module-udev-detect -- see below -- for doing this automatically)
      #load-module module-alsa-sink device=hw:1,0
      #load-module module-alsa-source
      #load-module module-oss device="/dev/dsp" sink_name=output source_name=input
      #load-module module-oss-mmap device="/dev/dsp" sink_name=output source_name=input
      #load-module module-null-sink
      #load-module module-pipe-sink

      ### Automatically load driver modules depending on the hardware available
      .ifexists module-udev-detect.so
      load-module module-udev-detect
      .else
      ### Use the static hardware detection module (for systems that lack udev support)
      load-module module-detect
      .endif

      ### Automatically connect sink and source if JACK server is present
      .ifexists module-jackdbus-detect.so
      .nofail
      load-module module-jackdbus-detect channels=2
      .fail
      .endif

      ### Automatically load driver modules for Bluetooth hardware
      .ifexists module-bluetooth-policy.so
      load-module module-bluetooth-policy ag=true
      # auto_switch=2
      .endif

      .ifexists module-bluetooth-discover.so
      load-module module-bluetooth-discover headset=auto
      # headset=ofono
      .endif

      ### Load several protocols
      .ifexists module-esound-protocol-unix.so
      load-module module-esound-protocol-unix
      .endif
      load-module module-native-protocol-unix auth-anonymous=1

      ### Network access (may be configured with paprefs, so leave this commented
      ### here if you plan to use paprefs)
      #load-module module-esound-protocol-tcp
      #load-module module-native-protocol-tcp
      #load-module module-zeroconf-publish

      ### Load the RTP receiver module (also configured via paprefs, see above)
      #load-module module-rtp-recv

      ### Load the RTP sender module (also configured via paprefs, see above)
      #load-module module-null-sink sink_name=rtp format=s16be channels=2 rate=44100 sink_properties="device.description='RTP Multicast Sink'"
      #load-module module-rtp-send source=rtp.monitor


      ### Load additional modules from GConf settings. This can be configured with the paprefs tool.
      ### Please keep in mind that the modules configured by paprefs might conflict with manually
      ### loaded modules.
      #.ifexists module-gconf.so
      #.nofail
      #load-module module-gconf
      #.fail
      #.endif

      ### Automatically restore the default sink/source when changed by the user
      ### during runtime
      ### NOTE: This should be loaded as early as possible so that subsequent modules
      ### that look up the default sink/source get the right value
      load-module module-default-device-restore

      ### Automatically move streams to the default sink if the sink they are
      ### connected to dies, similar for sources
      load-module module-rescue-streams

      ### Make sure we always have a sink around, even if it is a null sink.
      load-module module-always-sink

      ### Honour intended role device property
      load-module module-intended-roles

      ### Automatically suspend sinks/sources that become idle for too long
      load-module module-suspend-on-idle

      ### If autoexit on idle is enabled we want to make sure we only quit
      ### when no local session needs us anymore.
      .ifexists module-console-kit.so
      load-module module-console-kit
      .endif
      .ifexists module-systemd-login.so
      load-module module-systemd-login
      .endif

      ### Enable positioned event sounds
      load-module module-position-event-sounds

      ### Cork music/video streams when a phone stream is active
      load-module module-role-cork

      ### Modules to allow autoloading of filters (such as echo cancellation)
      ### on demand. module-filter-heuristics tries to determine what filters
      ### make sense, and module-filter-apply does the heavy-lifting of
      ### loading modules and rerouting streams.
      load-module module-filter-heuristics
      load-module module-filter-apply

      ### Make some devices default
      # Make HDMI default #Check with pactl list short sinks
      set-default-sink alsa_output.platform-sound-hdmi.stereo-fallback
      #set-default-source input


      I only commented the following,



      #load-module module-switch-on-connect
      #load-module module-switch-on-port-available


      and added



      load-module module-bluetooth-policy ag=true
      load-module module-bluetooth-discover headset=auto


      Unfortunately, with the commented-out modules, when I get a call and call ends, a2dp sink changes to a device that I don't want. So set-default-sink do not work. So commenting these out works for me. Maybe it triggers something bigger. I'd like to get your opinion.



      I have the following in my ~/.asoundrc ALSA configuration. This might not be the best way to define asoundrc, since I also use pulseaudio. I'd also use your opinions here.



      # Making the HDMI device default
      pcm.!default
      type hw
      card 2
      device 0



      I have the following cards:



      **** List of PLAYBACK Hardware Devices ****
      card 0: cs42888audio [cs42888-audio], device 0: HiFi cs42888-0
      Subdevices: 1/1
      Subdevice #0: subdevice #0
      card 1: wm8960audio [wm8960-audio], device 0: HiFi wm8960-hifi-0
      Subdevices: 1/1
      Subdevice #0: subdevice #0
      card 1: wm8960audio [wm8960-audio], device 1: HiFi-ASRC-FE (*)
      Subdevices: 1/1
      Subdevice #0: subdevice #0
      card 2: imxaudiohdmi [imx-audio-hdmi], device 0: imx8 hdmi snd-soc-dummy-dai-0
      Subdevices: 1/1
      Subdevice #0: subdevice #0


      Last but not least, I use CSR v4.0 bluetooth module (china made), I also suspect maybe disconnection problems have something to do with the module.



      Now, coming to the problems I'm having..



      Almost everytime I launch pulseaudio with pulseaudio --realtime, I get the following messages:



      W: [pulseaudio] module-loopback.c: Configured latency of 200.00 ms is smaller than minimum latency, using minimum instead
      W: [pulseaudio] module-loopback.c: Cannot set requested sink latency of 68.25 ms, adjusting to 100.00 ms
      W: [pulseaudio] module-loopback.c: Cannot set requested source latency of 143.25 ms, adjusting to 250.00 ms


      I also get the following occasionaly when connection switches from HFP to A2DP or vice versa:



      alsa-util.c: Got POLLNVAL from ALSA
      alsa-util.c: Got POLLNVAL from ALSA


      When I launch my application (which basically only uses dbus in order to communicate with bluez & ofono), the application runs for a while. With the perfect luck, I get around 5 minutes of smooth media transmission, phone rings and I'm able to talk to the person, then phone hangs up and everything continues as expected. What I'm saying is it is not really deterministic when the errors or problems occur. That's making the solution very difficult to find, and problem very difficult to reproduce. It's just the courtesy of bluez, pulseaudio and ofono. Sometimes, it happens when I have a 4minute+ call on the phone and hang up, the a2dp does not come back live and I get the following constantly in bluez log:



      bluetoothd[10544]: ../bluez-5.41/profiles/audio/avdtp.c:avdtp_parse_cmd() Received START_CMD
      bluetoothd[10544]: ../bluez-5.41/profiles/audio/avdtp.c:avdtp_start_cmd() Rejecting (49)
      bluetoothd[10544]: ../bluez-5.41/profiles/audio/avdtp.c:session_cb()


      Sometimes when I send hang up command through DBUS, for example, I get the following in dbus-monitor --system. It says org.freedesktop.DBus.Error.AccessDenied, but I think this error might stem from the fact that ofono had already crashed and now I'm unable to send commands:



      method return time=1539068262.046519 sender=:1.26 -> destination=:1.23 serial=21 reply_serial=114
      error time=1539068262.046600 sender=org.freedesktop.DBus -> destination=:1.26 error_name=org.freedesktop.DBus.Error.AccessDenied reply_serial=21
      string "Rejected send message, 1 matched rules; type="method_return", sender=":1.26" (uid=0 pid=30830 comm="pulseaudio --realtime ") interface="(unset)" member="(unset)" error name="(unset)" requested_reply="0" destination=":1.23" (uid=0 pid=30827 comm="/usr/sbin/ofonod -d -n ")"


      Similarly, when ofono Aborts with absolutely no error log whatsoever, I get something like the following in libqofono:



      Hangup failed: QDBusError("org.freedesktop.DBus.Error.NoReply", "Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.")


      Oh, and also, when I want to pause the HFP connection by simply hitting bluetooth switch while I'm in a call, and get it back on, I get the following and then audio is lost:



      E: [bluetooth] module-bluez5-device.c: Failed to read data from SCO socket: Connection reset by peer
      E: [pulseaudio] backend-ofono.c: Deferred setup failed on fd -1: Transport endpoint is not connected
      W: [pulseaudio] backend-ofono.c: New audio connection invalid arguments (path=/card_1 fd=31, codec=1)


      In the meantime, ofono gives no error that I can see:



      ...
      ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8cde110 property DevicePath
      ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8d7f7d0 property DevicePath
      ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8cdfb20 property DevicePath
      ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8d32130 property DevicePath
      ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8d2fdd0 property DevicePath
      ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8cde110 property DevicePath
      ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8d7f7d0 property DevicePath
      ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8cdfb20 property DevicePath
      ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8d32130 property DevicePath
      ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8d2fdd0 property DevicePath
      ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8cde110 property DevicePath
      ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8d7f7d0 property DevicePath
      ofonod[8891]: ../ofono-1.18/src/modem.c:get_modem_property() modem 0x8cdfb20 property DevicePath
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
      ofonod[8891]: ../ofono-1.18/drivers/hfpmodem/voicecall.c:clip_notify() clip_notify: +xxxxxxxxx 145 0
      ofonod[8891]: ../ofono-1.18/src/voicecall.c:ofono_voicecall_notify() Got a voicecall event, status: 4, id: 1, number: +xxxxxxxxxx called_number: , called_name
      ofonod[8891]: ../ofono-1.18/src/voicecall.c:ofono_voicecall_notify() Did not find a call with id: 1
      ofonod[8891]: ../ofono-1.18/src/voicecall.c:ofono_voicecall_notify() Got a voicecall event, status: 0, id: 1, number: +xxxxxxxxxx called_number: , called_name
      ofonod[8891]: ../ofono-1.18/src/voicecall.c:ofono_voicecall_notify() Found call with id: 1
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
      ofonod[8891]: ../ofono-1.18/src/voicecall.c:ofono_voicecall_disconnected() Got disconnection event for id: 1, reason: 2
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:agent_disconnect() Agent :1.16 disconnected
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:am_agent_register() Agent :1.22 registered with the CODECs: CVSD
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:am_agent_register() Wideband speech disabled: no mSBC support
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:sco_accept() SCO connection setup between local: 00:1A:7D:DA:71:15 and remote: D8:5B:2A:5B:7B:E6
      ofonod[8891]: ../ofono-1.18/src/handsfree-audio.c:send_new_connection() 0x8ce5530, fd: 11, codec: 1


      All in all, I am really stuck trying to make bluez, ofono, and pulseaudio work at the same time. I really would appreciate a couple of pointers as to what might be the core cause of these problems.



      Is it my pulseaudio & alsa configuration being not correct? Is it the dbus permissions? Is it the CSRv4.0 bluetooth dongle? or is it faulty drivers in a pre-release board (i.MX8 QuadMax MEK)? Is it the bluez, ofono, or pulseaudio versions that I'm using being buggy? Or is it the fact that pulseaudio not being fully supported in wayland?







      audio pulseaudio alsa bluetooth bluez






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 10 hours ago









      Rui F Ribeiro

      37k1273117




      37k1273117










      asked 10 hours ago









      mozcelikors

      1316




      1316

























          active

          oldest

          votes











          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f474271%2fbluez-pulseaudio-and-ofono-crashes-and-problems-in-imx8-wayland%23new-answer', 'question_page');

          );

          Post as a guest



































          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f474271%2fbluez-pulseaudio-and-ofono-crashes-and-problems-in-imx8-wayland%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          Bahrain

          Postfix configuration issue with fips on centos 7; mailgun relay