diff options
author | Matthew Xie <mattx@google.com> | 2012-09-18 16:14:30 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-09-18 16:14:30 -0700 |
commit | ad2d45b15aae80ba254277c3d1fa036207d8b926 (patch) | |
tree | 27ebefd16a44995abb1b16e5c279a1bd169cf0f5 /stack/hid | |
parent | cc914cffd521b2e6e1be804c82aea2388b843ebf (diff) | |
download | external_bluetooth_bluedroid-ad2d45b15aae80ba254277c3d1fa036207d8b926.zip external_bluetooth_bluedroid-ad2d45b15aae80ba254277c3d1fa036207d8b926.tar.gz external_bluetooth_bluedroid-ad2d45b15aae80ba254277c3d1fa036207d8b926.tar.bz2 |
Revert "Header file and whitespace cleanups"
This reverts commit cc914cffd521b2e6e1be804c82aea2388b843ebf
More changes in the original CL after my cherry-pick.
Change-Id: Ic144dba96aeb8a60611baac7565c9f628ab8f9eb
Diffstat (limited to 'stack/hid')
-rw-r--r-- | stack/hid/hid_conn.h | 2 | ||||
-rw-r--r-- | stack/hid/hidh_api.c | 44 | ||||
-rw-r--r-- | stack/hid/hidh_conn.c | 48 | ||||
-rw-r--r-- | stack/hid/hidh_int.h | 4 |
4 files changed, 49 insertions, 49 deletions
diff --git a/stack/hid/hid_conn.h b/stack/hid/hid_conn.h index 436b8d9..41eeaaf 100644 --- a/stack/hid/hid_conn.h +++ b/stack/hid/hid_conn.h @@ -51,6 +51,6 @@ typedef struct hid_conn #define HID_NOSEC_CHN 2 #define HIDD_SEC_CHN 3 -#define HIDD_NOSEC_CHN 4 +#define HIDD_NOSEC_CHN 4 #endif diff --git a/stack/hid/hidh_api.c b/stack/hid/hidh_api.c index e0314f4..268b405 100644 --- a/stack/hid/hidh_api.c +++ b/stack/hid/hidh_api.c @@ -134,31 +134,31 @@ static void hidh_search_callback (UINT16 sdp_result) attr_mask |= HID_VIRTUAL_CABLE; } - if (((p_attr = SDP_FindAttributeInRec (p_rec, ATTR_ID_HID_RECONNECT_INITIATE)) != NULL) && + if (((p_attr = SDP_FindAttributeInRec (p_rec, ATTR_ID_HID_RECONNECT_INITIATE)) != NULL) && (p_attr->attr_value.v.u8) ) { attr_mask |= HID_RECONN_INIT; } - if (((p_attr = SDP_FindAttributeInRec (p_rec, ATTR_ID_HID_NORMALLY_CONNECTABLE)) != NULL) && + if (((p_attr = SDP_FindAttributeInRec (p_rec, ATTR_ID_HID_NORMALLY_CONNECTABLE)) != NULL) && (p_attr->attr_value.v.u8) ) { attr_mask |= HID_NORMALLY_CONNECTABLE; } - if (((p_attr = SDP_FindAttributeInRec (p_rec, ATTR_ID_HID_SDP_DISABLE)) != NULL)&& + if (((p_attr = SDP_FindAttributeInRec (p_rec, ATTR_ID_HID_SDP_DISABLE)) != NULL)&& (p_attr->attr_value.v.u8) ) { attr_mask |= HID_SDP_DISABLE; } - if (((p_attr = SDP_FindAttributeInRec (p_rec, ATTR_ID_HID_BATTERY_POWER)) != NULL)&& + if (((p_attr = SDP_FindAttributeInRec (p_rec, ATTR_ID_HID_BATTERY_POWER)) != NULL)&& (p_attr->attr_value.v.u8) ) { attr_mask |= HID_BATTERY_POWER; } - if (((p_attr = SDP_FindAttributeInRec (p_rec, ATTR_ID_HID_REMOTE_WAKE)) != NULL)&& + if (((p_attr = SDP_FindAttributeInRec (p_rec, ATTR_ID_HID_REMOTE_WAKE)) != NULL)&& (p_attr->attr_value.v.u8) ) { attr_mask |= HID_REMOTE_WAKE; @@ -169,33 +169,33 @@ static void hidh_search_callback (UINT16 sdp_result) hidh_get_str_attr( p_rec, ATTR_ID_PROVIDER_NAME, HID_MAX_PROV_NAME_LEN, p_nvi->prov_name ); if (((p_attr = SDP_FindAttributeInRec (p_rec, ATTR_ID_HID_DEVICE_RELNUM)) != NULL)) - { + { p_nvi->rel_num = p_attr->attr_value.v.u16; } if (((p_attr = SDP_FindAttributeInRec (p_rec, ATTR_ID_HID_COUNTRY_CODE)) != NULL)) - { + { p_nvi->ctry_code = p_attr->attr_value.v.u8; } if (((p_attr = SDP_FindAttributeInRec (p_rec, ATTR_ID_HID_DEVICE_SUBCLASS)) != NULL)) - { + { p_nvi->sub_class = p_attr->attr_value.v.u8; } if (((p_attr = SDP_FindAttributeInRec (p_rec, ATTR_ID_HID_PARSER_VERSION)) != NULL)) - { + { p_nvi->hpars_ver = p_attr->attr_value.v.u16; } if (((p_attr = SDP_FindAttributeInRec (p_rec, ATTR_ID_HID_LINK_SUPERVISION_TO)) != NULL)) - { + { attr_mask |= HID_SUP_TOUT_AVLBL; p_nvi->sup_timeout = p_attr->attr_value.v.u16; } if (((p_attr = SDP_FindAttributeInRec (p_rec, ATTR_ID_HID_SSR_HOST_MAX_LAT)) != NULL)) - { + { attr_mask |= HID_SSR_MAX_LATENCY; p_nvi->ssr_max_latency = p_attr->attr_value.v.u16; } @@ -203,7 +203,7 @@ static void hidh_search_callback (UINT16 sdp_result) p_nvi->ssr_max_latency = HID_SSR_PARAM_INVALID; if (((p_attr = SDP_FindAttributeInRec (p_rec, ATTR_ID_HID_SSR_HOST_MIN_TOUT)) != NULL)) - { + { attr_mask |= HID_SSR_MIN_TOUT; p_nvi->ssr_min_tout = p_attr->attr_value.v.u16; } @@ -304,7 +304,7 @@ tHID_STATUS HID_HostDeregister(void) { HID_HostRemoveDev( i ) ; } - + hidh_conn_dereg(); hh_cb.reg_flag = FALSE; @@ -421,11 +421,11 @@ tHID_STATUS HID_HostOpenDev ( UINT8 dev_handle ) ** ** report_id: is only used on GET_REPORT transaction if is specified. ** only valid when it's a non-zero value. -** +** ** Returns void ** *******************************************************************************/ -tHID_STATUS HID_HostWriteDev( UINT8 dev_handle, UINT8 t_type, +tHID_STATUS HID_HostWriteDev( UINT8 dev_handle, UINT8 t_type, UINT8 param, UINT16 data, UINT8 report_id, BT_HDR *pbuf ) { tHID_STATUS status = HID_SUCCESS; @@ -455,7 +455,7 @@ tHID_STATUS HID_HostWriteDev( UINT8 dev_handle, UINT8 t_type, } else status = hidh_conn_snd_data( dev_handle, t_type, param, data, report_id, pbuf ) ; - + return status; } @@ -488,42 +488,42 @@ tHID_STATUS HID_HostCloseDev( UINT8 dev_handle ) tHID_STATUS HID_HostSetSecurityLevel( char serv_name[], UINT8 sec_lvl ) { - if (!BTM_SetSecurityLevel (FALSE, serv_name, BTM_SEC_SERVICE_HID_SEC_CTRL, + if (!BTM_SetSecurityLevel (FALSE, serv_name, BTM_SEC_SERVICE_HID_SEC_CTRL, sec_lvl, HID_PSM_CONTROL, BTM_SEC_PROTO_HID, HID_SEC_CHN)) { HIDH_TRACE_ERROR0 ("Security Registration 1 failed"); return (HID_ERR_NO_RESOURCES); } - if (!BTM_SetSecurityLevel (TRUE, serv_name, BTM_SEC_SERVICE_HID_SEC_CTRL, + if (!BTM_SetSecurityLevel (TRUE, serv_name, BTM_SEC_SERVICE_HID_SEC_CTRL, sec_lvl, HID_PSM_CONTROL, BTM_SEC_PROTO_HID, HID_SEC_CHN)) { HIDH_TRACE_ERROR0 ("Security Registration 2 failed"); return (HID_ERR_NO_RESOURCES); } - if (!BTM_SetSecurityLevel (FALSE, serv_name, BTM_SEC_SERVICE_HID_NOSEC_CTRL, + if (!BTM_SetSecurityLevel (FALSE, serv_name, BTM_SEC_SERVICE_HID_NOSEC_CTRL, BTM_SEC_NONE, HID_PSM_CONTROL, BTM_SEC_PROTO_HID, HID_NOSEC_CHN)) { HIDH_TRACE_ERROR0 ("Security Registration 3 failed"); return (HID_ERR_NO_RESOURCES); } - if (!BTM_SetSecurityLevel (TRUE, serv_name, BTM_SEC_SERVICE_HID_NOSEC_CTRL, + if (!BTM_SetSecurityLevel (TRUE, serv_name, BTM_SEC_SERVICE_HID_NOSEC_CTRL, BTM_SEC_NONE, HID_PSM_CONTROL, BTM_SEC_PROTO_HID, HID_NOSEC_CHN)) { HIDH_TRACE_ERROR0 ("Security Registration 4 failed"); return (HID_ERR_NO_RESOURCES); } - if (!BTM_SetSecurityLevel (TRUE, serv_name, BTM_SEC_SERVICE_HID_INTR, + if (!BTM_SetSecurityLevel (TRUE, serv_name, BTM_SEC_SERVICE_HID_INTR, BTM_SEC_NONE, HID_PSM_INTERRUPT, BTM_SEC_PROTO_HID, 0)) { HIDH_TRACE_ERROR0 ("Security Registration 5 failed"); return (HID_ERR_NO_RESOURCES); } - if (!BTM_SetSecurityLevel (FALSE, serv_name, BTM_SEC_SERVICE_HID_INTR, + if (!BTM_SetSecurityLevel (FALSE, serv_name, BTM_SEC_SERVICE_HID_INTR, BTM_SEC_NONE, HID_PSM_INTERRUPT, BTM_SEC_PROTO_HID, 0)) { HIDH_TRACE_ERROR0 ("Security Registration 6 failed"); diff --git a/stack/hid/hidh_conn.c b/stack/hid/hidh_conn.c index 2664dcf..29c4025 100644 --- a/stack/hid/hidh_conn.c +++ b/stack/hid/hidh_conn.c @@ -46,7 +46,7 @@ static void hidh_l2cif_data_ind (UINT16 l2cap_cid, BT_HDR *p_msg); static void hidh_l2cif_disconnect_cfm (UINT16 l2cap_cid, UINT16 result); static void hidh_l2cif_cong_ind (UINT16 l2cap_cid, BOOLEAN congested); -static const tL2CAP_APPL_INFO hst_reg_info = +static const tL2CAP_APPL_INFO hst_reg_info = { hidh_l2cif_connect_ind, hidh_l2cif_connect_cfm, @@ -159,18 +159,18 @@ void hidh_sec_check_complete_term (BD_ADDR bd_addr, void *p_ref_data, UINT8 res) p_dev->conn.conn_state = HID_CONN_STATE_CONNECTING_INTR; /* Send response to the L2CAP layer. */ - L2CA_ConnectRsp (p_dev->addr, p_dev->conn.ctrl_id, p_dev->conn.ctrl_cid, L2CAP_CONN_OK, L2CAP_CONN_OK); + L2CA_ConnectRsp (p_dev->addr, p_dev->conn.ctrl_id, p_dev->conn.ctrl_cid, L2CAP_CONN_OK, L2CAP_CONN_OK); /* Send a Configuration Request. */ L2CA_ConfigReq (p_dev->conn.ctrl_cid, &hh_cb.l2cap_cfg); - + } /* security check fail */ - else if (res != BTM_SUCCESS) + else if (res != BTM_SUCCESS) { p_dev->conn.disc_reason = HID_ERR_AUTH_FAILED; /* Save reason for disconnecting */ p_dev->conn.conn_state = HID_CONN_STATE_UNUSED; - L2CA_ConnectRsp (p_dev->addr, p_dev->conn.ctrl_id, p_dev->conn.ctrl_cid, L2CAP_CONN_SECURITY_BLOCK, L2CAP_CONN_OK); + L2CA_ConnectRsp (p_dev->addr, p_dev->conn.ctrl_id, p_dev->conn.ctrl_cid, L2CAP_CONN_SECURITY_BLOCK, L2CAP_CONN_OK); } } @@ -180,7 +180,7 @@ void hidh_sec_check_complete_term (BD_ADDR bd_addr, void *p_ref_data, UINT8 res) ** ** Description This function handles an inbound connection indication ** from L2CAP. This is the case where we are acting as a -** server. +** server. ** ** Returns void ** @@ -190,7 +190,7 @@ static void hidh_l2cif_connect_ind (BD_ADDR bd_addr, UINT16 l2cap_cid, UINT16 p tHID_CONN *p_hcon; BOOLEAN bAccept = TRUE; int i; - tHID_HOST_DEV_CTB *p_dev; + tHID_HOST_DEV_CTB *p_dev; HIDH_TRACE_EVENT2 ("HID - Rcvd L2CAP conn ind, PSM: 0x%04x CID 0x%x", psm, l2cap_cid); @@ -228,7 +228,7 @@ static void hidh_l2cif_connect_ind (BD_ADDR bd_addr, UINT16 l2cap_cid, UINT16 p #if defined(HID_HOST_ACPT_NEW_CONN) && (HID_HOST_ACPT_NEW_CONN == TRUE) p_hcon->ctrl_cid = p_hcon->intr_cid = 0; p_hcon->conn_state = HID_CONN_STATE_UNUSED; -#else +#else if (p_hcon->conn_state != HID_CONN_STATE_UNUSED) { HIDH_TRACE_WARNING1 ("HID - Rcvd CTL L2CAP conn ind, wrong state: %d", p_hcon->conn_state); @@ -251,12 +251,12 @@ static void hidh_l2cif_connect_ind (BD_ADDR bd_addr, UINT16 l2cap_cid, UINT16 p p_hcon->disc_reason = HID_L2CAP_CONN_FAIL; /* In case disconnection occurs before security is completed, then set CLOSE_EVT reason code to 'connection failure' */ p_hcon->conn_state = HID_CONN_STATE_SECURITY; - if(btm_sec_mx_access_request (p_dev->addr, HID_PSM_CONTROL, - FALSE, BTM_SEC_PROTO_HID, + if(btm_sec_mx_access_request (p_dev->addr, HID_PSM_CONTROL, + FALSE, BTM_SEC_PROTO_HID, (p_dev->attr_mask & HID_SEC_REQUIRED) ? HID_SEC_CHN : HID_NOSEC_CHN, &hidh_sec_check_complete_term, p_dev) == BTM_CMD_STARTED) { - L2CA_ConnectRsp (bd_addr, l2cap_id, l2cap_cid, L2CAP_CONN_PENDING, L2CAP_CONN_OK); + L2CA_ConnectRsp (bd_addr, l2cap_id, l2cap_cid, L2CAP_CONN_PENDING, L2CAP_CONN_OK); } return; @@ -267,7 +267,7 @@ static void hidh_l2cif_connect_ind (BD_ADDR bd_addr, UINT16 l2cap_cid, UINT16 p p_hcon->intr_cid = l2cap_cid; /* Send response to the L2CAP layer. */ - L2CA_ConnectRsp (bd_addr, l2cap_id, l2cap_cid, L2CAP_CONN_OK, L2CAP_CONN_OK); + L2CA_ConnectRsp (bd_addr, l2cap_id, l2cap_cid, L2CAP_CONN_OK, L2CAP_CONN_OK); /* Send a Configuration Request. */ L2CA_ConfigReq (l2cap_cid, &hh_cb.l2cap_cfg); @@ -342,12 +342,12 @@ void hidh_sec_check_complete_orig (BD_ADDR bd_addr, void *p_ref_data, UINT8 res) hidh_conn_retry (dhandle); return; } - else + else cb_res = HID_L2CAP_CONN_FAIL | HCI_ERR_PAGE_TIMEOUT ; } #endif p_dev->conn.disc_reason = HID_ERR_AUTH_FAILED; /* Save reason for disconnecting */ - hidh_conn_disconnect(dhandle); + hidh_conn_disconnect(dhandle); } } @@ -368,7 +368,7 @@ static void hidh_l2cif_connect_cfm (UINT16 l2cap_cid, UINT16 result) UINT8 dhandle; tHID_CONN *p_hcon = NULL; UINT32 reason; - tHID_HOST_DEV_CTB *p_dev = NULL; + tHID_HOST_DEV_CTB *p_dev = NULL; /* Find CCB based on CID, and verify we are in a state to accept this message */ if( (dhandle = find_conn_by_cid(l2cap_cid)) < HID_HOST_MAX_DEVICES ) @@ -397,7 +397,7 @@ static void hidh_l2cif_connect_cfm (UINT16 l2cap_cid, UINT16 result) #if (HID_HOST_MAX_CONN_RETRY > 0) if( (hh_cb.devices[dhandle].conn_tries <= HID_HOST_MAX_CONN_RETRY) && - (result == HCI_ERR_CONNECTION_TOUT || result == HCI_ERR_UNSPECIFIED || + (result == HCI_ERR_CONNECTION_TOUT || result == HCI_ERR_UNSPECIFIED || result == HCI_ERR_PAGE_TIMEOUT) ) { hidh_conn_retry(dhandle); @@ -417,8 +417,8 @@ static void hidh_l2cif_connect_cfm (UINT16 l2cap_cid, UINT16 result) p_hcon->conn_state = HID_CONN_STATE_SECURITY; p_hcon->disc_reason = HID_L2CAP_CONN_FAIL; /* In case disconnection occurs before security is completed, then set CLOSE_EVT reason code to "connection failure" */ - btm_sec_mx_access_request (p_dev->addr, HID_PSM_CONTROL, - TRUE, BTM_SEC_PROTO_HID, + btm_sec_mx_access_request (p_dev->addr, HID_PSM_CONTROL, + TRUE, BTM_SEC_PROTO_HID, (p_dev->attr_mask & HID_SEC_REQUIRED) ? HID_SEC_CHN : HID_NOSEC_CHN, &hidh_sec_check_complete_orig, p_dev); } @@ -448,7 +448,7 @@ static void hidh_l2cif_config_ind (UINT16 l2cap_cid, tL2CAP_CFG_INFO *p_cfg) { UINT8 dhandle; tHID_CONN *p_hcon = NULL; - tHID_HOST_DEV_CTB *p_dev; + tHID_HOST_DEV_CTB *p_dev; /* Find CCB based on CID */ if( (dhandle = find_conn_by_cid(l2cap_cid)) < HID_HOST_MAX_DEVICES ) @@ -597,7 +597,7 @@ static void hidh_l2cif_disconnect_ind (UINT16 l2cap_cid, BOOLEAN ack_needed) disc_res = btm_get_acl_disc_reason_code(); #if (HID_HOST_MAX_CONN_RETRY > 0) - if( (disc_res == HCI_ERR_CONNECTION_TOUT || disc_res == HCI_ERR_UNSPECIFIED) && + if( (disc_res == HCI_ERR_CONNECTION_TOUT || disc_res == HCI_ERR_UNSPECIFIED) && (!(hh_cb.devices[dhandle].attr_mask & HID_RECONN_INIT)) && (hh_cb.devices[dhandle].attr_mask & HID_NORMALLY_CONNECTABLE)) { @@ -612,7 +612,7 @@ static void hidh_l2cif_disconnect_ind (UINT16 l2cap_cid, BOOLEAN ack_needed) hid_close_evt_reason = p_hcon->disc_reason; /* If we got baseband sent HCI_DISCONNECT_COMPLETE_EVT due to security failure, then set reason to HID_ERR_AUTH_FAILED */ - if ((disc_res == HCI_ERR_AUTH_FAILURE) || + if ((disc_res == HCI_ERR_AUTH_FAILURE) || (disc_res == HCI_ERR_KEY_MISSING) || (disc_res == HCI_ERR_HOST_REJECT_SECURITY) || (disc_res == HCI_ERR_PAIRING_NOT_ALLOWED) || @@ -775,13 +775,13 @@ static void hidh_l2cif_data_ind (UINT16 l2cap_cid, BT_HDR *p_msg) case HID_TRANS_DATA: - evt = (hh_cb.devices[dhandle].conn.intr_cid == l2cap_cid) ? + evt = (hh_cb.devices[dhandle].conn.intr_cid == l2cap_cid) ? HID_HDEV_EVT_INTR_DATA : HID_HDEV_EVT_CTRL_DATA; hh_cb.callback(dhandle, evt, rep_type, p_msg); break; case HID_TRANS_DATAC: - evt = (hh_cb.devices[dhandle].conn.intr_cid == l2cap_cid) ? + evt = (hh_cb.devices[dhandle].conn.intr_cid == l2cap_cid) ? HID_HDEV_EVT_INTR_DATC : HID_HDEV_EVT_CTRL_DATC; hh_cb.callback(dhandle, evt, rep_type, p_msg); break; @@ -802,7 +802,7 @@ static void hidh_l2cif_data_ind (UINT16 l2cap_cid, BT_HDR *p_msg) ** Returns tHID_STATUS ** *******************************************************************************/ -tHID_STATUS hidh_conn_snd_data (UINT8 dhandle, UINT8 trans_type, UINT8 param, +tHID_STATUS hidh_conn_snd_data (UINT8 dhandle, UINT8 trans_type, UINT8 param, UINT16 data, UINT8 report_id, BT_HDR *buf) { tHID_CONN *p_hcon = &hh_cb.devices[dhandle].conn; diff --git a/stack/hid/hidh_int.h b/stack/hid/hidh_int.h index 6be1337..8e1a8a2 100644 --- a/stack/hid/hidh_int.h +++ b/stack/hid/hidh_int.h @@ -28,7 +28,7 @@ typedef struct per_device_ctb UINT16 attr_mask; /* 0x01- virtual_cable; 0x02- normally_connectable; 0x03- reconn_initiate; 0x04- sdp_disable; */ UINT8 state; /* Device state if in HOST-KNOWN mode */ - UINT8 conn_substate; + UINT8 conn_substate; UINT8 conn_tries; /* Remembers to the number of connection attempts while CONNECTING */ tHID_CONN conn; /* L2CAP channel info */ @@ -43,7 +43,7 @@ typedef struct host_ctb #define MAX_SERVICE_DB_SIZE 4000 BOOLEAN sdp_busy; - tHID_HOST_SDP_CALLBACK *sdp_cback; + tHID_HOST_SDP_CALLBACK *sdp_cback; tSDP_DISCOVERY_DB *p_sdp_db; tHID_DEV_SDP_INFO sdp_rec; BOOLEAN reg_flag; |