diff options
author | Mike J. Chen <mjchen@google.com> | 2014-01-28 20:40:47 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-01-28 20:40:47 +0000 |
commit | e372d9b58a288348782d01f534cf6dc81a7934c7 (patch) | |
tree | 6c10a61066b23c2418ba26b14a2b958225c24f19 | |
parent | 7edcc0619bde20dbafa9487ff74c056ce1e6e507 (diff) | |
parent | b46d9b899f5e28929c8530cb99d023c93e5d5cb8 (diff) | |
download | android_system_bt-e372d9b58a288348782d01f534cf6dc81a7934c7.tar.gz android_system_bt-e372d9b58a288348782d01f534cf6dc81a7934c7.tar.bz2 android_system_bt-e372d9b58a288348782d01f534cf6dc81a7934c7.zip |
Merge "Fix HID get_report callback support" into klp-modular-dev
-rw-r--r-- | btif/src/btif_hh.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/btif/src/btif_hh.c b/btif/src/btif_hh.c index 8faa9f5db..1aca7df0d 100644 --- a/btif/src/btif_hh.c +++ b/btif/src/btif_hh.c @@ -878,14 +878,28 @@ static void btif_hh_upstreams_evt(UINT16 event, char* p_param) BTIF_TRACE_WARNING1("Error: cannot find device with handle %d", p_data->dev_status.handle); } break; - case BTA_HH_GET_RPT_EVT: + case BTA_HH_GET_RPT_EVT: { + BT_HDR *hdr = p_data->hs_data.rsp_data.p_rpt_data; + UINT8 *data = NULL; + UINT16 len = 0; + BTIF_TRACE_DEBUG2("BTA_HH_GET_RPT_EVT: status = %d, handle = %d", p_data->hs_data.status, p_data->hs_data.handle); - p_dev = btif_hh_find_connected_dev_by_handle(p_data->conn.handle); - HAL_CBACK(bt_hh_callbacks, get_report_cb,(bt_bdaddr_t*) &(p_dev->bd_addr), (bthh_status_t) p_data->hs_data.status, - (uint8_t*) p_data->hs_data.rsp_data.p_rpt_data, BT_HDR_SIZE); + /* p_rpt_data in HANDSHAKE response case */ + if (hdr) { + data = (UINT8 *)(hdr + 1) + hdr->offset; + len = hdr->len; + } + p_dev = btif_hh_find_connected_dev_by_handle(p_data->hs_data.handle); + if (p_dev) { + HAL_CBACK(bt_hh_callbacks, get_report_cb, + (bt_bdaddr_t*) &(p_dev->bd_addr), + (bthh_status_t) p_data->hs_data.status, data, len); + } else { + BTIF_TRACE_WARNING1("Error: cannot find device with handle %d", p_data->hs_data.handle); + } break; - + } case BTA_HH_SET_RPT_EVT: BTIF_TRACE_DEBUG2("BTA_HH_SET_RPT_EVT: status = %d, handle = %d", p_data->dev_status.status, p_data->dev_status.handle); @@ -1477,6 +1491,7 @@ static bt_status_t get_protocol (bt_bdaddr_t *bd_addr, bthh_protocol_mode_t prot p_dev = btif_hh_find_connected_dev_by_bda(bd_addr); if (p_dev != NULL) { + BTA_HhGetProtoMode(p_dev->dev_handle); } else { |