summaryrefslogtreecommitdiffstats
path: root/bta/hh
diff options
context:
space:
mode:
Diffstat (limited to 'bta/hh')
-rw-r--r--[-rwxr-xr-x]bta/hh/bta_hh_act.c236
-rw-r--r--bta/hh/bta_hh_api.c90
-rw-r--r--bta/hh/bta_hh_cfg.c35
-rw-r--r--bta/hh/bta_hh_int.h63
-rw-r--r--bta/hh/bta_hh_main.c72
-rw-r--r--bta/hh/bta_hh_utils.c31
6 files changed, 299 insertions, 228 deletions
diff --git a/bta/hh/bta_hh_act.c b/bta/hh/bta_hh_act.c
index 163597e..e594200 100755..100644
--- a/bta/hh/bta_hh_act.c
+++ b/bta/hh/bta_hh_act.c
@@ -1,14 +1,26 @@
-/*****************************************************************************
-**
-** Name: bta_hh_act.c
-**
-** Description: This file contains the HID host action
-** functions.
-**
-** Copyright (c) 2005-2011, Broadcom Corp, All Rights Reserved.
-** Broadcom Bluetooth Core. Proprietary and confidential.
-**
-*****************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 2005-2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * This file contains the HID host action functions.
+ *
+ ******************************************************************************/
#include "bt_target.h"
@@ -30,7 +42,7 @@
/*****************************************************************************
** Local Function prototypes
*****************************************************************************/
-static void bta_hh_cback (UINT8 dev_handle, UINT8 event, UINT32 data,
+static void bta_hh_cback (UINT8 dev_handle, UINT8 event, UINT32 data,
BT_HDR *pdata);
static tBTA_HH_STATUS bta_hh_get_trans_status(UINT32 result);
@@ -47,7 +59,7 @@ static char * bta_hh_hid_event_name(UINT16 event);
** Function bta_hh_api_enable
**
** Description Perform necessary operations to enable HID host.
-**
+**
**
** Returns void
**
@@ -56,7 +68,7 @@ void bta_hh_api_enable(tBTA_HH_DATA *p_data)
{
tBTA_HH_STATUS status = BTA_HH_ERR;
UINT8 xx;
-
+
/* initialize BTE HID */
HID_HostInit();
@@ -79,9 +91,9 @@ void bta_hh_api_enable(tBTA_HH_DATA *p_data)
bta_hh_cb.kdev[xx].index = xx;
/* initialize control block map */
bta_hh_cb.cb_index[xx] = BTA_HH_MAX_KNOWN;
- }
+ }
}
-
+
/* signal BTA call back event */
(* bta_hh_cb.p_cback)(BTA_HH_ENABLE_EVT, (tBTA_HH *)&status);
}
@@ -90,7 +102,7 @@ void bta_hh_api_enable(tBTA_HH_DATA *p_data)
** Function bta_hh_api_disable
**
** Description Perform necessary operations to disable HID host.
-**
+**
**
** Returns void
**
@@ -98,7 +110,7 @@ void bta_hh_api_enable(tBTA_HH_DATA *p_data)
void bta_hh_api_disable(void)
{
UINT8 xx;
-
+
/* service is not enabled */
if (bta_hh_cb.p_cback == NULL)
return;
@@ -118,13 +130,13 @@ void bta_hh_api_disable(void)
if ( bta_hh_cb.kdev[xx].state == BTA_HH_CONN_ST )
{
/* disconnect all connected devices */
- bta_hh_sm_execute(&bta_hh_cb.kdev[xx],
+ bta_hh_sm_execute(&bta_hh_cb.kdev[xx],
BTA_HH_API_CLOSE_EVT,
NULL);
}
}
}
-
+
return;
}
@@ -133,7 +145,7 @@ void bta_hh_api_disable(void)
** Function bta_hh_disc_cmpl
**
** Description All connections have been closed, disable service.
-**
+**
**
** Returns void
**
@@ -167,7 +179,7 @@ void bta_hh_disc_cmpl(void)
** Returns void
**
*******************************************************************************/
-static void bta_hh_sdp_cback(UINT16 result, UINT16 attr_mask,
+static void bta_hh_sdp_cback(UINT16 result, UINT16 attr_mask,
tHID_DEV_SDP_INFO *sdp_rec )
{
tBTA_HH_DEV_CB *p_cb = bta_hh_cb.p_cur;
@@ -178,7 +190,7 @@ static void bta_hh_sdp_cback(UINT16 result, UINT16 attr_mask,
if (result == SDP_SUCCESS)
{
/* security is required for the connection, add attr_mask bit*/
- if (p_cb->sec_mask)
+ if (p_cb->sec_mask)
attr_mask |= HID_SEC_REQUIRED;
#if BTA_HH_DEBUG
@@ -186,9 +198,9 @@ static void bta_hh_sdp_cback(UINT16 result, UINT16 attr_mask,
attr_mask 0x%02x", \
p_cb, result, attr_mask);
#endif
-
+
/* check to see type of device is supported , and should not been added before */
- if (bta_hh_tod_spt(p_cb, sdp_rec->sub_class))
+ if (bta_hh_tod_spt(p_cb, sdp_rec->sub_class))
{
/* if not added before */
if (p_cb->hid_handle == BTA_HH_INVALID_HANDLE)
@@ -197,23 +209,23 @@ static void bta_hh_sdp_cback(UINT16 result, UINT16 attr_mask,
if((status = HID_HostAddDev (p_cb->addr, attr_mask, &hdl)) == HID_SUCCESS)
{
/* update cb_index[] map */
- bta_hh_cb.cb_index[hdl] = p_cb->index;
+ bta_hh_cb.cb_index[hdl] = p_cb->index;
}
else
- p_cb->app_id = 0;
+ p_cb->app_id = 0;
}
/* else : incoming connection after SDP should update the SDP information as well */
if (p_cb->app_id != 0)
{
/* update cb information with attr_mask, dscp_info etc. */
- bta_hh_add_device_to_list(p_cb, hdl, attr_mask,
- &sdp_rec->dscp_info,
- sdp_rec->sub_class,
+ bta_hh_add_device_to_list(p_cb, hdl, attr_mask,
+ &sdp_rec->dscp_info,
+ sdp_rec->sub_class,
sdp_rec->ssr_max_latency,
sdp_rec->ssr_min_tout,
- p_cb->app_id);
-
+ p_cb->app_id);
+
p_cb->dscp_info.ctry_code = sdp_rec->ctry_code;
status = HID_SUCCESS;
@@ -226,11 +238,11 @@ static void bta_hh_sdp_cback(UINT16 result, UINT16 attr_mask,
/* free disc_db when SDP is completed */
utl_freebuf((void **)&bta_hh_cb.p_disc_db);
-
+
/* send SDP_CMPL_EVT into state machine */
bta_hh_sm_execute(p_cb, BTA_HH_SDP_CMPL_EVT, (tBTA_HH_DATA *)&status);
-
+
return;
}
/*******************************************************************************
@@ -262,12 +274,12 @@ static void bta_hh_di_sdp_cback(UINT16 result)
bta_hh_update_di_info(p_cb, di_rec.rec.vendor, di_rec.rec.product, di_rec.rec.version);
}
}
- if ((status = HID_HostGetSDPRecord(p_cb->addr,
- bta_hh_cb.p_disc_db,
- p_bta_hh_cfg->sdp_db_size,
+ if ((status = HID_HostGetSDPRecord(p_cb->addr,
+ bta_hh_cb.p_disc_db,
+ p_bta_hh_cfg->sdp_db_size,
bta_hh_sdp_cback)) != HID_SUCCESS)
{
-#if BTA_HH_DEBUG
+#if BTA_HH_DEBUG
APPL_TRACE_DEBUG1 ("bta_hh_di_sdp_cback: HID_HostGetSDPRecord failed: \
Status 0x%2X",status);
#endif
@@ -292,8 +304,8 @@ static void bta_hh_di_sdp_cback(UINT16 result)
** Function bta_hh_start_sdp
**
** Description Start SDP service search, and obtain necessary SDP records.
-** Only one SDP service search request is allowed at the same
-** time. For every BTA_HhOpen API call, do SDP first unless SDP
+** Only one SDP service search request is allowed at the same
+** time. For every BTA_HhOpen API call, do SDP first unless SDP
** has been done previously.
**
** Returns void
@@ -311,7 +323,7 @@ void bta_hh_start_sdp(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
if (p_cb->app_id)
{
status = HID_SUCCESS;
-#if BTA_HH_DEBUG
+#if BTA_HH_DEBUG
APPL_TRACE_DEBUG0("bta_hh_start_sdp:: skip SDP for known devices");
#endif
if (p_cb->hid_handle == BTA_HH_INVALID_HANDLE)
@@ -320,11 +332,11 @@ void bta_hh_start_sdp(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
== HID_SUCCESS)
{
/* update device CB with newly register device handle */
- bta_hh_add_device_to_list(p_cb, hdl, p_cb->attr_mask, NULL,
- p_cb->sub_class,
+ bta_hh_add_device_to_list(p_cb, hdl, p_cb->attr_mask, NULL,
+ p_cb->sub_class,
p_cb->dscp_info.ssr_max_latency,
- p_cb->dscp_info.ssr_min_tout,
- p_cb->app_id);
+ p_cb->dscp_info.ssr_min_tout,
+ p_cb->app_id);
/* update cb_index[] map */
bta_hh_cb.cb_index[hdl] = p_cb->index;
}
@@ -346,12 +358,12 @@ void bta_hh_start_sdp(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
{
bta_hh_cb.p_cur = p_cb;
/* do DI discovery first */
- if (SDP_DiDiscover(p_data->api_conn.bd_addr,
- bta_hh_cb.p_disc_db,
- p_bta_hh_cfg->sdp_db_size,
+ if (SDP_DiDiscover(p_data->api_conn.bd_addr,
+ bta_hh_cb.p_disc_db,
+ p_bta_hh_cfg->sdp_db_size,
bta_hh_di_sdp_cback) != SDP_SUCCESS)
{
-#if BTA_HH_DEBUG
+#if BTA_HH_DEBUG
APPL_TRACE_DEBUG1 ("bta_hh_start_sdp: SDP_DiDiscover failed: \
Status 0x%2X",status);
#endif
@@ -375,7 +387,7 @@ void bta_hh_start_sdp(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
**
** Description When SDP completed, initiate a connection or report error depend
** on SDP result.
-**
+**
**
** Returns void
**
@@ -388,7 +400,7 @@ void bta_hh_sdp_cmpl(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
#if BTA_HH_DEBUG
APPL_TRACE_DEBUG1 ("bta_hh_sdp_cmpl: status 0x%2X",p_data->status);
#endif
-
+
/* initialize call back data */
memset((void *)&conn_dat, 0, sizeof(tBTA_HH_CONN));
conn_dat.handle = p_cb->hid_handle;
@@ -397,12 +409,12 @@ void bta_hh_sdp_cmpl(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
/* if SDP compl success */
if ( (status = p_data->status) == HID_SUCCESS)
{
- /* not incoming connection doing SDP, initiate a HID connection */
+ /* not incoming connection doing SDP, initiate a HID connection */
if (!p_cb->incoming_conn)
{
/* set security level */
HID_HostSetSecurityLevel("", p_cb->sec_mask);
-
+
/* open HID connection */
if ((status = HID_HostOpenDev (p_cb->hid_handle)) != HID_SUCCESS)
{
@@ -417,11 +429,11 @@ void bta_hh_sdp_cmpl(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
}
else /* incoming connection SDP finish */
{
- bta_hh_sm_execute(p_cb, BTA_HH_OPEN_CMPL_EVT, NULL);
+ bta_hh_sm_execute(p_cb, BTA_HH_OPEN_CMPL_EVT, NULL);
}
}
- if (status != HID_SUCCESS)
+ if (status != HID_SUCCESS)
{
/* receive SDP error */
if (p_data->status == HID_ERR_INVALID)
@@ -445,7 +457,7 @@ void bta_hh_sdp_cmpl(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
bta_hh_trace_dev_db();
#endif
}
-
+
return;
}
@@ -454,7 +466,7 @@ void bta_hh_sdp_cmpl(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
** Function bta_hh_api_disc_act
**
** Description HID Host initiate a disconnection.
-**
+**
**
** Returns void
**
@@ -462,7 +474,7 @@ void bta_hh_sdp_cmpl(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
void bta_hh_api_disc_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
{
tBTA_HH_CBDATA disc_dat;
- tHID_STATUS status;
+ tHID_STATUS status;
/* found an active connection */
disc_dat.handle = p_data ?(UINT8)p_data->hdr.layer_specific :p_cb->hid_handle;
@@ -472,7 +484,7 @@ void bta_hh_api_disc_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
if (status)
(* bta_hh_cb.p_cback)(BTA_HH_CLOSE_EVT, (tBTA_HH *)&disc_dat);
-
+
return;
}
/*******************************************************************************
@@ -480,7 +492,7 @@ void bta_hh_api_disc_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
** Function bta_hh_open_cmpl_act
**
** Description HID host connection completed
-**
+**
**
** Returns void
**
@@ -499,9 +511,9 @@ void bta_hh_open_cmpl_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
bta_hh_cb.cnt_num ++;
/* initialize device driver */
- bta_hh_co_open(p_cb->hid_handle, p_cb->sub_class,
+ bta_hh_co_open(p_cb->hid_handle, p_cb->sub_class,
p_cb->attr_mask, p_cb->app_id);
-
+
/* update SSR settings */
bta_sys_chg_ssr_config(BTA_ID_HH ,p_cb->app_id, p_cb->dscp_info.ssr_max_latency, p_cb->dscp_info.ssr_min_tout);
/* inform role manager */
@@ -510,8 +522,8 @@ void bta_hh_open_cmpl_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
/* set protocol mode when not default report mode */
if (p_cb->mode != BTA_HH_PROTO_RPT_MODE)
{
- if ((conn.status = HID_HostWriteDev(dev_handle,
- HID_TRANS_SET_PROTOCOL, HID_PAR_PROTOCOL_BOOT_MODE,
+ if ((conn.status = HID_HostWriteDev(dev_handle,
+ HID_TRANS_SET_PROTOCOL, HID_PAR_PROTOCOL_BOOT_MODE,
0,
0, NULL)) != HID_SUCCESS)
{
@@ -533,7 +545,7 @@ void bta_hh_open_cmpl_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
** Function bta_hh_open_act
**
** Description HID host receive HID_OPEN_EVT .
-**
+**
**
** Returns void
**
@@ -547,7 +559,7 @@ void bta_hh_open_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
p_cb->hid_handle;
APPL_TRACE_EVENT1 ("bta_hh_open_act: Device[%d] connected", dev_handle);
-#endif
+#endif
/* SDP has been done */
if (p_cb->app_id != 0)
@@ -555,7 +567,7 @@ void bta_hh_open_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
bta_hh_sm_execute(p_cb, BTA_HH_OPEN_CMPL_EVT, p_data);
}
else
- /* app_id == 0 indicates an incoming conenction request arrives without SDP
+ /* app_id == 0 indicates an incoming conenction request arrives without SDP
performed, do it first */
{
p_cb->incoming_conn = TRUE;
@@ -564,7 +576,7 @@ void bta_hh_open_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
bdcpy(conn_data.bd_addr, p_cb->addr);
bta_hh_start_sdp(p_cb, (tBTA_HH_DATA *)&conn_data);
}
-
+
return;
}
@@ -574,7 +586,7 @@ void bta_hh_open_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
** Function bta_hh_data_act
**
** Description HID Host process a data report
-**
+**
**
** Returns void
**
@@ -596,7 +608,7 @@ void bta_hh_data_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA * p_data)
** Function bta_hh_handsk_act
**
** Description HID Host process a handshake acknoledgement.
-**
+**
**
** Returns void
**
@@ -608,10 +620,10 @@ void bta_hh_handsk_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA * p_data)
tBTA_HH_CONN conn ;
#if BTA_HH_DEBUG
- APPL_TRACE_DEBUG2("HANDSHAKE received for: event = %s data= %d",
+ APPL_TRACE_DEBUG2("HANDSHAKE received for: event = %s data= %d",
bta_hh_get_w4_event(p_cb->w4_evt), p_data->hid_cback.data);
#endif
-
+
memset(&hs_data, 0, sizeof(tBTA_HH_HSDATA));
switch (p_cb->w4_evt)
@@ -622,7 +634,7 @@ void bta_hh_handsk_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA * p_data)
/* fall through */
case BTA_HH_GET_RPT_EVT:
case BTA_HH_GET_IDLE_EVT :
- hs_data.handle = p_cb->hid_handle;
+ hs_data.handle = p_cb->hid_handle;
/* if handshake gives an OK code for these transaction, fill in UNSUPT */
if ((hs_data.status = bta_hh_get_trans_status(p_data->hid_cback.data)) == BTA_HH_OK)
hs_data.status = BTA_HH_HS_TRANS_NOT_SPT;
@@ -640,7 +652,7 @@ void bta_hh_handsk_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA * p_data)
(* bta_hh_cb.p_cback)(p_cb->w4_evt, (tBTA_HH *)&cback_data);
p_cb->w4_evt = 0;
break;
-
+
/* SET_PROTOCOL when open connection */
case BTA_HH_OPEN_EVT:
conn.status =p_data->hid_cback.data ? BTA_HH_ERR_PROTO: BTA_HH_OK;
@@ -668,7 +680,7 @@ void bta_hh_handsk_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA * p_data)
** Function bta_hh_ctrl_dat_act
**
** Description HID Host process a data report from control channel.
-**
+**
**
** Returns void
**
@@ -680,7 +692,7 @@ void bta_hh_ctrl_dat_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA * p_data)
tBTA_HH_HSDATA hs_data;
#if BTA_HH_DEBUG
- APPL_TRACE_DEBUG1("Ctrl DATA received w4: event[%s]",
+ APPL_TRACE_DEBUG1("Ctrl DATA received w4: event[%s]",
bta_hh_get_w4_event(p_cb->w4_evt));
#endif
hs_data.status = BTA_HH_OK;
@@ -699,7 +711,7 @@ void bta_hh_ctrl_dat_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA * p_data)
hs_data.rsp_data.proto_mode = ((*data) == HID_PAR_PROTOCOL_REPORT)? \
BTA_HH_PROTO_RPT_MODE : BTA_HH_PROTO_BOOT_MODE;
#if BTA_HH_DEBUG
- APPL_TRACE_DEBUG1("GET_PROTOCOL Mode = [%s]",
+ APPL_TRACE_DEBUG1("GET_PROTOCOL Mode = [%s]",
(hs_data.rsp_data.proto_mode == BTA_HH_PROTO_RPT_MODE)? "Report" : "Boot");
#endif
break;
@@ -712,7 +724,7 @@ void bta_hh_ctrl_dat_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA * p_data)
/* fall through */
default:
#if BTA_HH_DEBUG
- APPL_TRACE_DEBUG1("invalid transaction type for DATA payload: 4_evt[%s]",
+ APPL_TRACE_DEBUG1("invalid transaction type for DATA payload: 4_evt[%s]",
bta_hh_get_w4_event(p_cb->w4_evt));
#endif
break;
@@ -734,7 +746,7 @@ void bta_hh_ctrl_dat_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA * p_data)
** Function bta_hh_close_act
**
** Description HID Host process a close event
-**
+**
**
** Returns void
**
@@ -761,30 +773,30 @@ void bta_hh_close_act (tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
conn_dat.status = (reason == HID_ERR_AUTH_FAILED) ? BTA_HH_ERR_AUTH_FAILED : BTA_HH_ERR;
bdcpy(conn_dat.bda, p_cb->addr);
HID_HostCloseDev(p_cb->hid_handle);
-
+
/* Report OPEN fail event */
(*bta_hh_cb.p_cback)(BTA_HH_OPEN_EVT, (tBTA_HH *)&conn_dat);
-
+
#if BTA_HH_DEBUG
bta_hh_trace_dev_db();
#endif
return;
- }
+ }
/* otherwise report CLOSE/VC_UNPLUG event */
- else
+ else
{
/* finaliza device driver */
bta_hh_co_close(p_cb->hid_handle, p_cb->app_id);
/* inform role manager */
- bta_sys_conn_close( BTA_ID_HH ,p_cb->app_id, p_cb->addr);
+ bta_sys_conn_close( BTA_ID_HH ,p_cb->app_id, p_cb->addr);
/* update total conn number */
bta_hh_cb.cnt_num --;
if (disc_dat.status)
- disc_dat.status = BTA_HH_ERR;
-
+ disc_dat.status = BTA_HH_ERR;
+
(*bta_hh_cb.p_cback)(event, (tBTA_HH *)&disc_dat);
-
+
/* if virtually unplug, remove device */
if (p_cb->vp )
{
@@ -800,7 +812,7 @@ void bta_hh_close_act (tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
/* clean up control block, but retain SDP info and device handle */
p_cb->vp = FALSE;
p_cb->w4_evt = 0;
-
+
/* if no connection is active and HH disable is signaled, disable service */
if (bta_hh_cb.cnt_num == 0 && bta_hh_cb.w4_disable)
{
@@ -815,7 +827,7 @@ void bta_hh_close_act (tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
** Function bta_hh_get_dscp_act
**
** Description Get device report descriptor
-**
+**
**
** Returns void
**
@@ -830,7 +842,7 @@ void bta_hh_get_dscp_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
** Function bta_hh_maint_dev_act
**
** Description HID Host maintain device list.
-**
+**
**
** Returns void
**
@@ -846,7 +858,7 @@ void bta_hh_maint_dev_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
switch (p_dev_info->sub_event)
{
- case BTA_HH_ADD_DEV_EVT: /* add a device */
+ case BTA_HH_ADD_DEV_EVT: /* add a device */
bdcpy(dev_info.bda, p_dev_info->bda);
/* initialize callback data */
if (p_cb->hid_handle == BTA_HH_INVALID_HANDLE)
@@ -858,16 +870,16 @@ void bta_hh_maint_dev_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
dev_info.status = BTA_HH_OK;
/* update DI information */
- bta_hh_update_di_info(p_cb,
+ bta_hh_update_di_info(p_cb,
p_dev_info->dscp_info.vendor_id,
- p_dev_info->dscp_info.product_id,
+ p_dev_info->dscp_info.product_id,
p_dev_info->dscp_info.version);
/* add to BTA device list */
- bta_hh_add_device_to_list(p_cb, dev_handle,
- p_dev_info->attr_mask,
- &p_dev_info->dscp_info.descriptor,
- p_dev_info->sub_class,
+ bta_hh_add_device_to_list(p_cb, dev_handle,
+ p_dev_info->attr_mask,
+ &p_dev_info->dscp_info.descriptor,
+ p_dev_info->sub_class,
p_dev_info->dscp_info.ssr_max_latency,
p_dev_info->dscp_info.ssr_min_tout,
p_dev_info->app_id);
@@ -897,7 +909,7 @@ void bta_hh_maint_dev_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
/* remove from known device list in BTA */
bta_hh_clean_up_kdev(p_cb);
- }
+ }
}
break;
@@ -913,7 +925,7 @@ void bta_hh_maint_dev_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
** Function bta_hh_write_dev_act
**
** Description Write device action. can be SET/GET/DATA transaction.
-**
+**
** Returns void
**
*******************************************************************************/
@@ -923,8 +935,8 @@ void bta_hh_write_dev_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
UINT16 event = (p_data->api_sndcmd.t_type - BTA_HH_FST_BTE_TRANS_EVT) +
BTA_HH_FST_TRANS_CB_EVT;
- cbdata.handle = p_cb->hid_handle;
-
+ cbdata.handle = p_cb->hid_handle;
+
/* match up BTE/BTA report/boot mode def */
if (p_data->api_sndcmd.t_type == HID_TRANS_SET_PROTOCOL)
{
@@ -932,14 +944,14 @@ void bta_hh_write_dev_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
HID_PAR_PROTOCOL_REPORT :HID_PAR_PROTOCOL_BOOT_MODE;
}
- if (HID_HostWriteDev (p_cb->hid_handle,
+ if (HID_HostWriteDev (p_cb->hid_handle,
p_data->api_sndcmd.t_type,
p_data->api_sndcmd.param,
p_data->api_sndcmd.data,
p_data->api_sndcmd.rpt_id,
p_data->api_sndcmd.p_data) != HID_SUCCESS)
{
- APPL_TRACE_ERROR0("HID_HostWriteDev Error ");
+ APPL_TRACE_ERROR0("HID_HostWriteDev Error ");
cbdata.status = BTA_HH_ERR;
if (p_data->api_sndcmd.t_type != HID_TRANS_CONTROL &&
@@ -976,9 +988,9 @@ void bta_hh_write_dev_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
break;
/* currently not expected */
- case HID_TRANS_DATAC:
+ case HID_TRANS_DATAC:
default:
- APPL_TRACE_DEBUG1("bta_hh_write_dev_act:: cmd type = %d",
+ APPL_TRACE_DEBUG1("bta_hh_write_dev_act:: cmd type = %d",
p_data->api_sndcmd.t_type);
break;
}
@@ -999,25 +1011,25 @@ void bta_hh_write_dev_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
bta_sys_busy(BTA_ID_HH, p_cb->app_id, p_cb->addr);
}
}
-
+
return;
}
/*****************************************************************************
-** Static Function
+** Static Function
*****************************************************************************/
/*******************************************************************************
**
** Function bta_hh_cback
**
** Description BTA HH callback function.
-**
+**
**
** Returns void
**
*******************************************************************************/
-static void bta_hh_cback (UINT8 dev_handle, UINT8 event, UINT32 data,
+static void bta_hh_cback (UINT8 dev_handle, UINT8 event, UINT32 data,
BT_HDR *pdata)
{
tBTA_HH_CBACK_DATA *p_buf = NULL;
@@ -1065,7 +1077,7 @@ static void bta_hh_cback (UINT8 dev_handle, UINT8 event, UINT32 data,
}
if (sm_event != BTA_HH_INVALID_EVT &&
- (p_buf = (tBTA_HH_CBACK_DATA *)GKI_getbuf(sizeof(tBTA_HH_CBACK_DATA) +
+ (p_buf = (tBTA_HH_CBACK_DATA *)GKI_getbuf(sizeof(tBTA_HH_CBACK_DATA) +
sizeof(BT_HDR))) != NULL)
{
p_buf->hdr.event = sm_event;
@@ -1081,8 +1093,8 @@ static void bta_hh_cback (UINT8 dev_handle, UINT8 event, UINT32 data,
**
** Function bta_hh_get_trans_status
**
-** Description translate a handshake result code into BTA HH
-** status code
+** Description translate a handshake result code into BTA HH
+** status code
**
*******************************************************************************/
static tBTA_HH_STATUS bta_hh_get_trans_status(UINT32 result)
diff --git a/bta/hh/bta_hh_api.c b/bta/hh/bta_hh_api.c
index c84243d..300fc6f 100644
--- a/bta/hh/bta_hh_api.c
+++ b/bta/hh/bta_hh_api.c
@@ -1,13 +1,26 @@
-/*****************************************************************************/
-/* */
-/* Name: bta_hh_api.c */
-/* */
-/* Description: this file contains the HID HOST API in the subsystem of */
-/* BTA. */
-/* */
-/* Copyright (c) 2005, Broadcom Corp, All Rights Reserved. */
-/* WIDCOMM Bluetooth Core. Proprietary and confidential. */
-/*****************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 2005-2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * This file contains the HID HOST API in the subsystem of BTA.
+ *
+ ******************************************************************************/
#include "bt_target.h"
@@ -20,6 +33,7 @@
#include "bta_hh_api.h"
#include "bta_hh_int.h"
#include "l2c_api.h"
+
/*****************************************************************************
** Constants
*****************************************************************************/
@@ -34,11 +48,11 @@ static const tBTA_SYS_REG bta_hh_reg =
**
** Function BTA_HhEnable
**
-** Description Enable the HID host. This function must be called before
-** any other functions in the HID host API are called. When the
-** enable operation is complete the callback function will be
+** Description Enable the HID host. This function must be called before
+** any other functions in the HID host API are called. When the
+** enable operation is complete the callback function will be
** called with BTA_HH_ENABLE_EVT.
-**
+**
**
** Returns void
**
@@ -93,7 +107,7 @@ void BTA_HhDisable(void)
**
** Function BTA_HhClose
**
-** Description Disconnect a connection.
+** Description Disconnect a connection.
**
** Returns void
**
@@ -127,7 +141,7 @@ void BTA_HhOpen(BD_ADDR dev_bda, tBTA_HH_PROTO_MODE mode, tBTA_SEC sec_mask)
tBTA_HH_API_CONN *p_buf;
p_buf = (tBTA_HH_API_CONN *)GKI_getbuf((UINT16)sizeof(tBTA_HH_API_CONN));
-
+
if (p_buf!= NULL)
{
memset((void *)p_buf, 0, sizeof(tBTA_HH_API_CONN));
@@ -151,12 +165,12 @@ void BTA_HhOpen(BD_ADDR dev_bda, tBTA_HH_PROTO_MODE mode, tBTA_SEC sec_mask)
** Function bta_hh_snd_write_dev
**
*******************************************************************************/
-static void bta_hh_snd_write_dev(UINT8 dev_handle, UINT8 t_type, UINT8 param,
+static void bta_hh_snd_write_dev(UINT8 dev_handle, UINT8 t_type, UINT8 param,
UINT16 data, UINT8 rpt_id, BT_HDR *p_data)
{
tBTA_HH_CMD_DATA *p_buf;
UINT16 len = (UINT16) (sizeof(tBTA_HH_CMD_DATA) );
-
+
if ((p_buf = (tBTA_HH_CMD_DATA *)GKI_getbuf(len))!= NULL)
{
memset(p_buf, 0, sizeof(tBTA_HH_CMD_DATA));
@@ -179,7 +193,7 @@ static void bta_hh_snd_write_dev(UINT8 dev_handle, UINT8 t_type, UINT8 param,
** Description send SET_REPORT to device.
**
** Parameter dev_handle: device handle
-** r_type: report type, could be BTA_HH_RPTT_OUTPUT or
+** r_type: report type, could be BTA_HH_RPTT_OUTPUT or
** BTA_HH_RPTT_FEATURE.
** Returns void
**
@@ -192,7 +206,7 @@ void BTA_HhSetReport(UINT8 dev_handle, tBTA_HH_RPT_TYPE r_type, BT_HDR *p_data)
**
** Function BTA_HhGetReport
**
-** Description Send a GET_REPORT to HID device.
+** Description Send a GET_REPORT to HID device.
**
** Returns void
**
@@ -201,8 +215,8 @@ void BTA_HhGetReport(UINT8 dev_handle, tBTA_HH_RPT_TYPE r_type, UINT8 rpt_id, UI
{
UINT8 param = (buf_size) ? (r_type | 0x08) : r_type;
- bta_hh_snd_write_dev(dev_handle, HID_TRANS_GET_REPORT, param,
- buf_size, rpt_id, NULL);
+ bta_hh_snd_write_dev(dev_handle, HID_TRANS_GET_REPORT, param,
+ buf_size, rpt_id, NULL);
}
/*******************************************************************************
**
@@ -215,7 +229,7 @@ void BTA_HhGetReport(UINT8 dev_handle, tBTA_HH_RPT_TYPE r_type, UINT8 rpt_id, UI
*******************************************************************************/
void BTA_HhSetProtoMode(UINT8 dev_handle, tBTA_HH_PROTO_MODE p_type)
{
- bta_hh_snd_write_dev(dev_handle, HID_TRANS_SET_PROTOCOL, (UINT8)p_type,
+ bta_hh_snd_write_dev(dev_handle, HID_TRANS_SET_PROTOCOL, (UINT8)p_type,
0, 0, NULL);
}
/*******************************************************************************
@@ -312,15 +326,15 @@ void BTA_HhGetDscpInfo(UINT8 dev_handle)
**
** Function BTA_HhAddDev
**
-** Description Add a virtually cabled device into HID-Host device list
-** to manage and assign a device handle for future API call,
-** host applciation call this API at start-up to initialize its
-** virtually cabled devices.
+** Description Add a virtually cabled device into HID-Host device list
+** to manage and assign a device handle for future API call,
+** host applciation call this API at start-up to initialize its
+** virtually cabled devices.
**
** Returns void
**
*******************************************************************************/
-void BTA_HhAddDev(BD_ADDR bda, tBTA_HH_ATTR_MASK attr_mask, UINT8 sub_class,
+void BTA_HhAddDev(BD_ADDR bda, tBTA_HH_ATTR_MASK attr_mask, UINT8 sub_class,
UINT8 app_id, tBTA_HH_DEV_DSCP_INFO dscp_info)
{
tBTA_HH_MAINT_DEV *p_buf;
@@ -333,7 +347,7 @@ void BTA_HhAddDev(BD_ADDR bda, tBTA_HH_ATTR_MASK attr_mask, UINT8 sub_class,
memset(p_buf, 0, sizeof(tBTA_HH_MAINT_DEV));
p_buf->hdr.event = BTA_HH_API_MAINT_DEV_EVT;
- p_buf->sub_event = BTA_HH_ADD_DEV_EVT;
+ p_buf->sub_event = BTA_HH_ADD_DEV_EVT;
p_buf->hdr.layer_specific = BTA_HH_INVALID_HANDLE;
p_buf->attr_mask = (UINT16) attr_mask;
@@ -361,7 +375,7 @@ void BTA_HhAddDev(BD_ADDR bda, tBTA_HH_ATTR_MASK attr_mask, UINT8 sub_class,
**
** Function BTA_HhRemoveDev
**
-** Description Remove a device from the HID host devices list.
+** Description Remove a device from the HID host devices list.
**
** Returns void
**
@@ -377,11 +391,11 @@ void BTA_HhRemoveDev(UINT8 dev_handle )
memset(p_buf, 0, sizeof(tBTA_HH_MAINT_DEV));
p_buf->hdr.event = BTA_HH_API_MAINT_DEV_EVT;
- p_buf->sub_event = BTA_HH_RMV_DEV_EVT;
+ p_buf->sub_event = BTA_HH_RMV_DEV_EVT;
p_buf->hdr.layer_specific = (UINT16) dev_handle;
bta_sys_sendmsg(p_buf);
- }
+ }
}
/*******************************************************************************/
@@ -393,21 +407,21 @@ void BTA_HhRemoveDev(UINT8 dev_handle )
** Function BTA_HhParseBootRpt
**
** Description This utility function parse a boot mode report.
-** For keyboard report, report data will carry the keycode max
-** up to 6 key press in one report. Application need to convert
-** the keycode into keypress character according to keyboard
+** For keyboard report, report data will carry the keycode max
+** up to 6 key press in one report. Application need to convert
+** the keycode into keypress character according to keyboard
** language.
**
** Returns void
**
*******************************************************************************/
-void BTA_HhParseBootRpt(tBTA_HH_BOOT_RPT *p_data, UINT8 *p_report,
+void BTA_HhParseBootRpt(tBTA_HH_BOOT_RPT *p_data, UINT8 *p_report,
UINT16 report_len)
{
p_data->dev_type = BTA_HH_DEVT_UNKNOWN;
if (p_report)
- {
+ {
/* first byte is report ID */
switch (p_report[0])
{
@@ -426,7 +440,7 @@ void BTA_HhParseBootRpt(tBTA_HH_BOOT_RPT *p_data, UINT8 *p_report,
break;
}
}
-
+
return;
}
diff --git a/bta/hh/bta_hh_cfg.c b/bta/hh/bta_hh_cfg.c
index 126ae4a..62a07ad 100644
--- a/bta/hh/bta_hh_cfg.c
+++ b/bta/hh/bta_hh_cfg.c
@@ -1,14 +1,27 @@
-/*****************************************************************************
-**
-** Name: bta_hh_cfg.c
-**
-** Description: This file contains compile-time configurable constants
-** for the BTA Hid Host.
-**
-** Copyright (c) 2005, Broadcom Corp, All Rights Reserved.
-** Widcomm Bluetooth Core. Proprietary and confidential.
-**
-*****************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 2005-2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * This file contains compile-time configurable constants for the BTA Hid
+ * Host.
+ *
+ ******************************************************************************/
#include "bt_target.h"
#include "bta_hh_api.h"
diff --git a/bta/hh/bta_hh_int.h b/bta/hh/bta_hh_int.h
index 51dfad1..f3a8e54 100644
--- a/bta/hh/bta_hh_int.h
+++ b/bta/hh/bta_hh_int.h
@@ -1,13 +1,26 @@
-/****************************************************************************/
-/* */
-/* Name: bta_hh_int.h */
-/* */
-/* Function: this file contains BTA HID Host internal definitions */
-/* */
-/* Copyright (c) 2005, Broadcom Corp, All Rights Reserved. */
-/* WIDCOMM Bluetooth Core. Proprietary and confidential. */
-/* */
-/****************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 2005-2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * This file contains BTA HID Host internal definitions
+ *
+ ******************************************************************************/
#ifndef BTA_HH_INT_H
#define BTA_HH_INT_H
@@ -23,7 +36,7 @@
/* state machine events, these events are handled by the state machine */
enum
-{
+{
BTA_HH_API_OPEN_EVT = BTA_SYS_EVT_START(BTA_ID_HH),
BTA_HH_API_CLOSE_EVT,
BTA_HH_INT_OPEN_EVT,
@@ -87,7 +100,7 @@ typedef struct
typedef struct
{
BT_HDR hdr;
- BD_ADDR bd_addr;
+ BD_ADDR bd_addr;
UINT8 sec_mask;
tBTA_HH_PROTO_MODE mode;
}tBTA_HH_API_CONN;
@@ -105,7 +118,7 @@ typedef struct
BT_HDR hdr;
BD_ADDR bda;
UINT16 attr_mask;
- UINT16 sub_event;
+ UINT16 sub_event;
UINT8 sub_class;
UINT8 app_id;
tBTA_HH_DEV_DSCP_INFO dscp_info;
@@ -155,16 +168,16 @@ typedef struct
/******************************************************************************
** Main Control Block
*******************************************************************************/
-typedef struct
+typedef struct
{
- tBTA_HH_KB_CB kb_cb; /* key board control block,
- suppose BTA will connect
- to only one keyboard at
+ tBTA_HH_KB_CB kb_cb; /* key board control block,
+ suppose BTA will connect
+ to only one keyboard at
the same time */
tBTA_HH_DEV_CB kdev[BTA_HH_MAX_KNOWN]; /* device control block */
- tBTA_HH_DEV_CB* p_cur; /* current device control
+ tBTA_HH_DEV_CB* p_cur; /* current device control
block idx, used in sdp */
- UINT8 cb_index[BTA_HH_MAX_KNOWN]; /* maintain a CB index
+ UINT8 cb_index[BTA_HH_MAX_KNOWN]; /* maintain a CB index
map to dev handle */
tBTA_HH_CBACK *p_cback; /* Application callbacks */
tSDP_DISCOVERY_DB* p_disc_db;
@@ -188,7 +201,7 @@ extern tBTA_HH_CFG *p_bta_hh_cfg;
** Function prototypes
*****************************************************************************/
extern BOOLEAN bta_hh_hdl_event(BT_HDR *p_msg);
-extern void bta_hh_sm_execute(tBTA_HH_DEV_CB *p_cb, UINT16 event,
+extern void bta_hh_sm_execute(tBTA_HH_DEV_CB *p_cb, UINT16 event,
tBTA_HH_DATA *p_data);
/* action functions */
@@ -207,16 +220,16 @@ extern void bta_hh_open_cmpl_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data);
/* utility functions */
extern UINT8 bta_hh_find_cb(BD_ADDR bda);
-extern void bta_hh_parse_keybd_rpt(tBTA_HH_BOOT_RPT *p_kb_data,
+extern void bta_hh_parse_keybd_rpt(tBTA_HH_BOOT_RPT *p_kb_data,
UINT8 *p_report, UINT16 report_len);
-extern void bta_hh_parse_mice_rpt(tBTA_HH_BOOT_RPT *p_kb_data,
+extern void bta_hh_parse_mice_rpt(tBTA_HH_BOOT_RPT *p_kb_data,
UINT8 *p_report, UINT16 report_len);
extern BOOLEAN bta_hh_tod_spt(tBTA_HH_DEV_CB *p_cb,UINT8 sub_class);
extern void bta_hh_clean_up_kdev(tBTA_HH_DEV_CB *p_cb);
-extern void bta_hh_add_device_to_list(tBTA_HH_DEV_CB *p_cb, UINT8 handle,
- UINT16 attr_mask,
- tHID_DEV_DSCP_INFO *p_dscp_info,
+extern void bta_hh_add_device_to_list(tBTA_HH_DEV_CB *p_cb, UINT8 handle,
+ UINT16 attr_mask,
+ tHID_DEV_DSCP_INFO *p_dscp_info,
UINT8 sub_class, UINT16 max_latency, UINT16 min_tout, UINT8 app_id);
extern void bta_hh_update_di_info(tBTA_HH_DEV_CB *p_cb, UINT16 vendor_id, UINT16 product_id,
UINT16 version);
diff --git a/bta/hh/bta_hh_main.c b/bta/hh/bta_hh_main.c
index 648b10f..a1d0ad2 100644
--- a/bta/hh/bta_hh_main.c
+++ b/bta/hh/bta_hh_main.c
@@ -1,14 +1,26 @@
-/*****************************************************************************
-**
-** Name: bta_hh_main.c
-**
-** Description: This file contains the HID host main functions and state
-** machine.
-**
-** Copyright (c) 2005, Broadcom Corp, All Rights Reserved.
-** Widcomm Bluetooth Core. Proprietary and confidential.
-**
-*****************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 2005-2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * This file contains the HID host main functions and state machine.
+ *
+ ******************************************************************************/
#include "bt_target.h"
@@ -79,13 +91,13 @@ const UINT8 bta_hh_st_idle[][BTA_HH_NUM_COLS] =
/* BTA_HH_INT_CLOSE_EVT */ {BTA_HH_CLOSE_ACT, BTA_HH_IDLE_ST },
/* BTA_HH_INT_DATA_EVT */ {BTA_HH_IGNORE, BTA_HH_IDLE_ST },
/* BTA_HH_INT_CTRL_DATA */ {BTA_HH_IGNORE, BTA_HH_IDLE_ST },
-/* BTA_HH_INT_HANDSK_EVT */ {BTA_HH_IGNORE, BTA_HH_IDLE_ST },
+/* BTA_HH_INT_HANDSK_EVT */ {BTA_HH_IGNORE, BTA_HH_IDLE_ST },
/* BTA_HH_SDP_CMPL_EVT */ {BTA_HH_IGNORE, BTA_HH_IDLE_ST },
/* BTA_HH_API_WRITE_DEV_EVT */ {BTA_HH_IGNORE, BTA_HH_IDLE_ST },
/* BTA_HH_API_GET_DSCP_EVT */ {BTA_HH_IGNORE, BTA_HH_IDLE_ST },
/* BTA_HH_API_MAINT_DEV_EVT */ {BTA_HH_MAINT_DEV_ACT, BTA_HH_IDLE_ST },
/* BTA_HH_OPEN_CMPL_EVT */ {BTA_HH_IGNORE, BTA_HH_IDLE_ST }
-
+
};
@@ -98,7 +110,7 @@ const UINT8 bta_hh_st_w4_conn[][BTA_HH_NUM_COLS] =
/* BTA_HH_INT_CLOSE_EVT */ {BTA_HH_CLOSE_ACT, BTA_HH_IDLE_ST },
/* BTA_HH_INT_DATA_EVT */ {BTA_HH_IGNORE, BTA_HH_W4_CONN_ST },
/* BTA_HH_INT_CTRL_DATA */ {BTA_HH_IGNORE, BTA_HH_W4_CONN_ST },
-/* BTA_HH_INT_HANDSK_EVT */ {BTA_HH_IGNORE, BTA_HH_W4_CONN_ST },
+/* BTA_HH_INT_HANDSK_EVT */ {BTA_HH_IGNORE, BTA_HH_W4_CONN_ST },
/* BTA_HH_SDP_CMPL_EVT */ {BTA_HH_SDP_CMPL, BTA_HH_W4_CONN_ST },
/* BTA_HH_API_WRITE_DEV_EVT */ {BTA_HH_IGNORE , BTA_HH_W4_CONN_ST },
/* BTA_HH_API_GET_DSCP_EVT */ {BTA_HH_IGNORE, BTA_HH_W4_CONN_ST },
@@ -116,7 +128,7 @@ const UINT8 bta_hh_st_connected[][BTA_HH_NUM_COLS] =
/* BTA_HH_INT_CLOSE_EVT */ {BTA_HH_CLOSE_ACT, BTA_HH_IDLE_ST },
/* BTA_HH_INT_DATA_EVT */ {BTA_HH_DATA_ACT, BTA_HH_CONN_ST },
/* BTA_HH_INT_CTRL_DATA */ {BTA_HH_CTRL_DAT_ACT, BTA_HH_CONN_ST },
-/* BTA_HH_INT_HANDSK_EVT */ {BTA_HH_HANDSK_ACT, BTA_HH_CONN_ST },
+/* BTA_HH_INT_HANDSK_EVT */ {BTA_HH_HANDSK_ACT, BTA_HH_CONN_ST },
/* BTA_HH_SDP_CMPL_EVT */ {BTA_HH_IGNORE, BTA_HH_CONN_ST },
/* BTA_HH_API_WRITE_DEV_EVT */ {BTA_HH_WRITE_DEV_ACT, BTA_HH_CONN_ST },
/* BTA_HH_API_GET_DSCP_EVT */ {BTA_HH_GET_DSCP_ACT, BTA_HH_CONN_ST },
@@ -154,7 +166,7 @@ static char *bta_hh_state_code(tBTA_HH_STATE state_code);
** Function bta_hh_sm_execute
**
** Description State machine event handling function for HID Host
-**
+**
**
** Returns void
**
@@ -173,7 +185,7 @@ void bta_hh_sm_execute(tBTA_HH_DEV_CB *p_cb, UINT16 event, tBTA_HH_DATA * p_data
memset(&cback_data, 0, sizeof(tBTA_HH));
/* handle exception, no valid control block was found */
- if (!p_cb)
+ if (!p_cb)
{
/* BTA HH enabled already? otherwise ignore the event although it's bad*/
if (bta_hh_cb.p_cback != NULL)
@@ -181,7 +193,7 @@ void bta_hh_sm_execute(tBTA_HH_DEV_CB *p_cb, UINT16 event, tBTA_HH_DATA * p_data
switch (event)
{
/* no control block available for new connection */
- case BTA_HH_API_OPEN_EVT:
+ case BTA_HH_API_OPEN_EVT:
cback_event = BTA_HH_OPEN_EVT;
/* build cback data */
bdcpy(cback_data.conn.bda, ((tBTA_HH_API_CONN *)p_data)->bd_addr);
@@ -192,7 +204,7 @@ void bta_hh_sm_execute(tBTA_HH_DEV_CB *p_cb, UINT16 event, tBTA_HH_DATA * p_data
case BTA_HH_API_MAINT_DEV_EVT:
cback_event = p_data->api_maintdev.sub_event;
- if (p_data->api_maintdev.sub_event == BTA_HH_ADD_DEV_EVT)
+ if (p_data->api_maintdev.sub_event == BTA_HH_ADD_DEV_EVT)
{
bdcpy(cback_data.dev_info.bda, p_data->api_maintdev.bda);
cback_data.dev_info.status = BTA_HH_ERR_DB_FULL;
@@ -223,7 +235,7 @@ void bta_hh_sm_execute(tBTA_HH_DEV_CB *p_cb, UINT16 event, tBTA_HH_DATA * p_data
}
break;
- case BTA_HH_API_CLOSE_EVT:
+ case BTA_HH_API_CLOSE_EVT:
cback_event = BTA_HH_CLOSE_EVT;
cback_data.dev_status.status = BTA_HH_ERR_HDL;
@@ -240,7 +252,7 @@ void bta_hh_sm_execute(tBTA_HH_DEV_CB *p_cb, UINT16 event, tBTA_HH_DATA * p_data
}
}
/* corresponding CB is found, go to state machine */
- else
+ else
{
#if BTA_HH_DEBUG == TRUE
in_state = p_cb->state;
@@ -254,7 +266,7 @@ void bta_hh_sm_execute(tBTA_HH_DEV_CB *p_cb, UINT16 event, tBTA_HH_DATA * p_data
event &= 0xff;
p_cb->state = state_table[event][BTA_HH_NEXT_STATE] ;
-
+
if ((action = state_table[event][BTA_HH_ACTION]) != BTA_HH_IGNORE)
{
(*bta_hh_action[action])(p_cb, p_data);
@@ -271,14 +283,14 @@ void bta_hh_sm_execute(tBTA_HH_DEV_CB *p_cb, UINT16 event, tBTA_HH_DATA * p_data
#endif
}
- return;
+ return;
}
/*******************************************************************************
**
** Function bta_hh_hdl_event
**
** Description HID host main event handling function.
-**
+**
**
** Returns void
**
@@ -287,7 +299,7 @@ BOOLEAN bta_hh_hdl_event(BT_HDR *p_msg)
{
UINT8 index = BTA_HH_MAX_KNOWN;
tBTA_HH_DEV_CB *p_cb = NULL;
-
+
switch (p_msg->event)
{
case BTA_HH_API_ENABLE_EVT:
@@ -302,8 +314,8 @@ BOOLEAN bta_hh_hdl_event(BT_HDR *p_msg)
bta_hh_disc_cmpl();
break;
- default:
- /* all events processed in state machine need to find corresponding
+ default:
+ /* all events processed in state machine need to find corresponding
CB before proceed */
if (p_msg->event == BTA_HH_API_OPEN_EVT)
{
@@ -322,8 +334,8 @@ BOOLEAN bta_hh_hdl_event(BT_HDR *p_msg)
// btla-specific ++
/* If BT disable is done while the HID device is connected and Link_Key uses unauthenticated combination
* then we can get into a situation where remove_bonding is called with the index set to 0 (without getting
- * cleaned up). Only when VIRTUAL_UNPLUG is called do we cleanup the index and make it MAX_KNOWN.
- * So if REMOVE_DEVICE is called and in_use is FALSE then we should treat this as a NULL p_cb. Hence we
+ * cleaned up). Only when VIRTUAL_UNPLUG is called do we cleanup the index and make it MAX_KNOWN.
+ * So if REMOVE_DEVICE is called and in_use is FALSE then we should treat this as a NULL p_cb. Hence we
* force the index to be MAX_KNOWN
*/
if (bta_hh_cb.kdev[index].in_use == FALSE) {
@@ -354,7 +366,7 @@ BOOLEAN bta_hh_hdl_event(BT_HDR *p_msg)
**
** Function bta_hh_evt_code
**
-** Description
+** Description
**
** Returns void
**
diff --git a/bta/hh/bta_hh_utils.c b/bta/hh/bta_hh_utils.c
index 2b68c56..4349282 100644
--- a/bta/hh/bta_hh_utils.c
+++ b/bta/hh/bta_hh_utils.c
@@ -1,13 +1,20 @@
-/*****************************************************************************
-**
-** Name: bta_hh_utils.c
-**
-** File: Implements the untility functions used by HID Host
-**
-** Copyright (c) 2005, Broadcom Corp, All Rights Reserved.
-** Widcomm Bluetooth Core. Proprietary and confidential.
-**
-*****************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 2005-2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
#include <string.h>
#include "bt_target.h"
@@ -136,7 +143,7 @@ void bta_hh_update_di_info(tBTA_HH_DEV_CB *p_cb, UINT16 vendor_id, UINT16 produc
UINT16 version)
{
#if BTA_HH_DEBUG
- APPL_TRACE_DEBUG3("vendor_id = 0x%2x product_id = 0x%2x version = 0x%2x",
+ APPL_TRACE_DEBUG3("vendor_id = 0x%2x product_id = 0x%2x version = 0x%2x",
vendor_id, product_id, version);
#endif
p_cb->dscp_info.vendor_id = vendor_id;
@@ -155,7 +162,7 @@ void bta_hh_update_di_info(tBTA_HH_DEV_CB *p_cb, UINT16 vendor_id, UINT16 produc
void bta_hh_add_device_to_list(tBTA_HH_DEV_CB *p_cb, UINT8 handle,
UINT16 attr_mask,
tHID_DEV_DSCP_INFO *p_dscp_info,
- UINT8 sub_class,
+ UINT8 sub_class,
UINT16 ssr_max_latency,
UINT16 ssr_min_tout,
UINT8 app_id)