summaryrefslogtreecommitdiffstats
path: root/btif
diff options
context:
space:
mode:
authorSyed Ibrahim M <syedibra@broadcom.com>2012-07-10 12:01:05 +0530
committerMatthew Xie <mattx@google.com>2012-07-25 01:12:17 -0700
commitfb8fb016214e6e454028ec4073085ad0eb599a10 (patch)
tree4e142feb2c41a99851d6886e12248b94d21eb882 /btif
parent34242195e584331abc22e5113a48150dc678c8b6 (diff)
downloadexternal_bluetooth_bluedroid-fb8fb016214e6e454028ec4073085ad0eb599a10.zip
external_bluetooth_bluedroid-fb8fb016214e6e454028ec4073085ad0eb599a10.tar.gz
external_bluetooth_bluedroid-fb8fb016214e6e454028ec4073085ad0eb599a10.tar.bz2
Fix for updating correct COD value after pairing
Set the correct pointer to properties[] array before sending HAL callback for remote_device_properties_cb Change-Id: I199566d5f4b5997aad6a5b2ca83b67c9b1bd108b
Diffstat (limited to 'btif')
-rw-r--r--btif/src/btif_dm.c39
1 files changed, 19 insertions, 20 deletions
diff --git a/btif/src/btif_dm.c b/btif/src/btif_dm.c
index 265a834..4b43b6a 100644
--- a/btif/src/btif_dm.c
+++ b/btif/src/btif_dm.c
@@ -298,7 +298,10 @@ static void btif_update_remote_properties(BD_ADDR bd_addr, BD_NAME bd_name,
bt_property_t properties[3];
bt_bdaddr_t bdaddr;
bt_status_t status;
+ UINT32 cod;
+ bt_device_type_t dev_type;
+ memset(properties, 0, sizeof(properties));
bdcpy(bdaddr.address, bd_addr);
/* remote name */
@@ -312,29 +315,25 @@ static void btif_update_remote_properties(BD_ADDR bd_addr, BD_NAME bd_name,
}
/* class of device */
- {
- UINT32 cod = devclass2uint(dev_class);
- if ( cod == 0) {
- BTIF_TRACE_DEBUG1("%s():cod is 0, set as unclassified", __FUNCTION__);
- cod = COD_UNCLASSIFIED;
- }
-
- BTIF_STORAGE_FILL_PROPERTY(&properties[num_properties],
- BT_PROPERTY_CLASS_OF_DEVICE, sizeof(cod), &cod);
- status = btif_storage_set_remote_device_property(&bdaddr, &properties[num_properties]);
- ASSERTC(status == BT_STATUS_SUCCESS, "failed to save remote device class", status);
- num_properties++;
+ cod = devclass2uint(dev_class);
+ if ( cod == 0) {
+ BTIF_TRACE_DEBUG1("%s():cod is 0, set as unclassified", __FUNCTION__);
+ cod = COD_UNCLASSIFIED;
}
+ BTIF_STORAGE_FILL_PROPERTY(&properties[num_properties],
+ BT_PROPERTY_CLASS_OF_DEVICE, sizeof(cod), &cod);
+ status = btif_storage_set_remote_device_property(&bdaddr, &properties[num_properties]);
+ ASSERTC(status == BT_STATUS_SUCCESS, "failed to save remote device class", status);
+ num_properties++;
+
/* device type */
- {
- bt_device_type_t dev_type = device_type;
- BTIF_STORAGE_FILL_PROPERTY(&properties[num_properties],
- BT_PROPERTY_TYPE_OF_DEVICE, sizeof(dev_type), &dev_type);
- status = btif_storage_set_remote_device_property(&bdaddr, &properties[num_properties]);
- ASSERTC(status == BT_STATUS_SUCCESS, "failed to save remote device type", status);
- num_properties++;
- }
+ dev_type = device_type;
+ BTIF_STORAGE_FILL_PROPERTY(&properties[num_properties],
+ BT_PROPERTY_TYPE_OF_DEVICE, sizeof(dev_type), &dev_type);
+ status = btif_storage_set_remote_device_property(&bdaddr, &properties[num_properties]);
+ ASSERTC(status == BT_STATUS_SUCCESS, "failed to save remote device type", status);
+ num_properties++;
HAL_CBACK(bt_hal_cbacks, remote_device_properties_cb,
status, &bdaddr, num_properties, properties);