B2G/Bluetooth-bluedroid: Difference between revisions

From MozillaWiki
< B2G
Jump to navigation Jump to search
Line 70: Line 70:
libbt-vendors.so.
libbt-vendors.so.


For Qct chipset, power on Bluetooth chipset still depends on "/sytem/etc/init.qcom.bt.sh". See hardware/qcom/bt/libbt-vendor/src/hardware.c, function hw_config()
For Qct chipsets, power on Bluetooth chipset still depends on "/sytem/etc/init.qcom.bt.sh". See hardware/qcom/bt/libbt-vendor/src/hardware.c, function hw_config().
 
For bcm chipsets, device/common/libbt/include/vnd_machinename.txt, defines UART port and firmware patchram location
You need to also make sure /sytem/etc/init.qcom.bt.sh can be executed
You need to also make sure /sytem/etc/init.qcom.bt.sh can be executed
bluedroid config path:<br>
bluedroid config path:<br>

Revision as of 07:00, 30 August 2013

Bluetooth interfaces

  • bt_interface_t
    • See: external/bluetooth/bluedroid/btif/src/bluetooth.c
    • You need to use |get_bluetooth_interface()| to access all avaiable GAP profile functions.
  • HFP, A2DP profile interfaces, you need to call |get_profile_interface()| to access profile interfaces

Some notes about gonk-jb bluedroid stack:

What do we care about?
HAL API all exposed in hardware/libhardware/include/hardware/, bluetooth.h defines all BluetoothAdapter needed. In general bluedroid apis are callback instead of dbus style programming.

GAP profile: external/bluetooth/bluedroid/btif/src/btif_dm.c

Important data structures: bt_property_t.

For "device found" callback, possible properties from device_found are:
properties[1]. type = BT_PROPERTY_BDNAME
properties[2]. type = BT_PROPERTY_BDADDR
properties[4]. type = BT_PROPERTY_CLASS_OF_DEVICE
properties[5]. type = BT_PROPERTY_TYPE_OF_DEVICE
properties[11]. type = BT_PROPERTY_REMOTE_RSSI

Adapter property maps to: sBluetoothInterface->get_adapter_property((bt_property_type_t) type) adapter_properties_callback

For adapter/remote device properties type, check btif/src/btif_storage.c, function cfg2prop.

Debugging:

In /system/etc/bluetooth/bt_stack.conf defined logging level and logger output.


# Enable BtSnoop logging function
# valid value : true, false
BtSnoopLogOutput=true
# BtSnoop log output file
BtSnoopFileName=/sdcard/btsnoop_hci.log
In /system/etc/bluetooth/bt_stack.conf defined
logging level, this effected what we saw in logcat


# Trace level configuration
# BT_TRACE_LEVEL_NONE 0 ( No trace messages to be generated )
# BT_TRACE_LEVEL_ERROR 1 ( Error condition trace messages )
# BT_TRACE_LEVEL_WARNING 2 ( Warning condition trace messages )
# BT_TRACE_LEVEL_API 3 ( API traces )
# BT_TRACE_LEVEL_EVENT 4 ( Debug messages for events )
# BT_TRACE_LEVEL_DEBUG 5 ( Full debug messages )
TRC_HCI=2 TRC_L2CAP=2 TRC_RFCOMM=2


Porting

Nexus 4 Porting: Make sure qct libbt-vendor had been compiled so you will see libbt-vendor.so in the device.
Path is /system/vendor/lib/libbt-vendor.so libbt-vendor source code is in: hardware/qcom/bt/libbt-vendor You need to make sure the following .so files are in Nexus 4.
/system/lib/libbt-hci.so, libbt-utils.so
/system/lib/hw/audio.a2dp.default.so, bluetooth.default.so
/system/vendor/lib/libbt-vendor.so

For bcm chipset, source code in device/common/libbt (Vendor specific folder) which generates libbt-vendors.so.

For Qct chipsets, power on Bluetooth chipset still depends on "/sytem/etc/init.qcom.bt.sh". See hardware/qcom/bt/libbt-vendor/src/hardware.c, function hw_config().

For bcm chipsets, device/common/libbt/include/vnd_machinename.txt, defines UART port and firmware patchram location You need to also make sure /sytem/etc/init.qcom.bt.sh can be executed bluedroid config path:
/etc/bluetooth/bt_stack.conf <br> /etc/bluetooth/bt_did.conf <br> /etc/bluetooth/auto_pair_devlist.conf <br> bluedroid storage path:
All path stores in:
/data/misc/bluedroid
/data/misc/bluedroid/bt_config.xml
The format of bt_config.xml
Sample:

   <N21 Tag="84:7a:88:fe:7e:f6">
           <N1 Tag="Timestamp" Type="int">1372749957</N1>
           <N2 Tag="Name" Type="string">unagi plus</N2>
           <N3 Tag="DevClass" Type="int">5898764</N3>
           <N4 Tag="DevType" Type="int">1</N4>
           <N5 Tag="LinkKeyType" Type="int">5</N5>
           <N6 Tag="PinLength" Type="int">0</N6>
           <N7 Tag="LinkKey" Type="binary">a6a59a57c4effbcc432af4e2d21def9e</N7>
           <N8 Tag="Service" Type="string">0000110a-0000-1000-8000-00805f9b34fb 00001105-0000-1000-8000-00805f9b34fb 00001116-0000-1000-8000-00805f9b34fb 0000112f-0000-1000-8000-00805f9b34fb 00001112-0000-1000-8000-00805f9b34fb 0000111f-0000-1000-8000-00805f9b34fb 00001132-0000-1000-8000-00805f9b34fb 00006675-7475-7265-6469-616c62756d70 </N8>
   </N21>

What remote_device_properties_callback returns records such as:

   BD Name - Bluetooth Device Name
   Remote friendly name - User defined friendly name of the remote device
   Class - Bluetooth Class of Device as found in Assigned Numbers 
   Type - Device Type - BREDR, BLE or DUAL Mode
   Bluetooth Service 128-bit UUIDs