B2G/Bluetooth-bluedroid: Difference between revisions
Shawn huang (talk | contribs) (Some notes about gonk-jb bluedroid stack) |
Shawn huang (talk | contribs) No edit summary |
||
| Line 10: | Line 10: | ||
For "device found" | For "device found" | ||
Possible properties from device_found are: | Possible properties from device_found are: | ||
properties[2]. type = BT_PROPERTY_BDADDR | properties[2]. type = BT_PROPERTY_BDADDR | ||
properties[1]. type = BT_PROPERTY_BDNAME | properties[1]. type = BT_PROPERTY_BDNAME | ||
| Line 15: | Line 16: | ||
properties[5]. type = BT_PROPERTY_TYPE_OF_DEVICE | properties[5]. type = BT_PROPERTY_TYPE_OF_DEVICE | ||
properties[11]. type = BT_PROPERTY_REMOTE_RSSI | properties[11]. type = BT_PROPERTY_REMOTE_RSSI | ||
Adapter property maps to: | Adapter property maps to: | ||
sBluetoothInterface->get_adapter_property((bt_property_type_t) type) | sBluetoothInterface->get_adapter_property((bt_property_type_t) type) | ||
| Line 22: | Line 24: | ||
In /system/etc/bluetooth/bt_stack.conf defined logging level and logger output. | In /system/etc/bluetooth/bt_stack.conf defined logging level and logger output. | ||
---- | |||
# Enable BtSnoop logging function | # Enable BtSnoop logging function | ||
# valid value : true, false | # valid value : true, false | ||
| Line 29: | Line 34: | ||
In /system/etc/bluetooth/bt_stack.conf defined | In /system/etc/bluetooth/bt_stack.conf defined | ||
logging level, this effected what we saw in logcat | logging level, this effected what we saw in logcat | ||
---- | |||
# Trace level configuration | # Trace level configuration | ||
# BT_TRACE_LEVEL_NONE 0 ( No trace messages to be generated ) | # BT_TRACE_LEVEL_NONE 0 ( No trace messages to be generated ) | ||
| Line 39: | Line 47: | ||
TRC_L2CAP=2 | TRC_L2CAP=2 | ||
TRC_RFCOMM=2 | TRC_RFCOMM=2 | ||
---- | |||
'''Nexus 4 Porting:''' | '''Nexus 4 Porting:''' | ||
| Line 63: | Line 73: | ||
Sample: | Sample: | ||
<N21 Tag="84:7a:88:fe:7e:f6"> | |||
<N1 Tag="Timestamp" Type="int">1372749957</N1> | <N1 Tag="Timestamp" Type="int">1372749957</N1> | ||
<N2 Tag="Name" Type="string">unagi plus</N2> | <N2 Tag="Name" Type="string">unagi plus</N2> | ||
| Line 72: | Line 83: | ||
<N7 Tag="LinkKey" Type="binary">a6a59a57c4effbcc432af4e2d21def9e</N7> | <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> | <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: | What remote_device_properties_callback returns records such as: | ||
Revision as of 06:21, 16 July 2013
Some notes about gonk-jb bluedroid stack: What do we care about? HAL API all exposed in hardware/bluetooth.h 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" Possible properties from device_found are:
properties[2]. type = BT_PROPERTY_BDADDR properties[1]. type = BT_PROPERTY_BDNAME 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
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
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 Qct chipset, power on Bluetooth chipset still depends on "/sytem/etc/init.qcom.bt.sh". You need to also make sure /sytem/etc/init.qcom.bt.sh can be executed bluedroid config path: /etc/bluetooth/bt_stack.conf /etc/bluetooth/bt_did.conf /etc/bluetooth/auto_pair_devlist.conf 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