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.

Linux: Android O : BT Service crashes

Tool/software: Linux

Hello There

I am trying to bring up the BT USB device on the board and it crashes with the below error :


01-01 01:16:47.976 19851 19885 I bt_hci  : hci_initialize: IBluetoothHci::getService() returned 0xa63b1ee0 (remote)
01-01 01:16:47.976  2894  2944 I android.hardware.bluetooth@1.0-impl: BluetoothHci::initialize()
01-01 01:16:47.977  2894  2944 I bt_vendor: bt_vendor_init
01-01 01:16:47.977  2894  2944 I bt_vendor: Using interface hci0
01-01 01:16:47.977  2894  2944 D android.hardware.bluetooth@1.0-impl: Open vendor library loaded
01-01 01:16:47.977  2894  2944 I bt_vendor: bt_vendor_op op 0
01-01 01:16:47.977  2894  2944 I bt_vendor: bt_vendor_op op 0 retval 0
01-01 01:16:47.977  2894  2944 I bt_vendor: bt_vendor_op op 3
01-01 01:16:47.977  2894  2944 I bt_vendor: bt_vendor_open
01-01 01:16:47.977  2894  2944 I bt_vendor: bt_vendor_open returning 6
01-01 01:16:47.977  2894  2944 I bt_vendor: bt_vendor_op op 3 retval 1
01-01 01:16:47.977  2894  2944 I bt_vendor: bt_vendor_op op 1
01-01 01:16:47.977  2894  2944 I bt_vendor: bt_vendor_fw_cfg
01-01 01:16:47.977  2894  2944 I bt_vendor: bt_vendor_wait_hcidev
01-01 01:16:47.977  2894  2944 I bt_vendor: HCI device ready
01-01 01:16:47.977  2894  2944 D android.hardware.bluetooth@1.0-impl: OnFirmwareConfigured result: 0
01-01 01:16:47.977  2894  2944 I android.hardware.bluetooth@1.0-impl: Firmware configured in 0.000s
01-01 01:16:47.977  2894  2944 I bt_vendor: bt_vendor_op op 5
01-01 01:16:47.977  2894  2944 I bt_vendor: bt_vendor_op op 5 retval 0
01-01 01:16:47.977  2894  2944 I android.hardware.bluetooth@1.0-impl: OnFirmwareConfigured: lpm_timeout_ms 3000
01-01 01:16:47.977  2894  2944 I bt_vendor: bt_vendor_op op 6
01-01 01:16:47.977  2894  2944 D android.hardware.bluetooth@1.0-impl: low_power_mode_cb result: 0
01-01 01:16:47.977  2894  2944 I bt_vendor: bt_vendor_op op 6 retval 0
01-01 01:16:47.977  2894  2944 D android.hardware.bluetooth@1.0-impl: OnFirmwareConfigured Calling StartLowPowerWatchdog()
01-01 01:16:47.978  2894  2944 I bt_vendor: bt_vendor_op op 1 retval 0
01-01 01:16:47.978 19851 19885 I bt_hci  : event_finish_startup
01-01 01:16:47.978 19851 19871 I bt_core_module: module_start_up Started module "hci_module"
01-01 01:16:47.980 19851 19888 I bt_osi_thread: run_thread: thread id 19888, thread name bt_workqueue started
01-01 01:16:47.980 19851 19888 I bt_btu  : btu_task pending for preload complete event
01-01 01:16:47.980 19851 19888 I bt_btu_task: Bluetooth chip preload is complete
01-01 01:16:47.980 19851 19888 I bt_btu  : btu_task received preload complete event
01-01 01:16:47.981 19851 19888 E bt_att  : gatt_profile_db_init:  gatt_if=1
01-01 01:16:47.981 19851 19889 I bt_osi_thread: run_thread: thread id 19889, thread name module_wrapper started
01-01 01:16:47.981 19851 19889 I bt_core_module: module_start_up Starting module "controller_module"
01-01 01:16:47.982  2894  2944 I bt_vendor: bt_vendor_op op 7
01-01 01:16:47.982  2894  2944 I bt_vendor: bt_vendor_op op 7 retval 0
01-01 01:16:47.982  2894  2944 E android.hardware.bluetooth-hci-hci_protocol: WriteSafely error writing to UART (Invalid argument)
01-01 01:16:49.983 19851 19874 E bt_hci  : command_timed_out: 1 commands pending response
01-01 01:16:49.983 19851 19874 E bt_hci  : command_timed_out: Waited 2001 ms for a response to opcode: 0xc03 *matches timer*
01-01 01:16:49.983 19851 19874 E bt_hci  : command_timed_out: Size 3 Hex 03 0c 00
01-01 01:16:49.983 19851 19874 E bt_hci  : command_timed_out: requesting a firmware dump.
01-01 01:16:49.983  2894  2944 E android.hardware.bluetooth-hci-hci_protocol: WriteSafely error writing to UART (Invalid argument)
01-01 01:16:49.983 19851 19874 E bt_hci  : command_timed_out restarting the Bluetooth process.
01-01 01:16:50.484 19851 19874 F libc    : Fatal signal 6 (SIGABRT), code -6 in tid 19874 (alarm_default_c)
01-01 01:16:50.542 19893 19893 I crash_dump32: obtaining output fd from tombstoned
01-01 01:16:50.543   274   274 I /system/bin/tombstoned: received crash request for pid 19851
01-01 01:16:50.543 19893 19893 I crash_dump32: performing dump of process 19851 (target tid = 19874)
01-01 01:16:50.544 19893 19893 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
01-01 01:16:50.544 19893 19893 F DEBUG   : Build fingerprint: 'TI/full_jacinto6evm/jacinto6evm:8.0.0/OPR6.170623.013/dilpre04261833:userdebug/test-keys'
01-01 01:16:50.544 19893 19893 F DEBUG   : Revision: '0'
01-01 01:16:50.544 19893 19893 F DEBUG   : ABI: 'arm'
01-01 01:16:50.544 19893 19893 F DEBUG   : pid: 19851, tid: 19874, name: alarm_default_c  >>> com.android.bluetooth <<<
01-01 01:16:50.544 19893 19893 F DEBUG   : signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
01-01 01:16:50.544 19893 19893 F DEBUG   :     r0 00000000  r1 00004da2  r2 00000006  r3 00000008
01-01 01:16:50.544 19893 19893 F DEBUG   :     r4 00004d8b  r5 00004da2  r6 95929018  r7 0000010c
01-01 01:16:50.544 19893 19893 F DEBUG   :     r8 a6692668  r9 95f941d0  sl a6692668  fp 00000c03
01-01 01:16:50.544 19893 19893 F DEBUG   :     ip 00000000  sp 95929008  lr affa13c7  pc affd1a9c  cpsr 200f0010
01-01 01:16:50.609 19893 19893 F DEBUG   :
01-01 01:16:50.609 19893 19893 F DEBUG   : backtrace:
01-01 01:16:50.609 19893 19893 F DEBUG   :     #00 pc 0004aa9c  /system/lib/libc.so (tgkill+12)
01-01 01:16:50.609 19893 19893 F DEBUG   :     #01 pc 0001a3c3  /system/lib/libc.so (abort+54)
01-01 01:16:50.609 19893 19893 F DEBUG   :     #02 pc 000a1157  /system/lib/hw/bluetooth.default.so (_ZL17command_timed_outPv+398)
01-01 01:16:50.609 19893 19893 F DEBUG   :     #03 pc 00128867  /system/lib/hw/bluetooth.default.so (_ZL17alarm_queue_readyP13fixed_queue_tPv+134)
01-01 01:16:50.609 19893 19893 F DEBUG   :     #04 pc 0012b423  /system/lib/hw/bluetooth.default.so (_ZL22internal_dequeue_readyPv+46)
01-01 01:16:50.609 19893 19893 F DEBUG   :     #05 pc 0012d9b9  /system/lib/hw/bluetooth.default.so (_ZL11run_reactorP9reactor_ti+216)
01-01 01:16:50.609 19893 19893 F DEBUG   :     #06 pc 0012d8b5  /system/lib/hw/bluetooth.default.so (_Z13reactor_startP9reactor_t+44)
01-01 01:16:50.609 19893 19893 F DEBUG   :     #07 pc 0012ebb1  /system/lib/hw/bluetooth.default.so (_ZL10run_threadPv+136)
01-01 01:16:50.609 19893 19893 F DEBUG   :     #08 pc 00047dbf  /system/lib/libc.so (_ZL15__pthread_startPv+22)
01-01 01:16:50.609 19893 19893 F DEBUG   :     #09 pc 0001af7f  /system/lib/libc.so (__start_thread+32)
01-01 01:16:51.726   274   274 E /system/bin/tombstoned: Tombstone written to: /data/tombstones//tombstone_08[ 4611.735180] init: Untracked pid 19893 exited with status 0

01-01 01:16:51.731   337   357 I BootReceiver: Copying /data/tombstones/tombstone_08 to DropBox (SYSTEM_TOMBSTONE)
01-01 01:16:51.811  2894  2944 E android.hardware.bluetooth@1.0-impl: BluetoothDeathRecipient::serviceDied - Bluetooth service died
01-01 01:16:51.811  2894  2944 I android.hardware.bluetooth@1.0-impl: BluetoothHci::close()
01-01 01:16:51.811  2894  2944 I android.hardware.bluetooth@1.0-impl: Skipping unlink call, service died.
01-01 01:16:51.811  2894  2944 I bt_vendor: bt_vendor_op op 6
01-01 01:16:51.811  2894  2944 D android.hardware.bluetooth@1.0-impl: low_power_mode_cb result: 0
01-01 01:16:51.811  2894  2944 I bt_vendor: bt_vendor_op op 6 retval 0
01-01 01:16:51.811   337   337 D BluetoothManagerService: BluetoothServiceConnection, disconnected: com.android.bluetooth.btservice.AdapterService
01-01 01:16:51.811   337  1575 I ActivityManager: Process com.android.bluetooth (pid 19851) has died: psvc IMPF
01-01 01:16:51.811   337  1575 W ActivityManager: Scheduling restart of crashed service com.android.bluetooth/.gatt.GattService in 1000ms
01-01 01:16:51.811   337  1575 W ActivityManager: Scheduling restart of crashed service com.android.bluetooth/.btservice.AdapterService in 1000ms
01-01 01:16:51.811   337   359 E BluetoothManagerService: MESSAGE_BLUETOOTH_SERVICE_DISCONNECTED(1)
01-01 01:16:51.812   337   359 D BluetoothManagerService: Broadcasting onBluetoothServiceDown() to 5 receivers.
01-01 01:16:51.812   337   359 D BluetoothAdapter: onBluetoothServiceDown: android.bluetooth.IBluetooth$Stub$Proxy@6bf4d9c
01-01 01:16:51.812   502   544 D BluetoothAdapter: onBluetoothServiceDown: android.bluetooth.IBluetooth$Stub$Proxy@6b5cb83
01-01 01:16:51.812   573  1025 D BluetoothAdapter: onBluetoothServiceDown: android.bluetooth.IBluetooth$Stub$Proxy@311c5d2
01-01 01:16:51.812  1418  1436 D BluetoothAdapter: onBluetoothServiceDown: android.bluetooth.IBluetooth$Stub$Proxy@b4f4f3b
01-01 01:16:51.812   581   842 D BluetoothAdapter: onBluetoothServiceDown: android.bluetooth.IBluetooth$Stub$Proxy@fa94c89
01-01 01:16:51.813  2894  2944 I bt_vendor: bt_vendor_op op 4
01-01 01:16:51.813  2894  2944 I bt_vendor: bt_vendor_close
01-01 01:16:51.815  2894  2944 I bt_vendor: bt_vendor_op op 4 retval 0
01-01 01:16:51.815  2894  2944 I bt_vendor: bt_vendor_op op 0
01-01 01:16:51.815  2894  2944 I bt_vendor: bt_vendor_op op 0 retval 0
01-01 01:16:51.815  2894  2944 I bt_vendor: bt_vendor_cleanup

Please let me know if you can recognize the issue here. I can see my Hci0 device and can use the user tools to communicate, However, HAL causing the BT service crash.

  • Hi Singh,

    Bluetooth support is out of scope of Android SDK we release.

    Also, my understanding is that, you might still need a vendor specific Bluetooth HAL for any Bluetooth hardware to work.
    The crash here is coming from default Bluetooth HAL (bluetooth.default.so) which comes from Google. Please try asking this question in a Google forum.

    Regards,
    Vishal

  • Well, If you look into the new architecture it is clear they don't need the additional layer and I can see my bluetooth up now :)

    Thank you for the input.
  • Thanks for the update. Glad it's working.
    It would be great if you could share what was not working and how you fixed it, so that it would be useful for other users of E2E.

  • I have it working using the HAL layer provided by the new Architecture , that layer eliminates the need for additional vendor specific implementation .
  • Today, I login with different questions:
    1. Audio layer provided is currently not functional and using legacy code (//hardware/interfaces/audio) ?
    2. Do you support PCM Audio and SCO (Since you don't have BT working I believe SCO is not supported , please confirm )?
    3. Code release is about a year old and there have been alot of changes in the Fluoride BT and some of the functionality is not even compiled (failed compilations) , How would you address this ?
  • Hi Singh,

    #1 and #2 - We don't support PCM and SCO audio use cases in Android SDKs.

    #3 - Could you give more details? We just made a release 6AO.1.1 few weeks back.


    Regards,
    Vishal

  • Hello Vishal

    I tried with SCO over HCI and it broke while compiling , you need to set the flag in the configuration . Latest code on google developer site has changed alot and they have been continuously working on improving the BT code .

    What additional feature you are providing in latest code , should we take that instead? Is there any BT related work ? (EDIT: I just saw the release notes)

    In case we want to work with PCM /SCO , what are your thoughts on that , as this would be better option for audio

  • Hi Singh,

    We don't make our SDK releases on AOSP master. The SDK releases are planned on pastry versions released by Google. Like Android 8.0, Android 8.1, etc.. You can cherry pick the changes you need from AOSP master branch.

    Regarding PCM/SCO for BT:
    - We had support for this in old SDK releases for WiLink8 (Android Lollipop + Kernel 3.14).
    - Support for this needs to be enabled in both Kernel and Audio HAL.
    -- Kernel: For USB dongle the driver for this dongle in Kernel should take care of enumerating the sound card.
    -- Audio HAL: We have not tested this for Android O, the code was last tested on Android L with WiLink.

    Please note that as mentioned earlier we have not done any BT related work on our Marshmallow and Oreo releases.

    Regards,
    Vishal
  • Hello Vishal

    Yes that I believe we have to do as even in our case A2DP profile is not working .

    Can you point us WiLink8 release or a patch which I can use as a reference (can't locate in lollipop release)?

    and I am bit confused with above scenario , please clarify me on this again.
    So if I have to enable the PCM/SCO
    1.I need additional hardware ( sound card ?) and support for that in kernel and Audio HAL?
    2. Currently we have TI Jacinto board with AIC3106 codec for audio input/output.
    3. To enable SCO I need to have a SCO codec to support BT ?
    4. Which AudioHAL are you referring here (/hardware/libhardware/audio or /device/ti/jacintoevm/audio)?

    We are using the BT CSR dongle through Mini USB interface, what are our best options for BT audio working, I can think of:
    1. SCO over HCI
    2. SCO over PCM

    Is there any other option, what are the possibilities with AIC3106?
  • Hi Singh,

    1) I meant software audio card (ALSA) , the driver will enumerate a card. You can see existing sound cards enumerated in /proc/asound/pcm
    2) That's OK.
    3) Not needed for USB BT device. It is needed for WiLink8 board that has dedicated McASP connection to J6.
    4) referring to device/ti/jacinto6evm/audio

    We don't know much about SCO over HCI.

    For more queries on this please open a new E2E question.

    Regards,
    Vishal

  • Hello Visha

    That actually bring back to my very first question as when i am trying to open it from the Application it is feeding into /hardware/libhardware/audio , How to ensure I have primary interface /device/ti/jactintoevm/audio instead?

    And yes I have seen those cards (two) .
  • Hi Singh,

    Please open a new E2E post for the audio discussion.

    Regards,
    Vishal