title: Bluetooth broken on Android ROM (LineageOS 16)
body: <p>I want to build a custom (unofficial) version of <code>LineageOS 16.0</code> for my <code>Sony Xperia ZL (C6506)</code>. I managed to actually get the ROM to build using the device tree and various files from the GitHub repository <code>fusion3-common</code>. However, after flashing the ROM, it was immediately apparent that both the Bluetooth and the camera were not working. As far as I know, every part of the ROM but those two works so far. So, I need some guidance as to how to go about fixing the bluetooth/camera issues. When I boot the ROM, a message appears every 1-2 seconds notifying me that "Bluetooth has stopped". This continues forever and gets really annoying when using the device. As expected, connections with bluetooth don't work either. As for the camera, the app just says there isn't a camera connected and quits. I suspect these issues are caused by incompatible vendor binaries.</p>
  
  <p>Here is part of the logcat:</p>
  
  <pre><code>11-20 12:15:47.919 32620 32662 I bt_hci  : hci_initialize
  11-20 12:15:47.922   215   215 W hwservicemanager: getTransport: Cannot find entry android.hardware.bluetooth@1.0::IBluetoothHci/default in either framework or device manifest.
  11-20 12:15:47.923 32620 32642 D bt_hci  : hci_module_start_up starting async portion
  11-20 12:15:47.926 32620 32662 D vndksupport: Loading /vendor/lib/hw/android.hardware.bluetooth@1.0-impl.so from current namespace instead of sphal namespace.
  11-20 12:15:47.942 32620 32662 I bt_hci  : hci_initialize: IBluetoothHci::getService() returned 0xa7a6f140 (local)
  11-20 12:15:47.943 32620 32662 I android.hardware.bluetooth@1.0-impl: BluetoothHci::initialize()
  11-20 12:15:47.948 32620 32662 D         : get_local_address: Trying /data/misc/bluetooth/bdaddr
  11-20 12:15:47.948 32620 32662 D         : get_local_address: Got Factory BDA 00:eb:2d:4f:a3:b1
  11-20 12:15:47.948 32620 32662 I bt_vendor: ++init
  11-20 12:15:47.948 32620 32662 I bt_vendor: bt-vendor : get_bt_soc_type
  11-20 12:15:47.948 32620 32662 I bt_vendor: vendor.qcom.bluetooth.soc set to smd
  11-20 12:15:47.948 32620 32662 I bt_vendor: vendor.qcom.bluetooth.soc not set, so using default.
  11-20 12:15:47.948 32620 32662 I bt_vendor: BD Address: b1:a3:4f:2d:eb:00
  11-20 12:15:47.952 32620 32662 D android.hardware.bluetooth@1.0-impl: Open vendor library loaded
  11-20 12:15:47.952 32620 32662 I bt_vendor: bt-vendor : BT_VND_OP_POWER_CTRL: On
  11-20 12:15:47.952 32620 32662 I bt_vendor: bluetooth status is on
  11-20 12:15:47.952 32620 32662 I bt_vendor: bt-vendor : resetting BT status
  11-20 12:15:47.952 32620 32662 W bt_vendor: Hw_config: nState = 0
  11-20 12:15:47.952 32620 32662 W bt_vendor: Hw_config: nState = 1
  11-20 12:15:47.952 32620 32662 I bt_vendor: bluetooth status is on
  11-20 12:15:47.952 32620 32662 I bt_vendor: bt-vendor : BT_VND_OP_USERIAL_OPEN
  11-20 12:15:47.957 32620 32662 I bt_vendor: Done intiailizing UART
  11-20 12:15:47.959 32620 32662 I bt_vendor: Done intiailizing UART
  11-20 12:15:47.960 32620 32662 I bt_vendor: Bluetooth FW and transport layer are initialized
  11-20 12:15:47.960 32620 32662 D android.hardware.bluetooth@1.0-impl: OnFirmwareConfigured result: 0
  11-20 12:15:47.960 32620 32662 I android.hardware.bluetooth@1.0-impl: Firmware configured in 0.000s
  11-20 12:15:47.960 32620 32662 I android.hardware.bluetooth@1.0-impl: OnFirmwareConfigured: lpm_timeout_ms 1000
  11-20 12:15:47.960 32620 32662 I bt_vendor: __op: property_get: persist.vendor.service.bdroid.lpmcfg: all
  11-20 12:15:47.960 32620 32662 D android.hardware.bluetooth@1.0-impl: low_power_mode_cb result: 0
  11-20 12:15:47.960 32620 32662 D android.hardware.bluetooth@1.0-impl: OnFirmwareConfigured Calling StartLowPowerWatchdog()
  11-20 12:15:47.961 32620 32662 I bt_hci  : event_finish_startup
  11-20 12:15:47.961 32620 32642 I bt_core_module: module_start_up Started module "hci_module"
  11-20 12:15:47.963 32620 32665 I bt_osi_thread: run_thread: thread id 32665, thread name bt_workqueue started
  11-20 12:15:47.965 32620 32665 I         : [1120/121547.964974:INFO:btu_task.cc(107)] Bluetooth chip preload is complete
  11-20 12:15:47.967 32620 32665 I         : [1120/121547.967568:INFO:gatt_api.cc(948)] GATT_Register 81818181-8181-8181-8181-818181818181
  11-20 12:15:47.968 32620 32665 I         : [1120/121547.967965:INFO:gatt_api.cc(968)] allocated gatt_if=1
  11-20 12:15:47.968 32620 32665 I         : [1120/121547.968331:INFO:gatt_api.cc(161)] GATTS_AddService
  11-20 12:15:47.968 32620 32665 I         : [1120/121547.968636:INFO:gatt_api.cc(265)] GATTS_AddService: service parsed correctly, now starting
  11-20 12:15:47.969 32620 32665 I         : [1120/121547.969552:INFO:gatt_api.cc(948)] GATT_Register 82828282-8282-8282-8282-828282828282
  11-20 12:15:47.970 32620 32665 I         : [1120/121547.969857:INFO:gatt_api.cc(968)] allocated gatt_if=2
  11-20 12:15:47.970 32620 32665 I         : [1120/121547.970132:INFO:gatt_api.cc(161)] GATTS_AddService
  11-20 12:15:47.970 32620 32665 I         : [1120/121547.970437:INFO:gatt_api.cc(265)] GATTS_AddService: service parsed correctly, now starting
  11-20 12:15:47.971 32620 32665 I bt_bte  : BTE_InitTraceLevels -- TRC_HCI : Level 2
  11-20 12:15:47.971 32620 32665 I bt_bte  : BTE_InitTraceLevels -- TRC_L2CAP : Level 2
  11-20 12:15:47.971 32620 32665 I bt_bte  : BTE_InitTraceLevels -- TRC_RFCOMM : Level 2
  11-20 12:15:47.971 32620 32665 I bt_bte  : BTE_InitTraceLevels -- TRC_AVDT : Level 2
  11-20 12:15:47.971 32620 32665 I bt_bte  : BTE_InitTraceLevels -- TRC_AVRC : Level 2
  11-20 12:15:47.972 32620 32665 I bt_bte  : BTE_InitTraceLevels -- TRC_A2D : Level 2
  11-20 12:15:47.972 32620 32665 I bt_bte  : BTE_InitTraceLevels -- TRC_BNEP : Level 2
  11-20 12:15:47.972 32620 32665 I bt_bte  : BTE_InitTraceLevels -- TRC_BTM : Level 2
  11-20 12:15:47.972 32620 32665 I bt_bte  : BTE_InitTraceLevels -- TRC_HID_HOST : Level 2
  11-20 12:15:47.972 32620 32665 I bt_bte  : BTE_InitTraceLevels -- TRC_PAN : Level 2
  11-20 12:15:47.972 32620 32665 I bt_bte  : BTE_InitTraceLevels -- TRC_SDP : Level 2
  11-20 12:15:47.972 32620 32665 I bt_bte  : BTE_InitTraceLevels -- TRC_SMP : Level 2
  11-20 12:15:47.972 32620 32665 I bt_bte  : BTE_InitTraceLevels -- TRC_HID_DEV : Level 2
  11-20 12:15:47.972 32620 32665 I bt_bte  : BTE_InitTraceLevels -- TRC_BTAPP : Level 2
  11-20 12:15:47.972 32620 32665 I bt_bte  : BTE_InitTraceLevels -- TRC_BTIF : Level 2
  11-20 12:15:47.974 32620 32666 I bt_osi_thread: run_thread: thread id 32666, thread name btu message loop started
  11-20 12:15:47.977 32620 32667 I bt_osi_thread: run_thread: thread id 32667, thread name module_wrapper started
  11-20 12:15:47.977 32620 32667 I bt_core_module: module_start_up Starting module "controller_module"
  11-20 12:15:48.046 32620 32664 D bt_hci  : get_waiting_command VS event found treat it as valid 0xffff
  11-20 12:15:48.047 32620 32667 E bt_hci  : read_command_complete_header: return status - 0x1
  11-20 12:15:48.062 32620 32667 I bt_core_module: module_start_up Started module "controller_module"
  11-20 12:15:48.062 32620 32667 W bt_osi_thread: run_thread: thread id 32667, thread name module_wrapper exited
  11-20 12:15:48.064 32620 32665 W bt_btm  : btm_decode_ext_features_page: feature page 1 ignored
  11-20 12:15:48.064 32620 32666 I bt_btm_sec: BTM_SecRegister p_cb_info-&gt;p_le_callback == 0x0x94c58db5
  11-20 12:15:48.064 32620 32666 I bt_btm_sec: BTM_SecRegister btm_cb.api.p_le_callback = 0x0x94c58db5
  11-20 12:15:48.065 32620 32666 I bt_stack: [INFO:gatt_api.cc(948)] GATT_Register 3df51175-d5d2-6289-ebe4-b8f015f52bd9
  11-20 12:15:48.065 32620 32666 I bt_stack: [INFO:gatt_api.cc(968)] allocated gatt_if=3
  11-20 12:15:48.091 32620 32664 D bt_hci  : get_waiting_command VS event found treat it as valid 0xffff
  11-20 12:15:48.091 32620 32666 F bt_stack: [FATAL:btm_ble_gap.cc(488)] Check failed: p_vcs_cplt_params-&gt;opcode == HCI_BLE_VENDOR_CAP_OCF.
  11-20 12:15:48.092 32620 32666 F libc    : Fatal signal 6 (SIGABRT), code -6 (SI_TKILL) in tid 32666 (btu message loo), pid 32620 (droid.bluetooth)
  11-20 12:15:48.229 32673 32673 W crash_dump32: failed to fetch registers for thread 32620: I/O error
  11-20 12:15:48.229 32673 32673 W crash_dump32: failed to fetch registers for thread 32627: I/O error
  11-20 12:15:48.229 32673 32673 W crash_dump32: failed to fetch registers for thread 32628: I/O error
  11-20 12:15:48.230 32673 32673 W crash_dump32: failed to fetch registers for thread 32629: I/O error
  11-20 12:15:48.230 32673 32673 W crash_dump32: failed to fetch registers for thread 32630: I/O error
  11-20 12:15:48.231 32673 32673 W crash_dump32: failed to fetch registers for thread 32631: I/O error
  11-20 12:15:48.231 32673 32673 W crash_dump32: failed to fetch registers for thread 32632: I/O error
  11-20 12:15:48.231 32673 32673 W crash_dump32: failed to fetch registers for thread 32633: I/O error
  11-20 12:15:48.232 32673 32673 W crash_dump32: failed to fetch registers for thread 32634: I/O error
  11-20 12:15:48.232 32673 32673 W crash_dump32: failed to fetch registers for thread 32635: I/O error
  11-20 12:15:48.232 32673 32673 W crash_dump32: failed to fetch registers for thread 32641: I/O error
  11-20 12:15:48.233 32673 32673 W crash_dump32: failed to fetch registers for thread 32642: I/O error
  11-20 12:15:48.233 32673 32673 W crash_dump32: failed to fetch registers for thread 32643: I/O error
  11-20 12:15:48.233 32673 32673 W crash_dump32: failed to fetch registers for thread 32644: I/O error
  11-20 12:15:48.234 32673 32673 W crash_dump32: failed to fetch registers for thread 32645: I/O error
  11-20 12:15:48.234 32673 32673 W crash_dump32: failed to fetch registers for thread 32646: I/O error
  11-20 12:15:48.235 32673 32673 W crash_dump32: failed to fetch registers for thread 32647: I/O error
  11-20 12:15:48.235 32673 32673 W crash_dump32: failed to fetch registers for thread 32648: I/O error
  11-20 12:15:48.235 32673 32673 W crash_dump32: failed to fetch registers for thread 32649: I/O error
  11-20 12:15:48.236 32673 32673 W crash_dump32: failed to fetch registers for thread 32650: I/O error
  11-20 12:15:48.236 32673 32673 W crash_dump32: failed to fetch registers for thread 32657: I/O error
  11-20 12:15:48.236 32673 32673 W crash_dump32: failed to fetch registers for thread 32658: I/O error
  11-20 12:15:48.237 32673 32673 W crash_dump32: failed to fetch registers for thread 32659: I/O error
  11-20 12:15:48.237 32673 32673 W crash_dump32: failed to fetch registers for thread 32660: I/O error
  11-20 12:15:48.237 32673 32673 W crash_dump32: failed to fetch registers for thread 32661: I/O error
  11-20 12:15:48.238 32673 32673 W crash_dump32: failed to fetch registers for thread 32662: I/O error
  11-20 12:15:48.238 32673 32673 W crash_dump32: failed to fetch registers for thread 32664: I/O error
  11-20 12:15:48.239 32673 32673 W crash_dump32: failed to fetch registers for thread 32665: I/O error
  11-20 12:15:48.275 32673 32673 I crash_dump32: obtaining output fd from tombstoned, type: kDebuggerdTombstone
  11-20 12:15:48.277   319   319 I /system/bin/tombstoned: received crash request for pid 32666
  11-20 12:15:48.278 32673 32673 I crash_dump32: performing dump of process 32620 (target tid = 32666)
  11-20 12:15:48.371 32673 32673 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
  11-20 12:15:48.372 32673 32673 F DEBUG   : LineageOS Version: '16.0-20181120-UNOFFICIAL-odin'
  11-20 12:15:48.372 32673 32673 F DEBUG   : Build fingerprint: 'Sony/C6503/C6503:5.1.1/10.7.A.0.228/3219080026:user/release-keys'
  11-20 12:15:48.372 32673 32673 F DEBUG   : Revision: '0'
  11-20 12:15:48.372 32673 32673 F DEBUG   : ABI: 'arm'
  11-20 12:15:48.372 32673 32673 F DEBUG   : pid: 32620, tid: 32666, name: btu message loo  &gt;&gt;&gt; com.android.bluetooth &lt;&lt;&lt;
  11-20 12:15:48.373 32673 32673 F DEBUG   : signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
  11-20 12:15:48.373 32673 32673 F DEBUG   : Abort message: '[FATAL:btm_ble_gap.cc(488)] Check failed: p_vcs_cplt_params-&gt;opcode == HCI_BLE_VENDOR_CAP_OCF.
  11-20 12:15:48.373 32673 32673 F DEBUG   : '
  11-20 12:15:48.373 32673 32673 F DEBUG   :     r0  00000000  r1  00007f9a  r2  00000006  r3  00000008
  11-20 12:15:48.373 32673 32673 F DEBUG   :     r4  00007f6c  r5  00007f9a  r6  936e796c  r7  0000010c
  11-20 12:15:48.373 32673 32673 F DEBUG   :     r8  936e79a4  r9  936e7df4  r10 936e7998  r11 936e7df0
  11-20 12:15:48.374 32673 32673 F DEBUG   :     ip  00000041  sp  936e7958  lr  af831065  pc  af828d8e
  11-20 12:15:48.639 32673 32673 F DEBUG   :
  11-20 12:15:48.639 32673 32673 F DEBUG   : backtrace:
  11-20 12:15:48.639 32673 32673 F DEBUG   :     #00 pc 0001cd8e  /system/lib/libc.so (abort+58)
  11-20 12:15:48.639 32673 32673 F DEBUG   :     #01 pc 0007b5d7  /system/lib/libchrome.so (base::debug::BreakDebugger()+10)
  11-20 12:15:48.639 32673 32673 F DEBUG   :     #02 pc 0008b2ff  /system/lib/libchrome.so (logging::LogMessage::~LogMessage()+746)
  11-20 12:15:48.639 32673 32673 F DEBUG   :     #03 pc 0014606f  /system/lib/libbluetooth.so (btm_ble_vendor_capability_vsc_cmpl_cback(tBTM_VSC_CMPL*)+78)
  11-20 12:15:48.640 32673 32673 F DEBUG   :     #04 pc 001505f3  /system/lib/libbluetooth.so (btm_vsc_complete(unsigned char*, unsigned short, unsigned short, void (*)(tBTM_VSC_CMPL*))+38)
  11-20 12:15:48.640 32673 32673 F DEBUG   :     #05 pc 00160769  /system/lib/libbluetooth.so (btu_hcif_command_complete_evt_on_task(BT_HDR*, void*)+440)
  11-20 12:15:48.640 32673 32673 F DEBUG   :     #06 pc 0007c503  /system/lib/libchrome.so (base::debug::TaskAnnotator::RunTask(char const*, base::PendingTask*)+162)
  11-20 12:15:48.640 32673 32673 F DEBUG   :     #07 pc 0008e145  /system/lib/libchrome.so (base::MessageLoop::RunTask(base::PendingTask*)+324)
  11-20 12:15:48.641 32673 32673 F DEBUG   :     #08 pc 0008e37b  /system/lib/libchrome.so (base::MessageLoop::DeferOrRunPendingTask(base::PendingTask)+26)
  11-20 12:15:48.641 32673 32673 F DEBUG   :     #09 pc 0008e61f  /system/lib/libchrome.so (base::MessageLoop::DoWork()+218)
  11-20 12:15:48.641 32673 32673 F DEBUG   :     #10 pc 0008f313  /system/lib/libchrome.so (base::MessagePumpDefault::Run(base::MessagePump::Delegate*)+98)
  11-20 12:15:48.641 32673 32673 F DEBUG   :     #11 pc 0008df2f  /system/lib/libchrome.so (base::MessageLoop::RunHandler()+62)
  11-20 12:15:48.641 32673 32673 F DEBUG   :     #12 pc 000a1cad  /system/lib/libchrome.so (base::RunLoop::Run()+80)
  11-20 12:15:48.642 32673 32673 F DEBUG   :     #13 pc 00160c0d  /system/lib/libbluetooth.so (btu_message_loop_run(void*)+188)
  11-20 12:15:48.642 32673 32673 F DEBUG   :     #14 pc 001b1181  /system/lib/libbluetooth.so (work_queue_read_cb(void*)+52)
  11-20 12:15:48.642 32673 32673 F DEBUG   :     #15 pc 001afd3b  /system/lib/libbluetooth.so (run_reactor(reactor_t*, int)+218)
  11-20 12:15:48.642 32673 32673 F DEBUG   :     #16 pc 001afc35  /system/lib/libbluetooth.so (reactor_start(reactor_t*)+44)
  11-20 12:15:48.642 32673 32673 F DEBUG   :     #17 pc 001b0dd3  /system/lib/libbluetooth.so (run_thread(void*)+142)
  11-20 12:15:48.642 32673 32673 F DEBUG   :     #18 pc 00064a23  /system/lib/libc.so (__pthread_start(void*)+22)
  11-20 12:15:48.643 32673 32673 F DEBUG   :     #19 pc 0001dfa5  /system/lib/libc.so (__start_thread+32)
  11-20 12:15:49.121   319   319 E /system/bin/tombstoned: Tombstone written to: /data/tombstones/tombstone_15
  11-20 12:15:49.162   621   676 I BootReceiver: Copying /data/tombstones/tombstone_15 to DropBox (SYSTEM_TOMBSTONE)
  11-20 12:15:49.173   621   670 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.stats.service.DropBoxEntryAddedReceiver
  11-20 12:15:49.173   621   670 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.chimera.GmsIntentOperationService$PersistentTrustedReceiver
  11-20 12:15:49.221   621   621 D BluetoothManagerService: BluetoothServiceConnection, disconnected:
  </code></pre>
  
  <p>I can't really fit the whole thing here, so here's a pastebin: <a href="https://pastebin.com/GR94xmpF" rel="nofollow noreferrer">https://pastebin.com/GR94xmpF</a></p>
  
  <p>Anyways, this is my first time building an unofficial version of LineageOS, so I am not that familiar with everything. However, I am willing to do anything to get it to work. Thank you in advance for any advice :)</p>