<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <font face="Helvetica, Arial, sans-serif">Arduino Tian (an evolution
      of Arduino Yun) is a board that has a MIPS processor where Linux
      is runinng. The distribution used is Linino, derived from openWRT.<br>
      <br>
      On this board Wifi from Qualcomm and Bluetooth from CSR are
      embedded.<br>
      <br>
      Software version details:<br>
      - kernel 3.18.11<br>
      - bluez5 version 5.23<br>
      - pulseaudio 6.0<br>
      - dbus 1.9<br>
      <br>
      The Headset device is properly connected but using paplay:<br>
    </font><br>
    <font face="Helvetica, Arial, sans-serif"><font face="Helvetica,
        Arial, sans-serif">root@linino:~# paplay -v -d
        bluez_sink.5D_43_5A_03_31_EA /root/sample.wav <br>
        Opening a playback stream with sample specification 's16be 2ch
        44100Hz' and channel map 'front-left,front-right'.<br>
        Connection established.<br>
        Stream successfully created.<br>
        Buffer metrics: maxlength=4194304, tlength=352800,
        prebuf=349276, minreq=3528<br>
        Using sample spec 's16be 2ch 44100Hz', channel map
        'front-left,front-right'.<br>
        Connected to device bluez_sink.5D_43_5A_03_31_EA (index: 1,
        suspended: no).<br>
        <br>
      </font>it start to play the music but without any sound. Trying to
      change the card profile from HSP to A2DP with the command:<br>
      <br>
      pactl set-card-profile 0, a2dp_sink<br>
      <br>
      hangs the board and exit with connection failure: Timeout<br>
      <br>
      trying to trace the code, I noticed that it stops on the call
      stop_thread on module-bluez5-device.c<br>
      <br>
      Can you help me to understand why is hanging changing the profile?<br>
      <br>
      Is it possible to force the default to A2DP instead of HSP?<br>
      <br>
      Following some output:<br>
      <br>
      root@linino:~# <br>
      root@linino:~# pactl list cards<br>
      Card #0<br>
          Name: bluez_card.5D_43_5A_03_31_EA<br>
          Driver: module-bluez5-device.c<br>
          Owner Module: 17<br>
          Properties:<br>
              device.description = "Marley Chant BT"<br>
              device.string = "5D:43:5A:03:31:EA"<br>
              device.api = "bluez"<br>
              device.class = "sound"<br>
              device.bus = "bluetooth"<br>
              device.form_factor = "headset"<br>
              bluez.path = "/org/bluez/hci0/dev_5D_43_5A_03_31_EA"<br>
              bluez.class = "0x240404"<br>
              bluez.alias = "Marley Chant BT"<br>
              device.icon_name = "audio-headset-bluetooth"<br>
              device.intended_roles = "phone"<br>
          Profiles:<br>
              headset_head_unit: Headset Head Unit (HSP/HFP) (sinks: 1,
      sources: 1, priority: 20, available: yes)<br>
              a2dp_sink: High Fidelity Playback (A2DP Sink) (sinks: 1,
      sources: 0, priority: 10, available: yes)<br>
              off: Off (sinks: 0, sources: 0, priority: 0, available:
      yes)<br>
          Active Profile: headset_head_unit<br>
          Ports:<br>
              headset-output: Headset (priority: 0, latency offset: 0
      usec)<br>
                  Part of profile(s): headset_head_unit, a2dp_sink<br>
              headset-input: Headset (priority: 0, latency offset: 0
      usec)<br>
                  Part of profile(s): headset_head_unit<br>
      <br>
      <br>
      root@linino:~# pactl list sinks<br>
      Sink #1<br>
          State: SUSPENDED<br>
          Name: bluez_sink.5D_43_5A_03_31_EA<br>
          Description: Marley Chant BT<br>
          Driver: module-bluez5-device.c<br>
          Sample Specification: s16le 1ch 8000Hz<br>
          Channel Map: mono<br>
          Owner Module: 17<br>
          Mute: no<br>
          Volume: mono: 65536 / 100%<br>
                  balance 0.00<br>
          Base Volume: 65536 / 100%<br>
          Monitor Source: bluez_sink.5D_43_5A_03_31_EA.monitor<br>
          Latency: 0 usec, configured 0 usec<br>
          Flags: HARDWARE HW_VOLUME_CTRL LATENCY <br>
          Properties:<br>
              bluetooth.protocol = "headset_head_unit"<br>
              device.intended_roles = "phone"<br>
              device.description = "Marley Chant BT"<br>
              device.string = "5D:43:5A:03:31:EA"<br>
              device.api = "bluez"<br>
              device.class = "sound"<br>
              device.bus = "bluetooth"<br>
              device.form_factor = "headset"<br>
              bluez.path = "/org/bluez/hci0/dev_5D_43_5A_03_31_EA"<br>
              bluez.class = "0x240404"<br>
              bluez.alias = "Marley Chant BT"<br>
              device.icon_name = "audio-headset-bluetooth"<br>
          Ports:<br>
              headset-output: Headset (priority: 0)<br>
          Active Port: headset-output<br>
          Formats:<br>
              pcm<br>
      <br>
      <br>
    </font>
  </body>
</html>