summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSyed Ibrahim M <syedibra@broadcom.com>2012-05-28 18:28:23 +0530
committerMatthew Xie <mattx@google.com>2012-07-14 11:19:21 -0700
commit001b6bbb50d8d371015efc12401ae1a2014b5f20 (patch)
tree806898e1b5542c0bb2beee1f82933fec64bc5a2c
parent4583aa99e8985f15f81c3e069a29ac0fa7cc1f83 (diff)
downloadexternal_bluetooth_bluedroid-001b6bbb50d8d371015efc12401ae1a2014b5f20.zip
external_bluetooth_bluedroid-001b6bbb50d8d371015efc12401ae1a2014b5f20.tar.gz
external_bluetooth_bluedroid-001b6bbb50d8d371015efc12401ae1a2014b5f20.tar.bz2
Modified the BT stack to check for HID_VIRTUAL_UNPLUG SDP attribute and send a virtual unplug for all HID devices for device disconnect event;
Change-Id: I0068958800103037998eeaa01a45aad1f1605729
-rw-r--r--bta/hh/bta_hh_act.c3
-rw-r--r--bta/include/bta_hh_api.h1
-rwxr-xr-xbtif/src/btif_dm.c10
-rwxr-xr-xbtif/src/btif_hh.c5
4 files changed, 14 insertions, 5 deletions
diff --git a/bta/hh/bta_hh_act.c b/bta/hh/bta_hh_act.c
index 163597e..0b771ab 100644
--- a/bta/hh/bta_hh_act.c
+++ b/bta/hh/bta_hh_act.c
@@ -873,12 +873,14 @@ void bta_hh_maint_dev_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
p_dev_info->app_id);
/* update cb_index[] map */
bta_hh_cb.cb_index[dev_handle] = p_cb->index;
+ dev_info.attr_mask = p_dev_info->attr_mask;
}
}
else /* device already been added */
{
dev_info.handle = p_cb->hid_handle;
dev_info.status = BTA_HH_OK;
+ dev_info.attr_mask = p_dev_info->attr_mask;
}
#if BTA_HH_DEBUG
bta_hh_trace_dev_db();
@@ -899,6 +901,7 @@ void bta_hh_maint_dev_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
bta_hh_clean_up_kdev(p_cb);
}
}
+ dev_info.attr_mask = 0; /* Reset the attribute mask */
break;
default:
diff --git a/bta/include/bta_hh_api.h b/bta/include/bta_hh_api.h
index dd9a528..7be05db 100644
--- a/bta/include/bta_hh_api.h
+++ b/bta/include/bta_hh_api.h
@@ -173,6 +173,7 @@ typedef struct
BD_ADDR bda; /* HID device bd address */
tBTA_HH_STATUS status; /* operation status */
UINT8 handle; /* device handle */
+ UINT16 attr_mask; /* HID Device attribute Mask*/
} tBTA_HH_CONN;
typedef tBTA_HH_CONN tBTA_HH_DEV_INFO;
diff --git a/btif/src/btif_dm.c b/btif/src/btif_dm.c
index da37db5..422927c 100755
--- a/btif/src/btif_dm.c
+++ b/btif/src/btif_dm.c
@@ -362,11 +362,11 @@ static void btif_dm_cb_hid_remote_name(tBTM_REMOTE_DEV_NAME *p_remote_name)
int remove_hid_bond(bt_bdaddr_t *bd_addr)
{
- /* For HID mouse,we did connection before pairing
- * so we need to do virtual unplug
+ /* For HID device, inorder to avoid the HID device from re-connecting again after unpairing,
+ * we need to do virtual unplug
*/
bdstr_t bdstr;
- BTIF_TRACE_DEBUG2("%s---Removing HID mouse bond--%s", __FUNCTION__,bd2str((bt_bdaddr_t *)bd_addr, &bdstr));
+ BTIF_TRACE_DEBUG2("%s---Removing HID bond--%s", __FUNCTION__,bd2str((bt_bdaddr_t *)bd_addr, &bdstr));
return btif_hh_virtual_unpug(bd_addr);
}
/*******************************************************************************
@@ -410,7 +410,9 @@ void btif_dm_cb_remove_bond(bt_bdaddr_t *bd_addr)
{
bdstr_t bdstr;
/*special handling for HID devices */
- if (check_cod(bd_addr, COD_HID_POINTING))
+ if (check_cod(bd_addr, COD_HID_POINTING) ||
+ check_cod(bd_addr, COD_HID_KEYBOARD) ||
+ check_cod(bd_addr, COD_HID_COMBO))
{
#if (defined(BTA_HH_INCLUDED) && (BTA_HH_INCLUDED == TRUE))
if(remove_hid_bond(bd_addr) != BTA_SUCCESS)
diff --git a/btif/src/btif_hh.c b/btif/src/btif_hh.c
index ef1e907..c9aa530 100755
--- a/btif/src/btif_hh.c
+++ b/btif/src/btif_hh.c
@@ -400,7 +400,9 @@ bt_status_t btif_hh_virtual_unpug(bt_bdaddr_t *bd_addr)
bd_addr->address[0], bd_addr->address[1], bd_addr->address[2], bd_addr->address[3],
bd_addr->address[4], bd_addr->address[5]);
p_dev = btif_hh_find_dev_by_bda(bd_addr);
- if ((p_dev != NULL) && (p_dev->dev_status == BTHH_CONN_STATE_CONNECTED))
+ BTIF_TRACE_DEBUG2("%s mask : 0x%x", __func__, p_dev->attr_mask);
+ if ((p_dev != NULL) && (p_dev->dev_status == BTHH_CONN_STATE_CONNECTED)
+ && (p_dev->attr_mask & HID_VIRTUAL_CABLE))
{
BTIF_TRACE_DEBUG1("%s Sending BTA_HH_CTRL_VIRTUAL_CABLE_UNPLUG", __FUNCTION__);
BTA_HhSendCtrl(p_dev->dev_handle, BTA_HH_CTRL_VIRTUAL_CABLE_UNPLUG);
@@ -751,6 +753,7 @@ static void btif_hh_upstreams_evt(UINT16 event, char* p_param)
if (memcmp(btif_hh_cb.added_devices[i].bd_addr.address, p_data->dev_info.bda, 6) == 0) {
if (p_data->dev_info.status == BTA_HH_OK) {
btif_hh_cb.added_devices[i].dev_handle = p_data->dev_info.handle;
+ btif_hh_cb.added_devices[i].attr_mask = p_data->dev_info.attr_mask;
}
else {
memset(btif_hh_cb.added_devices[i].bd_addr.address, 0, 6);