This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Bluetooth SCO over PCM/HCI



Hello There

I am trying to bring the Bluetooth SCO over PCM/HCI

Further to this discussion , when i am trying to open it from the Application it is feeding audio into /hardware/libhardware/audio , How to ensure I have primary audio interface /device/ti/jactintoevm/audio instead?

e2e.ti.com/.../2561178

  • If you are using the TI Android Oreo release in a DRA7XX EVM, then the correct audio HAL will be loaded automatically (i.e. audio.primary.jacinto6.so).

    I understand that the HAL you're referring to in the default HAL (audio.primary.default.so or audio.primary.stub.so), please correct me if I'm wrong. While that HAL may be loaded if present in the system, at runtime the AudioFlinger should not call it, unless the primary HAL is missing. Please check that the audio.primary.jacinto6.so library is present in /vendor/lib/hw/.

    Also, could you clarify what exactly you meant by "open it"? What is being opened? Is it the HAL's open() function or something else?
  • Hello Misael

    Thank you for input. I'm using the TI drop A6O1.0 & I can see both the libraries in the folder.

    I'm calling/opening from the Application using Audio manager while I enable BT SCO, it by default going to the default HAL rather than TI audio HAL?

  • What method of AudioManager are you using? To enter in a voice call mode, one has to set the mode to MODE_IN_CALL. The primary HAL has a related method called adev_set_mode() which ultimately gets called to set up the call. In our primary HAL, that function creates two threads: one to route BT SCO downlink data to the speakers, and another thread to route BT SCO uplink data from the microphone.
  • I'm using these two calls startBluetoothSco/setBluetoothScoOn to turn SCO on/off and I set the mode to MODE_IN_CALL .

    Also, I notice BT stack is rejecting the SCO connection , see below

    I chatty : uid=1000(system) com.android.settings identical 52 lines
    01-01 00:17:37.193 619 619 D FallbackHome: User unlocked but no home; let's hope someone enables one soon?
    01-01 00:17:37.335 481 618 D BluetoothHeadsetClientServiceJni: callsetup_cb bdaddr 98:9e:63:53:00:7f
    01-01 00:17:37.733 619 619 D FallbackHome: User unlocked but no home; let's hope someone enables one soon?
    01-01 00:17:38.811 619 619 I chatty : uid=1000(system) com.android.settings identical 4 lines
    01-01 00:17:38.812 619 619 D FallbackHome: User unlocked but no home; let's hope someone enables one soon?
    01-01 00:17:39.016 481 618 D BluetoothHeadsetClientServiceJni: callsetup_cb bdaddr 98:9e:63:53:00:7f
    01-01 00:17:39.352 619 619 D FallbackHome: User unlocked but no home; let's hope someone enables one soon?
    01-01 00:17:39.353 619 619 D FallbackHome: User unlocked but no home; let's hope someone enables one soon?
    01-01 00:17:39.714 481 746 W bt_btm : btm_sco_conn_req: No one wants this SCO connection; rejecting it
    01-01 00:17:39.893 619 619 D FallbackHome: User unlocked but no home; let's hope someone enables one soon?
    01-01 00:17:39.894 619 619 D FallbackHome: User unlocked but no home; let's hope someone enables one soon?
    01-01 00:17:39.917 481 746 W bt_btm : btm_sco_conn_req: No one wants this SCO connection; rejecting it
    01-01 00:17:40.194 481 746 W bt_btm : btm_sco_conn_req: No one wants this SCO connection; rejecting it
    01-01 00:17:40.434 619 619 D FallbackHome: User unlocked but no home; let's hope someone enables one soon?
    01-01 00:17:40.435 481 746 W bt_btm : btm_sco_conn_req: No one wants this SCO connection; rejecting it
    01-01 00:17:40.436 619 619 D FallbackHome: User unlocked but no home; let's hope someone enables one soon?

    Messages from HAL/Audio while I turn SCO on/off

     D FallbackHome: User unlocked but no home; let's hope someone enables one soon?
    01-01 00:17:19.931   176  1633 I audio_hw_primary: out_write() open card 0 port 0
    01-01 00:17:19.934   176  1633 W StreamHAL: Error from HAL stream in function get_presentation_position: Operation not permitted
    01-01 00:17:19.935  9635  9635 I TestBT  : BT ON
    01-01 00:17:20.032   337   384 D BluetoothHeadset: Proxy object connected
    01-01 00:17:20.093   619   619 D FallbackHome: User unlocked but no home; let's hope someone enables one soon?
    01-01 00:17:20.094   619   619 D FallbackHome: User unlocked but no home; let's hope someone enables one soon?
    01-01 00:17:20.145   176   176 W DeviceHAL: Device 0xa7b8e000 set_voice_volume: Function not implemented
    01-01 00:17:20.191   242   308 W APM::AudioPolicyEngine: setForceUse() invalid config 1 for FOR_RECORD
    01-01 00:17:20.191   242   308 W APM_AudioPolicyManager: setForceUse() could not set force cfg 1 for usage 2
    01-01 00:17:20.285   176   176 W DeviceHAL: Device 0xa7b8e000 set_voice_volume: Function not implemented
    01-01 00:17:20.636   619   619 D FallbackHome: User unlocked but no home; let's hope someone enables one soon?
    01-01 00:17:22.679   619   619 I chatty  : uid=1000(system) com.android.settings identical 8 lines
    01-01 00:17:22.680   619   619 D FallbackHome: User unlocked but no home; let's hope someone enables one soon?
    01-01 00:17:23.030   176   176 I audio_hw_primary: do_out_standby() close card 0 port 0
    01-01 00:17:23.220   619   619 D FallbackHome: User unlocked but no home; let's hope someone enables one soon?

    These messages are from the default HAL (So I believe it is not routing to TI audio HAL)

  • The messages with the "audio_hw_primary" tag are from the TI audio HAL. You can try enabling the ALOGV messages by uncommenting the "LOG_NDEBUG 0" definition at the very top of the audio HAL source file.

    Keep in mind that the TI HAL sets up the audio paths for a McASP-based PCM interface and for an ALSA card named "DRA7xxWiLink". If you SCO link is based on something else, the TI HAL won't work as is, but it should provide a good starting point for you to customize it for your specific BT module.

  • I believe WiLink is the old version. I 'm using TI A6O1.0 Jacinto6evm, Currently I can see below sound cards

    130|jacinto6evm:/ $ cat /proc/asound/pcm
    00-00: davinci-mcasp.0-tlv320aic3x-hifi tlv320aic3x-hifi-0 : : playback 1 : capture 1
    01-00: HDMI 58040000.encoder snd-soc-dummy-dai-0 : : playback 1
    02-00: davinci-mcasp.0-tlv320aic3x-hifi tlv320aic3x-hifi-0 : : playback 1 : capture 1

    how you make sure they are SCO enabled ?

    EDIT:

    Here is the configuration

    tinypcminfo -D 0 -d 0                                          
    Info for card 0, device 0:

    PCM out:
          Access:   0x000009
       Format[0]:   0x000404
       Format[1]:   00000000
     Format Name:   S16_LE, S32_LE
       Subformat:   0x000001
            Rate:   min=11025Hz     max=88200Hz
        Channels:   min=2           max=2
     Sample bits:   min=16          max=32
     Period size:   min=64          max=16384
    Period count:   min=2           max=19

    PCM in:
          Access:   0x000009
       Format[0]:   0x000404
       Format[1]:   00000000
     Format Name:   S16_LE, S32_LE
       Subformat:   0x000001
            Rate:   min=11025Hz     max=88200Hz
        Channels:   min=2           max=2
     Sample bits:   min=16          max=32
     Period size:   min=64          max=16384
    Period count:   min=2           max=19
    jacinto6evm:/ #

    I would expect rate 8k and mono channel , right?

  • None of those sound cards are related BT SCO. The kernel 4.4 that comes with 6AO.1.0 release doesn't support BT SCO. If I remember correctly, BT was supported in kernel 3.14 in the 6AL.1.2 release.

    It should be possible to port the patches from kernel 3.14 to kernel 4.4. In case you're interested, here is the list of patches.

    Although the audio HAL still has voice call support, it hasn't been tested since 6AL.1.2 release, so it may need some update/fixes as well.