diff options
author | Matthew Xie <mattx@google.com> | 2012-09-18 16:19:52 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-09-18 16:19:53 -0700 |
commit | f80d3d045eab5f002be4b5e8a3d2d376fdf7581a (patch) | |
tree | 4a1f17241e1af019e8d3328852bf93423258a23c /stack/l2cap | |
parent | d659d3ca8cbb1edc5d1dd42ef367e9336f0f269b (diff) | |
parent | ad2d45b15aae80ba254277c3d1fa036207d8b926 (diff) | |
download | external_bluetooth_bluedroid-f80d3d045eab5f002be4b5e8a3d2d376fdf7581a.zip external_bluetooth_bluedroid-f80d3d045eab5f002be4b5e8a3d2d376fdf7581a.tar.gz external_bluetooth_bluedroid-f80d3d045eab5f002be4b5e8a3d2d376fdf7581a.tar.bz2 |
Merge "Revert "Header file and whitespace cleanups"" into jb-mr1-dev
Diffstat (limited to 'stack/l2cap')
-rw-r--r-- | stack/l2cap/l2c_api.c | 100 | ||||
-rw-r--r-- | stack/l2cap/l2c_ble.c | 38 | ||||
-rw-r--r-- | stack/l2cap/l2c_csm.c | 38 | ||||
-rw-r--r-- | stack/l2cap/l2c_fcr.c | 50 | ||||
-rw-r--r-- | stack/l2cap/l2c_int.h | 6 | ||||
-rw-r--r-- | stack/l2cap/l2c_link.c | 66 | ||||
-rw-r--r-- | stack/l2cap/l2c_main.c | 20 | ||||
-rw-r--r-- | stack/l2cap/l2c_ucd.c | 36 | ||||
-rw-r--r-- | stack/l2cap/l2c_utils.c | 100 |
9 files changed, 227 insertions, 227 deletions
diff --git a/stack/l2cap/l2c_api.c b/stack/l2cap/l2c_api.c index 8800df4..476ded1 100644 --- a/stack/l2cap/l2c_api.c +++ b/stack/l2cap/l2c_api.c @@ -31,7 +31,7 @@ ** services. ** ** Returns PSM to use or zero if error. Typically, the PSM returned -** is the same as was passed in, but for an outgoing-only +** is the same as was passed in, but for an outgoing-only ** connection to a dynamic PSM, a "virtual" PSM is returned ** and should be used in the calls to L2CA_ConnectReq(), ** L2CA_ErtmConnectReq() and L2CA_Deregister() @@ -150,7 +150,7 @@ void L2CA_Deregister (UINT16 psm) ** Description Other layers call this function to find an unused PSM for L2CAP ** services. ** -** Returns PSM to use. +** Returns PSM to use. ** *******************************************************************************/ UINT16 L2CA_AllocatePSM(void) @@ -221,8 +221,8 @@ UINT16 L2CA_ErtmConnectReq (UINT16 psm, BD_ADDR p_bd_addr, tL2CAP_ERTM_INFO *p_e tL2C_RCB *p_rcb; L2CAP_TRACE_API6 ("L2CA_ErtmConnectReq() PSM: 0x%04x BDA: %08x%04x p_ertm_info: 0x%08x allowed:0x%x preferred:%d", psm, - (p_bd_addr[0]<<24)+(p_bd_addr[1]<<16)+(p_bd_addr[2]<<8)+p_bd_addr[3], - (p_bd_addr[4]<<8)+p_bd_addr[5], p_ertm_info, + (p_bd_addr[0]<<24)+(p_bd_addr[1]<<16)+(p_bd_addr[2]<<8)+p_bd_addr[3], + (p_bd_addr[4]<<8)+p_bd_addr[5], p_ertm_info, (p_ertm_info) ? p_ertm_info->allowed_modes : 0, (p_ertm_info) ? p_ertm_info->preferred_mode : 0); /* Fail if we have not established communications with the controller */ @@ -341,9 +341,9 @@ BOOLEAN L2CA_ErtmConnectRsp (BD_ADDR p_bd_addr, UINT8 id, UINT16 lcid, UINT16 re tL2C_LCB *p_lcb; tL2C_CCB *p_ccb; - L2CAP_TRACE_API6 ("L2CA_ErtmConnectRsp() CID: 0x%04x Result: %d Status: %d BDA: %08x%04x p_ertm_info:0x%08x", + L2CAP_TRACE_API6 ("L2CA_ErtmConnectRsp() CID: 0x%04x Result: %d Status: %d BDA: %08x%04x p_ertm_info:0x%08x", lcid, result, status, - (p_bd_addr[0]<<24)+(p_bd_addr[1]<<16)+(p_bd_addr[2]<<8)+p_bd_addr[3], + (p_bd_addr[0]<<24)+(p_bd_addr[1]<<16)+(p_bd_addr[2]<<8)+p_bd_addr[3], (p_bd_addr[4]<<8)+p_bd_addr[5], p_ertm_info); /* First, find the link control block */ @@ -424,7 +424,7 @@ BOOLEAN L2CA_ConfigReq (UINT16 cid, tL2CAP_CFG_INFO *p_cfg) { tL2C_CCB *p_ccb; - L2CAP_TRACE_API5 ("L2CA_ConfigReq() CID 0x%04x: fcr_present:%d (mode %d) mtu_present:%d (%d)", + L2CAP_TRACE_API5 ("L2CA_ConfigReq() CID 0x%04x: fcr_present:%d (mode %d) mtu_present:%d (%d)", cid, p_cfg->fcr_present, p_cfg->fcr.mode, p_cfg->mtu_present, p_cfg->mtu); /* Find the channel control block. We don't know the link it is on. */ @@ -475,7 +475,7 @@ BOOLEAN L2CA_ConfigRsp (UINT16 cid, tL2CAP_CFG_INFO *p_cfg) { tL2C_CCB *p_ccb; - L2CAP_TRACE_API6 ("L2CA_ConfigRsp() CID: 0x%04x Result: %d MTU present:%d Flush TO:%d FCR:%d FCS:%d", + L2CAP_TRACE_API6 ("L2CA_ConfigRsp() CID: 0x%04x Result: %d MTU present:%d Flush TO:%d FCR:%d FCS:%d", cid, p_cfg->result, p_cfg->mtu_present, p_cfg->flush_to_present, p_cfg->fcr_present, p_cfg->fcs_present); /* Find the channel control block. We don't know the link it is on. */ @@ -537,7 +537,7 @@ BOOLEAN L2CA_DisconnectReq (UINT16 cid) ** ** Function L2CA_DisconnectRsp ** -** Description Higher layers call this function to acknowledge the +** Description Higher layers call this function to acknowledge the ** disconnection of a channel. ** ** Returns void @@ -663,7 +663,7 @@ BOOLEAN L2CA_Echo (BD_ADDR p_bd_addr, BT_HDR *p_data, tL2CA_ECHO_DATA_CB *p_cal L2CAP_TRACE_ERROR0 ("L2CA_Echo ERROR : link not established"); return FALSE; } - + if (p_lcb->link_state != LST_CONNECTED) { L2CAP_TRACE_ERROR0 ("L2CA_Echo ERROR : link is not connected"); @@ -679,7 +679,7 @@ BOOLEAN L2CA_Echo (BD_ADDR p_bd_addr, BT_HDR *p_data, tL2CA_ECHO_DATA_CB *p_cal l2cu_send_peer_echo_req (p_lcb, pp, p_data->len); return (TRUE); - + } /******************************************************************************* @@ -735,18 +735,18 @@ BOOLEAN L2CA_SetIdleTimeout (UINT16 cid, UINT16 timeout, BOOLEAN is_global) ** Function L2CA_SetIdleTimeoutByBdAddr ** ** Description Higher layers call this function to set the idle timeout for -** a connection. The "idle timeout" is the amount of time that -** a connection can remain up with no L2CAP channels on it. -** A timeout of zero means that the connection will be torn -** down immediately when the last channel is removed. -** A timeout of 0xFFFF means no timeout. Values are in seconds. -** A bd_addr is the remote BD address. If bd_addr = BT_BD_ANY, -** then the idle timeouts for all active l2cap links will be +** a connection. The "idle timeout" is the amount of time that +** a connection can remain up with no L2CAP channels on it. +** A timeout of zero means that the connection will be torn +** down immediately when the last channel is removed. +** A timeout of 0xFFFF means no timeout. Values are in seconds. +** A bd_addr is the remote BD address. If bd_addr = BT_BD_ANY, +** then the idle timeouts for all active l2cap links will be ** changed. ** ** Returns TRUE if command succeeded, FALSE if failed ** -** NOTE This timeout applies to all logical channels active on the +** NOTE This timeout applies to all logical channels active on the ** ACL link. *******************************************************************************/ BOOLEAN L2CA_SetIdleTimeoutByBdAddr(BD_ADDR bd_addr, UINT16 timeout) @@ -908,7 +908,7 @@ UINT16 L2CA_LocalLoopbackReq (UINT16 psm, UINT16 handle, BD_ADDR p_bd_addr) BOOLEAN L2CA_SetAclPriority (BD_ADDR bd_addr, UINT8 priority) { L2CAP_TRACE_API6 ("L2CA_SetAclPriority() bdaddr: %02x%02x%02x%02x%04x, priority:%d", - bd_addr[0], bd_addr[1], bd_addr[2], + bd_addr[0], bd_addr[1], bd_addr[2], bd_addr[3], (bd_addr[4] << 8) + bd_addr[5], priority); return (l2cu_set_acl_priority(bd_addr, priority, FALSE)); @@ -1056,21 +1056,21 @@ BOOLEAN L2CA_SetChnlDataRate (UINT16 cid, tL2CAP_CHNL_DATA_RATE tx, tL2CAP_CHNL_ ** ** Function L2CA_SetFlushTimeout ** -** Description This function set the automatic flush time out in Baseband +** Description This function set the automatic flush time out in Baseband ** for ACL-U packets. ** BdAddr : the remote BD address of ACL link. If it is BT_DB_ANY ** then the flush time out will be applied to all ACL link. ** FlushTimeout: flush time out in ms -** 0x0000 : No automatic flush -** L2CAP_NO_RETRANSMISSION : No retransmission -** 0x0002 - 0xFFFE : flush time out, if (flush_tout*8)+3/5) +** 0x0000 : No automatic flush +** L2CAP_NO_RETRANSMISSION : No retransmission +** 0x0002 - 0xFFFE : flush time out, if (flush_tout*8)+3/5) ** <= HCI_MAX_AUTO_FLUSH_TOUT (in 625us slot). ** Otherwise, return FALSE. -** L2CAP_NO_AUTOMATIC_FLUSH : No automatic flush +** L2CAP_NO_AUTOMATIC_FLUSH : No automatic flush ** ** Returns TRUE if command succeeded, FALSE if failed ** -** NOTE This flush timeout applies to all logical channels active on the +** NOTE This flush timeout applies to all logical channels active on the ** ACL link. *******************************************************************************/ BOOLEAN L2CA_SetFlushTimeout (BD_ADDR bd_addr, UINT16 flush_tout) @@ -1094,7 +1094,7 @@ BOOLEAN L2CA_SetFlushTimeout (BD_ADDR bd_addr, UINT16 flush_tout) hci_flush_to = flush_tout; } /* no automatic flush (infinite timeout) */ - else if (flush_tout == L2CAP_NO_AUTOMATIC_FLUSH) + else if (flush_tout == L2CAP_NO_AUTOMATIC_FLUSH) { hci_flush_to = 0x0000; } @@ -1125,7 +1125,7 @@ BOOLEAN L2CA_SetFlushTimeout (BD_ADDR bd_addr, UINT16 flush_tout) { p_lcb->link_flush_tout = flush_tout; - L2CAP_TRACE_API4 ("L2CA_SetFlushTimeout 0x%04x ms for bd_addr [...;%02x%02x%02x]", + L2CAP_TRACE_API4 ("L2CA_SetFlushTimeout 0x%04x ms for bd_addr [...;%02x%02x%02x]", flush_tout, bd_addr[3], bd_addr[4], bd_addr[5]); if (!btsnd_hcic_write_auto_flush_tout (p_lcb->handle, hci_flush_to)) @@ -1134,7 +1134,7 @@ BOOLEAN L2CA_SetFlushTimeout (BD_ADDR bd_addr, UINT16 flush_tout) } else { - L2CAP_TRACE_WARNING3 ("WARNING L2CA_SetFlushTimeout No lcb for bd_addr [...;%02x%02x%02x]", + L2CAP_TRACE_WARNING3 ("WARNING L2CA_SetFlushTimeout No lcb for bd_addr [...;%02x%02x%02x]", bd_addr[3], bd_addr[4], bd_addr[5]); return (FALSE); } @@ -1152,8 +1152,8 @@ BOOLEAN L2CA_SetFlushTimeout (BD_ADDR bd_addr, UINT16 flush_tout) { p_lcb->link_flush_tout = flush_tout; - L2CAP_TRACE_API4 ("L2CA_SetFlushTimeout 0x%04x ms for bd_addr [...;%02x%02x%02x]", - flush_tout, p_lcb->remote_bd_addr[3], + L2CAP_TRACE_API4 ("L2CA_SetFlushTimeout 0x%04x ms for bd_addr [...;%02x%02x%02x]", + flush_tout, p_lcb->remote_bd_addr[3], p_lcb->remote_bd_addr[4], p_lcb->remote_bd_addr[5]); if (!btsnd_hcic_write_auto_flush_tout(p_lcb->handle, hci_flush_to)) @@ -1185,14 +1185,14 @@ BOOLEAN L2CA_GetPeerFeatures (BD_ADDR bd_addr, UINT32 *p_ext_feat, UINT8 *p_chnl /* We must already have a link to the remote */ if ((p_lcb = l2cu_find_lcb_by_bd_addr (bd_addr)) == NULL) { - L2CAP_TRACE_WARNING2 ("L2CA_GetPeerFeatures() No BDA: %08x%04x", - (bd_addr[0]<<24)+(bd_addr[1]<<16)+(bd_addr[2]<<8)+bd_addr[3], + L2CAP_TRACE_WARNING2 ("L2CA_GetPeerFeatures() No BDA: %08x%04x", + (bd_addr[0]<<24)+(bd_addr[1]<<16)+(bd_addr[2]<<8)+bd_addr[3], (bd_addr[4]<<8)+bd_addr[5]); return (FALSE); } - L2CAP_TRACE_API4 ("L2CA_GetPeerFeatures() BDA: %08x%04x ExtFea: 0x%08x Chnl_Mask[0]: 0x%02x", - (bd_addr[0]<<24)+(bd_addr[1]<<16)+(bd_addr[2]<<8)+bd_addr[3], + L2CAP_TRACE_API4 ("L2CA_GetPeerFeatures() BDA: %08x%04x ExtFea: 0x%08x Chnl_Mask[0]: 0x%02x", + (bd_addr[0]<<24)+(bd_addr[1]<<16)+(bd_addr[2]<<8)+bd_addr[3], (bd_addr[4]<<8)+bd_addr[5], p_lcb->peer_ext_fea, p_lcb->peer_chnl_mask[0]); *p_ext_feat = p_lcb->peer_ext_fea; @@ -1218,7 +1218,7 @@ BOOLEAN L2CA_GetBDAddrbyHandle (UINT16 handle, BD_ADDR bd_addr) { tL2C_LCB *p_lcb = NULL; BOOLEAN found_dev = FALSE; - + p_lcb = l2cu_find_lcb_by_handle (handle); if (p_lcb) { @@ -1299,7 +1299,7 @@ BOOLEAN L2CA_ConnectFixedChnl (UINT16 fixed_cid, BD_ADDR rem_bda) UINT16 reason; #endif - L2CAP_TRACE_API3 ("L2CA_ConnectFixedChnl() CID: 0x%04x BDA: %08x%04x", fixed_cid, + L2CAP_TRACE_API3 ("L2CA_ConnectFixedChnl() CID: 0x%04x BDA: %08x%04x", fixed_cid, (rem_bda[0]<<24)+(rem_bda[1]<<16)+(rem_bda[2]<<8)+rem_bda[3], (rem_bda[4]<<8)+rem_bda[5]); /* Check CID is valid and registered */ @@ -1322,7 +1322,7 @@ BOOLEAN L2CA_ConnectFixedChnl (UINT16 fixed_cid, BD_ADDR rem_bda) { if (!(p_lcb->peer_chnl_mask[0] & (1 << fixed_cid))) { - L2CAP_TRACE_EVENT3 ("L2CA_ConnectFixedChnl() CID: 0x%04x BDA: %08x%04x not supported", fixed_cid, + L2CAP_TRACE_EVENT3 ("L2CA_ConnectFixedChnl() CID: 0x%04x BDA: %08x%04x not supported", fixed_cid, (rem_bda[0]<<24)+(rem_bda[1]<<16)+(rem_bda[2]<<8)+rem_bda[3], (rem_bda[4]<<8)+rem_bda[5]); return (FALSE); } @@ -1368,7 +1368,7 @@ BOOLEAN L2CA_ConnectFixedChnl (UINT16 fixed_cid, BD_ADDR rem_bda) ** ** Parameters: Fixed CID ** BD Address of remote -** Pointer to buffer of type BT_HDR +** Pointer to buffer of type BT_HDR ** ** Return value L2CAP_DW_SUCCESS, if data accepted ** L2CAP_DW_FAILED, if error @@ -1378,7 +1378,7 @@ UINT16 L2CA_SendFixedChnlData (UINT16 fixed_cid, BD_ADDR rem_bda, BT_HDR *p_buf) { tL2C_LCB *p_lcb; - L2CAP_TRACE_API3 ("L2CA_SendFixedChnlData() CID: 0x%04x BDA: %08x%04x", fixed_cid, + L2CAP_TRACE_API3 ("L2CA_SendFixedChnlData() CID: 0x%04x BDA: %08x%04x", fixed_cid, (rem_bda[0]<<24)+(rem_bda[1]<<16)+(rem_bda[2]<<8)+rem_bda[3], (rem_bda[4]<<8)+rem_bda[5]); /* Check CID is valid and registered */ @@ -1464,7 +1464,7 @@ BOOLEAN L2CA_RemoveFixedChnl (UINT16 fixed_cid, BD_ADDR rem_bda) p_lcb = l2cu_find_lcb_by_bd_addr (rem_bda); if ( ((p_lcb) == NULL) || (!p_lcb->p_fixed_ccbs[fixed_cid - L2CAP_FIRST_FIXED_CHNL]) ) { - L2CAP_TRACE_WARNING3 ("L2CA_RemoveFixedChnl() CID: 0x%04x BDA: %08x%04x not connected", fixed_cid, + L2CAP_TRACE_WARNING3 ("L2CA_RemoveFixedChnl() CID: 0x%04x BDA: %08x%04x not connected", fixed_cid, (rem_bda[0]<<24)+(rem_bda[1]<<16)+(rem_bda[2]<<8)+rem_bda[3], (rem_bda[4]<<8)+rem_bda[5]); return (FALSE); } @@ -1489,11 +1489,11 @@ BOOLEAN L2CA_RemoveFixedChnl (UINT16 fixed_cid, BD_ADDR rem_bda) ** Description Higher layers call this function to set the idle timeout for ** a fixed channel. The "idle timeout" is the amount of time that ** a connection can remain up with no L2CAP channels on it. -** A timeout of zero means that the connection will be torn -** down immediately when the last channel is removed. -** A timeout of 0xFFFF means no timeout. Values are in seconds. -** A bd_addr is the remote BD address. If bd_addr = BT_BD_ANY, -** then the idle timeouts for all active l2cap links will be +** A timeout of zero means that the connection will be torn +** down immediately when the last channel is removed. +** A timeout of 0xFFFF means no timeout. Values are in seconds. +** A bd_addr is the remote BD address. If bd_addr = BT_BD_ANY, +** then the idle timeouts for all active l2cap links will be ** changed. ** ** Returns TRUE if command succeeded, FALSE if failed @@ -1507,7 +1507,7 @@ BOOLEAN L2CA_SetFixedChannelTout (BD_ADDR rem_bda, UINT16 fixed_cid, UINT16 idle p_lcb = l2cu_find_lcb_by_bd_addr (rem_bda); if ( ((p_lcb) == NULL) || (!p_lcb->p_fixed_ccbs[fixed_cid - L2CAP_FIRST_FIXED_CHNL]) ) { - L2CAP_TRACE_WARNING3 ("L2CA_SetFixedChannelTout() CID: 0x%04x BDA: %08x%04x not connected", fixed_cid, + L2CAP_TRACE_WARNING3 ("L2CA_SetFixedChannelTout() CID: 0x%04x BDA: %08x%04x not connected", fixed_cid, (rem_bda[0]<<24)+(rem_bda[1]<<16)+(rem_bda[2]<<8)+rem_bda[3], (rem_bda[4]<<8)+rem_bda[5]); return (FALSE); } @@ -1538,7 +1538,7 @@ BOOLEAN L2CA_SetFixedChannelTout (BD_ADDR rem_bda, UINT16 fixed_cid, UINT16 idle ** Returns TRUE if successful ** *******************************************************************************/ -BOOLEAN L2CA_GetCurrentConfig (UINT16 lcid, +BOOLEAN L2CA_GetCurrentConfig (UINT16 lcid, tL2CAP_CFG_INFO **pp_our_cfg, tL2CAP_CH_CFG_BITS *p_our_cfg_bits, tL2CAP_CFG_INFO **pp_peer_cfg, tL2CAP_CH_CFG_BITS *p_peer_cfg_bits) { @@ -1628,7 +1628,7 @@ UINT8 L2CA_DataWrite (UINT16 cid, BT_HDR *p_data) ** ** Function L2CA_SetChnlFlushability ** -** Description Higher layers call this function to set a channels +** Description Higher layers call this function to set a channels ** flushability flags ** ** Returns TRUE if CID found, else FALSE @@ -1673,7 +1673,7 @@ BOOLEAN L2CA_SetChnlFlushability (UINT16 cid, BOOLEAN is_flushable) *******************************************************************************/ UINT8 L2CA_DataWriteEx (UINT16 cid, BT_HDR *p_data, UINT16 flags) { - L2CAP_TRACE_API3 ("L2CA_DataWriteEx() CID: 0x%04x Len: %d Flags:0x%04X", + L2CAP_TRACE_API3 ("L2CA_DataWriteEx() CID: 0x%04x Len: %d Flags:0x%04X", cid, p_data->len, flags); return l2c_data_write (cid, p_data, flags); } diff --git a/stack/l2cap/l2c_ble.c b/stack/l2cap/l2c_ble.c index 8c686f9..8c69dee 100644 --- a/stack/l2cap/l2c_ble.c +++ b/stack/l2cap/l2c_ble.c @@ -63,7 +63,7 @@ BOOLEAN L2CA_CancelBleConnectReq (BD_ADDR rem_bda) btm_ble_update_bg_state(); btm_ble_resume_bg_conn(NULL, TRUE); - return(TRUE); + return(TRUE); } else return(FALSE); @@ -163,19 +163,19 @@ BOOLEAN L2CA_EnableUpdateBleConnParams (BD_ADDR rem_bda, BOOLEAN enable) p_lcb->upd_disabled = UPD_ENABLED; } } - else + else { - /* application requests to disable parameters update. If parameters are already updated, lets set them + /* application requests to disable parameters update. If parameters are already updated, lets set them up to what has been requested during connection establishement */ if (p_lcb->upd_disabled == UPD_UPDATED) { tBTM_SEC_DEV_REC *p_dev_rec = btm_find_or_alloc_dev (rem_bda); - btsnd_hcic_ble_upd_ll_conn_params (p_lcb->handle, + btsnd_hcic_ble_upd_ll_conn_params (p_lcb->handle, (UINT16)((p_dev_rec->conn_params.min_conn_int != BTM_BLE_CONN_PARAM_UNDEF) ? p_dev_rec->conn_params.min_conn_int : L2CAP_LE_INT_MIN), (UINT16)((p_dev_rec->conn_params.max_conn_int != BTM_BLE_CONN_PARAM_UNDEF) ? p_dev_rec->conn_params.max_conn_int : L2CAP_LE_INT_MAX), - (UINT16)((p_dev_rec->conn_params.slave_latency != BTM_BLE_CONN_PARAM_UNDEF) ? p_dev_rec->conn_params.slave_latency : 0), - (UINT16) ((p_dev_rec->conn_params.supervision_tout != BTM_BLE_CONN_PARAM_UNDEF) ? p_dev_rec->conn_params.supervision_tout : L2CAP_LE_TIMEOUT_MAX), + (UINT16)((p_dev_rec->conn_params.slave_latency != BTM_BLE_CONN_PARAM_UNDEF) ? p_dev_rec->conn_params.slave_latency : 0), + (UINT16) ((p_dev_rec->conn_params.supervision_tout != BTM_BLE_CONN_PARAM_UNDEF) ? p_dev_rec->conn_params.supervision_tout : L2CAP_LE_TIMEOUT_MAX), 0, 0); } p_lcb->upd_disabled = UPD_DISABLED; @@ -295,21 +295,21 @@ void l2cble_scanner_conn_comp (UINT16 handle, BD_ADDR bda, tBLE_ADDR_TYPE type, (p_dev_rec->conn_params.slave_latency <= L2CAP_LE_LATENCY_MAX ) && (p_dev_rec->conn_params.supervision_tout >= L2CAP_LE_TIMEOUT_MIN) && (p_dev_rec->conn_params.supervision_tout <= L2CAP_LE_TIMEOUT_MAX) && - ((conn_interval < p_dev_rec->conn_params.min_conn_int && - p_dev_rec->conn_params.min_conn_int != BTM_BLE_CONN_PARAM_UNDEF) || - (conn_interval > p_dev_rec->conn_params.max_conn_int) || - (conn_latency > p_dev_rec->conn_params.slave_latency) || + ((conn_interval < p_dev_rec->conn_params.min_conn_int && + p_dev_rec->conn_params.min_conn_int != BTM_BLE_CONN_PARAM_UNDEF) || + (conn_interval > p_dev_rec->conn_params.max_conn_int) || + (conn_latency > p_dev_rec->conn_params.slave_latency) || (conn_timeout > p_dev_rec->conn_params.supervision_tout))) { L2CAP_TRACE_ERROR5 ("upd_ll_conn_params: HANDLE=%d min_conn_int=%d max_conn_int=%d slave_latency=%d supervision_tout=%d", handle, p_dev_rec->conn_params.min_conn_int, p_dev_rec->conn_params.max_conn_int, p_dev_rec->conn_params.slave_latency, p_dev_rec->conn_params.supervision_tout); - btsnd_hcic_ble_upd_ll_conn_params (handle, - p_dev_rec->conn_params.min_conn_int, + btsnd_hcic_ble_upd_ll_conn_params (handle, + p_dev_rec->conn_params.min_conn_int, p_dev_rec->conn_params.max_conn_int, - p_dev_rec->conn_params.slave_latency, - p_dev_rec->conn_params.supervision_tout, + p_dev_rec->conn_params.slave_latency, + p_dev_rec->conn_params.supervision_tout, 0, 0); } @@ -318,7 +318,7 @@ void l2cble_scanner_conn_comp (UINT16 handle, BD_ADDR bda, tBLE_ADDR_TYPE type, if (p_lcb->p_echo_rsp_cb) { - L2CAP_TRACE_ERROR0 ("l2cu_send_peer_echo_req"); + L2CAP_TRACE_ERROR0 ("l2cu_send_peer_echo_req"); l2cu_send_peer_echo_req (p_lcb, NULL, 0); } @@ -399,7 +399,7 @@ void l2cble_advertiser_conn_comp (UINT16 handle, BD_ADDR bda, tBLE_ADDR_TYPE typ ** Returns void ** *******************************************************************************/ -void l2cble_conn_comp(UINT16 handle, UINT8 role, BD_ADDR bda, tBLE_ADDR_TYPE type, +void l2cble_conn_comp(UINT16 handle, UINT8 role, BD_ADDR bda, tBLE_ADDR_TYPE type, UINT16 conn_interval, UINT16 conn_latency, UINT16 conn_timeout) { if (role == HCI_ROLE_MASTER) @@ -415,7 +415,7 @@ void l2cble_conn_comp(UINT16 handle, UINT8 role, BD_ADDR bda, tBLE_ADDR_TYPE typ ** ** Function l2cble_process_sig_cmd ** -** Description This function is called when a signalling packet is received +** Description This function is called when a signalling packet is received ** on the BLE signalling CID ** ** Returns void @@ -464,7 +464,7 @@ void l2cble_process_sig_cmd (tL2C_LCB *p_lcb, UINT8 *p, UINT16 pkt_len) { if (min_interval < L2CAP_LE_INT_MIN || min_interval > L2CAP_LE_INT_MAX || max_interval < L2CAP_LE_INT_MIN || max_interval > L2CAP_LE_INT_MAX || - latency > L2CAP_LE_LATENCY_MAX || + latency > L2CAP_LE_LATENCY_MAX || /*(timeout >= max_interval && latency > (timeout * 10/(max_interval * 1.25) - 1)) ||*/ timeout < L2CAP_LE_TIMEOUT_MIN || timeout > L2CAP_LE_TIMEOUT_MAX || max_interval < min_interval) @@ -514,7 +514,7 @@ void l2cble_process_sig_cmd (tL2C_LCB *p_lcb, UINT8 *p, UINT16 pkt_len) ** ** Function l2cble_create_conn ** -** Description This function initiates an acl connection via HCI +** Description This function initiates an acl connection via HCI ** ** Returns TRUE if successful, FALSE if connection not started. ** diff --git a/stack/l2cap/l2c_csm.c b/stack/l2cap/l2c_csm.c index 67de4f4..216f45b 100644 --- a/stack/l2cap/l2c_csm.c +++ b/stack/l2cap/l2c_csm.c @@ -154,13 +154,13 @@ static void l2c_csm_closed (tL2C_CCB *p_ccb, UINT16 event, void *p_data) case L2CEVT_LP_CONNECT_CFM: /* Link came up */ p_ccb->chnl_state = CST_ORIG_W4_SEC_COMP; - btm_sec_l2cap_access_req (p_ccb->p_lcb->remote_bd_addr, p_ccb->p_rcb->psm, + btm_sec_l2cap_access_req (p_ccb->p_lcb->remote_bd_addr, p_ccb->p_rcb->psm, p_ccb->p_lcb->handle, TRUE, &l2c_link_sec_comp, p_ccb); break; case L2CEVT_LP_CONNECT_CFM_NEG: /* Link failed */ /* Disconnect unless ACL collision and upper layer wants to handle it */ - if (p_ci->status != HCI_ERR_CONNECTION_EXISTS + if (p_ci->status != HCI_ERR_CONNECTION_EXISTS || !btm_acl_notif_conn_collision(p_ccb->p_lcb->remote_bd_addr)) { L2CAP_TRACE_API2 ("L2CAP - Calling ConnectCfm_Cb(), CID: 0x%04x Status: %d", p_ccb->local_cid, p_ci->status); @@ -182,9 +182,9 @@ static void l2c_csm_closed (tL2C_CCB *p_ccb, UINT16 event, void *p_data) Event uninit_use_in_call: Using uninitialized value "settings" (field "settings".timeout uninitialized) in call to function "BTM_SetPowerMode" [details] Event uninit_use_in_call: Using uninitialized value "settings.max" in call to function "BTM_SetPowerMode" [details] Event uninit_use_in_call: Using uninitialized value "settings.min" in call to function "BTM_SetPowerMode" -// FALSE-POSITIVE error from Coverity test-tool. Please do NOT remove following comment. -// coverity[uninit_use_in_call] False-positive: setting the mode to BTM_PM_MD_ACTIVE only uses settings.mode the other data members of tBTM_PM_PWR_MD are ignored -*/ +// FALSE-POSITIVE error from Coverity test-tool. Please do NOT remove following comment. +// coverity[uninit_use_in_call] False-positive: setting the mode to BTM_PM_MD_ACTIVE only uses settings.mode the other data members of tBTM_PM_PWR_MD are ignored +*/ BTM_SetPowerMode (BTM_PM_SET_ONLY_ID, p_ccb->p_lcb->remote_bd_addr, &settings); } #else @@ -192,7 +192,7 @@ Event uninit_use_in_call: Using uninitialized value "settings.min" in call to fu #endif /* If sec access does not result in started SEC_COM or COMP_NEG are already processed */ - if (btm_sec_l2cap_access_req (p_ccb->p_lcb->remote_bd_addr, p_ccb->p_rcb->psm, + if (btm_sec_l2cap_access_req (p_ccb->p_lcb->remote_bd_addr, p_ccb->p_rcb->psm, p_ccb->p_lcb->handle, TRUE, &l2c_link_sec_comp, p_ccb) == BTM_CMD_STARTED) p_ccb->chnl_state = CST_ORIG_W4_SEC_COMP; break; @@ -239,9 +239,9 @@ Event uninit_use_in_call: Using uninitialized value "settings.min" in call to fu Event uninit_use_in_call: Using uninitialized value "settings" (field "settings".timeout uninitialized) in call to function "BTM_SetPowerMode" [details] Event uninit_use_in_call: Using uninitialized value "settings.max" in call to function "BTM_SetPowerMode" [details] Event uninit_use_in_call: Using uninitialized value "settings.min" in call to function "BTM_SetPowerMode" -// FALSE-POSITIVE error from Coverity test-tool. Please do NOT remove following comment. -// coverity[uninit_use_in_call] False-positive: setting the mode to BTM_PM_MD_ACTIVE only uses settings.mode the other data members of tBTM_PM_PWR_MD are ignored -*/ +// FALSE-POSITIVE error from Coverity test-tool. Please do NOT remove following comment. +// coverity[uninit_use_in_call] False-positive: setting the mode to BTM_PM_MD_ACTIVE only uses settings.mode the other data members of tBTM_PM_PWR_MD are ignored +*/ BTM_SetPowerMode (BTM_PM_SET_ONLY_ID, p_ccb->p_lcb->remote_bd_addr, &settings); } #else @@ -249,7 +249,7 @@ Event uninit_use_in_call: Using uninitialized value "settings.min" in call to fu #endif p_ccb->chnl_state = CST_TERM_W4_SEC_COMP; - if (btm_sec_l2cap_access_req (p_ccb->p_lcb->remote_bd_addr, p_ccb->p_rcb->psm, + if (btm_sec_l2cap_access_req (p_ccb->p_lcb->remote_bd_addr, p_ccb->p_rcb->psm, p_ccb->p_lcb->handle, FALSE, &l2c_link_sec_comp, p_ccb) == BTM_CMD_STARTED) { /* started the security process, tell the peer to set a longer timer */ @@ -319,7 +319,7 @@ static void l2c_csm_orig_w4_sec_comp (tL2C_CCB *p_ccb, UINT16 event, void *p_dat case L2CEVT_SEC_RE_SEND_CMD: /* BTM has enough info to proceed */ case L2CEVT_LP_CONNECT_CFM: /* Link came up */ - btm_sec_l2cap_access_req (p_ccb->p_lcb->remote_bd_addr, p_ccb->p_rcb->psm, + btm_sec_l2cap_access_req (p_ccb->p_lcb->remote_bd_addr, p_ccb->p_rcb->psm, p_ccb->p_lcb->handle, TRUE, &l2c_link_sec_comp, p_ccb); break; @@ -426,11 +426,11 @@ static void l2c_csm_term_w4_sec_comp (tL2C_CCB *p_ccb, UINT16 event, void *p_dat else { /* - ** L2CAP Connect Response will be sent out by 3 sec timer expiration - ** because Bluesoleil doesn't respond to L2CAP Information Request. - ** Bluesoleil seems to disconnect ACL link as failure case, because - ** it takes too long (4~7secs) to get response. - ** product version : Bluesoleil 2.1.1.0 EDR Release 060123 + ** L2CAP Connect Response will be sent out by 3 sec timer expiration + ** because Bluesoleil doesn't respond to L2CAP Information Request. + ** Bluesoleil seems to disconnect ACL link as failure case, because + ** it takes too long (4~7secs) to get response. + ** product version : Bluesoleil 2.1.1.0 EDR Release 060123 ** stack version : 05.04.11.20060119 */ @@ -480,7 +480,7 @@ static void l2c_csm_term_w4_sec_comp (tL2C_CCB *p_ccb, UINT16 event, void *p_dat break; case L2CEVT_SEC_RE_SEND_CMD: /* BTM has enough info to proceed */ - btm_sec_l2cap_access_req (p_ccb->p_lcb->remote_bd_addr, p_ccb->p_rcb->psm, + btm_sec_l2cap_access_req (p_ccb->p_lcb->remote_bd_addr, p_ccb->p_rcb->psm, p_ccb->p_lcb->handle, FALSE, &l2c_link_sec_comp, p_ccb); break; } @@ -736,7 +736,7 @@ static void l2c_csm_config (tL2C_CCB *p_ccb, UINT16 event, void *p_data) if (p_cfg->result != L2CAP_CFG_PENDING) { /* TBD: When config options grow beyong minimum MTU (48 bytes) - * logic needs to be added to handle responses with + * logic needs to be added to handle responses with * continuation bit set in flags field. * 1. Send additional config request out until C-bit is cleared in response */ @@ -1007,7 +1007,7 @@ static void l2c_csm_open (tL2C_CCB *p_ccb, UINT16 event, void *p_data) BTM_CancelSniffMode (p_ccb->p_lcb->remote_bd_addr); #endif // btla-specific -- - + p_ccb->chnl_state = CST_W4_L2CA_DISCONNECT_RSP; btu_start_timer (&p_ccb->timer_entry, BTU_TTYPE_L2CAP_CHNL, L2CAP_CHNL_DISCONNECT_TOUT); L2CAP_TRACE_API1 ("L2CAP - Calling Disconnect_Ind_Cb(), CID: 0x%04x Conf Needed", p_ccb->local_cid); diff --git a/stack/l2cap/l2c_fcr.c b/stack/l2cap/l2c_fcr.c index c8126be..25a9b3f 100644 --- a/stack/l2cap/l2c_fcr.c +++ b/stack/l2cap/l2c_fcr.c @@ -107,7 +107,7 @@ unsigned short l2c_fcr_updcrc(unsigned short icrc, unsigned char *icp, int icnt) register unsigned char *cp = icp; register int cnt = icnt; - while (cnt--) + while (cnt--) { crc = ((crc >> 8) & 0xff) ^ crctab[(crc & 0xff) ^ *cp++]; } @@ -254,14 +254,14 @@ void l2c_fcr_cleanup (tL2C_CCB *p_ccb) if (p_str) { sprintf(p_str, "Sent Pkts:%08u Bytes:%10u(%06u/sec) RR:%08u REJ:%08u RNR:%08u SREJ:%08u", - p_ccb->fcrb.ertm_pkt_counts[0], p_ccb->fcrb.ertm_byte_counts[0], + p_ccb->fcrb.ertm_pkt_counts[0], p_ccb->fcrb.ertm_byte_counts[0], (dur >= 10 ? (p_ccb->fcrb.ertm_byte_counts[0] * 100) / (dur / 10) : 0), p_ccb->fcrb.s_frames_sent[0], p_ccb->fcrb.s_frames_sent[1], p_ccb->fcrb.s_frames_sent[2], p_ccb->fcrb.s_frames_sent[3]); BT_TRACE_1(TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI , TRACE_TYPE_GENERIC, "%s", p_str); sprintf(p_str, "Rcvd Pkts:%08u Bytes:%10u(%06u/sec) RR:%08u REJ:%08u RNR:%08u SREJ:%08u", - p_ccb->fcrb.ertm_pkt_counts[1], p_ccb->fcrb.ertm_byte_counts[1], + p_ccb->fcrb.ertm_pkt_counts[1], p_ccb->fcrb.ertm_byte_counts[1], (dur >= 10 ? (p_ccb->fcrb.ertm_byte_counts[1] * 100) / (dur / 10) : 0), p_ccb->fcrb.s_frames_rcvd[0], p_ccb->fcrb.s_frames_rcvd[1], p_ccb->fcrb.s_frames_rcvd[2], p_ccb->fcrb.s_frames_rcvd[3]); @@ -280,7 +280,7 @@ void l2c_fcr_cleanup (tL2C_CCB *p_ccb) continue; } - sprintf(p_str, "[%02u] throughput: %5u, ack_delay avg:%3u, min:%3u, max:%3u, ack_q_count avg:%3u, min:%3u, max:%3u", + sprintf(p_str, "[%02u] throughput: %5u, ack_delay avg:%3u, min:%3u, max:%3u, ack_q_count avg:%3u, min:%3u, max:%3u", i, p_ccb->fcrb.throughput[i], p_ccb->fcrb.ack_delay_avg[i], p_ccb->fcrb.ack_delay_min[i], p_ccb->fcrb.ack_delay_max[i], p_ccb->fcrb.ack_q_count_avg[i], p_ccb->fcrb.ack_q_count_min[i], p_ccb->fcrb.ack_q_count_max[i] ); @@ -297,7 +297,7 @@ void l2c_fcr_cleanup (tL2C_CCB *p_ccb) ack_q_count_avg /= (L2CAP_ERTM_STATS_NUM_AVG - 1); BT_TRACE_3(TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI , TRACE_TYPE_GENERIC, - "throughput_avg: %8u (kbytes/sec), ack_delay_avg: %8u ms, ack_q_count_avg: %8u", + "throughput_avg: %8u (kbytes/sec), ack_delay_avg: %8u ms, ack_q_count_avg: %8u", throughput_avg, ack_delay_avg, ack_q_count_avg ); GKI_freebuf(p_str); @@ -853,7 +853,7 @@ void l2c_fcr_proc_pdu (tL2C_CCB *p_ccb, BT_HDR *p_buf) void l2c_fcr_proc_tout (tL2C_CCB *p_ccb) { L2CAP_TRACE_DEBUG5 ("l2c_fcr_proc_tout: CID: 0x%04x num_tries: %u (max: %u) wait_ack: %u ack_q_count: %u", - p_ccb->local_cid, p_ccb->fcrb.num_tries, p_ccb->peer_cfg.fcr.max_transmit, + p_ccb->local_cid, p_ccb->fcrb.num_tries, p_ccb->peer_cfg.fcr.max_transmit, p_ccb->fcrb.wait_ack, p_ccb->fcrb.waiting_for_ack_q.count); #if (L2CAP_ERTM_STATS == TRUE) @@ -888,7 +888,7 @@ void l2c_fcr_proc_tout (tL2C_CCB *p_ccb) *******************************************************************************/ void l2c_fcr_proc_ack_tout (tL2C_CCB *p_ccb) { - L2CAP_TRACE_DEBUG5 ("l2c_fcr_proc_ack_tout: CID: 0x%04x State: %u Wack:%u Rq:%d Acked:%d", p_ccb->local_cid, + L2CAP_TRACE_DEBUG5 ("l2c_fcr_proc_ack_tout: CID: 0x%04x State: %u Wack:%u Rq:%d Acked:%d", p_ccb->local_cid, p_ccb->chnl_state, p_ccb->fcrb.wait_ack, p_ccb->fcrb.next_seq_expected, p_ccb->fcrb.last_ack_sent); if ( (p_ccb->chnl_state == CST_OPEN) && (!p_ccb->fcrb.wait_ack) @@ -1232,7 +1232,7 @@ static void process_i_frame (tL2C_CCB *p_ccb, BT_HDR *p_buf, UINT16 ctrl_word, B /* Seq number is the next expected. Clear possible reject exception in case it occured */ p_fcrb->rej_sent = p_fcrb->srej_sent = FALSE; - /* Adjust the next_seq, so that if the upper layer sends more data in the callback + /* Adjust the next_seq, so that if the upper layer sends more data in the callback context, the received frame is acked by an I-frame. */ p_fcrb->next_seq_expected = (tx_seq + 1) & L2CAP_FCR_SEQ_MODULO; @@ -1259,7 +1259,7 @@ static void process_i_frame (tL2C_CCB *p_ccb, BT_HDR *p_buf, UINT16 ctrl_word, B /* If it is the first I frame we did not ack, start ack timer */ if (!p_ccb->fcrb.ack_timer.in_use) { - btu_start_quick_timer (&p_ccb->fcrb.ack_timer, BTU_TTYPE_L2CAP_FCR_ACK, + btu_start_quick_timer (&p_ccb->fcrb.ack_timer, BTU_TTYPE_L2CAP_FCR_ACK, (L2CAP_FCR_ACK_TOUT*QUICK_TIMER_TICKS_PER_SEC)/1000); } } @@ -1475,7 +1475,7 @@ static BOOLEAN do_sar_reassembly (tL2C_CCB *p_ccb, BT_HDR *p_buf, UINT16 ctrl_wo { #if (L2CAP_NUM_FIXED_CHNLS > 0) if (p_ccb->local_cid < L2CAP_BASE_APPL_CID) - (*l2cb.fixed_reg[p_ccb->local_cid - L2CAP_FIRST_FIXED_CHNL].pL2CA_FixedData_Cb)(p_ccb->p_lcb->remote_bd_addr, p_buf); + (*l2cb.fixed_reg[p_ccb->local_cid - L2CAP_FIRST_FIXED_CHNL].pL2CA_FixedData_Cb)(p_ccb->p_lcb->remote_bd_addr, p_buf); else #endif l2c_csm_execute (p_ccb, L2CEVT_L2CAP_DATA, p_buf); @@ -1506,7 +1506,7 @@ static BOOLEAN retransmit_i_frames (tL2C_CCB *p_ccb, UINT8 tx_seq) && (p_ccb->fcrb.num_tries >= p_ccb->peer_cfg.fcr.max_transmit) ) { L2CAP_TRACE_EVENT5 ("Max Tries Exceeded: (last_acq: %d CID: 0x%04x num_tries: %u (max: %u) ack_q_count: %u", - p_ccb->fcrb.last_rx_ack, p_ccb->local_cid, p_ccb->fcrb.num_tries, p_ccb->peer_cfg.fcr.max_transmit, + p_ccb->fcrb.last_rx_ack, p_ccb->local_cid, p_ccb->fcrb.num_tries, p_ccb->peer_cfg.fcr.max_transmit, p_ccb->fcrb.waiting_for_ack_q.count); l2cu_disconnect_chnl (p_ccb); @@ -1667,7 +1667,7 @@ BT_HDR *l2c_fcr_get_next_xmit_sdu_seg (tL2C_CCB *p_ccb, UINT16 max_packet_length mid_seg = TRUE; /* Get a new buffer and copy the data that can be sent in a PDU */ - p_xmit = l2c_fcr_clone_buf (p_buf, L2CAP_MIN_OFFSET + L2CAP_SDU_LEN_OFFSET, + p_xmit = l2c_fcr_clone_buf (p_buf, L2CAP_MIN_OFFSET + L2CAP_SDU_LEN_OFFSET, max_pdu, p_ccb->ertm_info.fcr_tx_pool_id); if (p_xmit != NULL) @@ -1834,7 +1834,7 @@ UINT8 l2c_fcr_chk_chan_modes (tL2C_CCB *p_ccb) ** ** Function l2c_fcr_adj_our_req_options ** -** Description Validates and sets up the FCR options passed in from +** Description Validates and sets up the FCR options passed in from ** L2CA_ConfigReq based on remote device's features. ** ** Returns TRUE if no errors, Otherwise FALSE @@ -1951,7 +1951,7 @@ BOOLEAN l2c_fcr_adj_our_req_options (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg) ** ** Function l2c_fcr_adj_monitor_retran_timeout ** -** Description Overrides monitor/retrans timer value based on controller +** Description Overrides monitor/retrans timer value based on controller ** ** Returns None ** @@ -1962,7 +1962,7 @@ void l2c_fcr_adj_monitor_retran_timeout (tL2C_CCB *p_ccb) if (p_ccb->out_cfg_fcr_present) { /* - ** if we requestd ERTM or accepted ERTM + ** if we requestd ERTM or accepted ERTM ** We may accept ERTM even if we didn't request ERTM, in case of requesting STREAM */ if ((p_ccb->our_cfg.fcr.mode == L2CAP_FCR_ERTM_MODE) @@ -1986,7 +1986,7 @@ void l2c_fcr_adj_monitor_retran_timeout (tL2C_CCB *p_ccb) ** ** Function l2c_fcr_adj_our_rsp_options ** -** Description Overrides any neccesary FCR options passed in from +** Description Overrides any neccesary FCR options passed in from ** L2CA_ConfigRsp based on our FCR options. ** Only makes adjustments if channel is in ERTM mode. ** @@ -2012,7 +2012,7 @@ void l2c_fcr_adj_our_rsp_options (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg) p_ccb->peer_cfg.fcr.tx_win_sz = p_ccb->our_cfg.fcr.tx_win_sz; } // btla-specific -- - + p_cfg->fcr.mode = p_ccb->peer_cfg.fcr.mode; p_cfg->fcr.tx_win_sz = p_ccb->peer_cfg.fcr.tx_win_sz; p_cfg->fcr.max_transmit = p_ccb->peer_cfg.fcr.max_transmit; @@ -2027,7 +2027,7 @@ void l2c_fcr_adj_our_rsp_options (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg) ** Function l2c_fcr_renegotiate_chan ** ** Description Called upon unsuccessful peer response to config request. -** If the error is because of the channel mode, it will try +** If the error is because of the channel mode, it will try ** to resend using another supported optional channel. ** ** Returns TRUE if resent configuration, False if channel matches or @@ -2106,7 +2106,7 @@ BOOLEAN l2c_fcr_renegotiate_chan(tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg) p_cfg->mtu = L2CAP_MTU_SIZE; } } - + l2cu_process_our_cfg_req (p_ccb, &p_ccb->our_cfg); l2cu_send_peer_config_req (p_ccb, &p_ccb->our_cfg); btu_start_timer (&p_ccb->timer_entry, BTU_TTYPE_L2CAP_CHNL, L2CAP_CHNL_CFG_TIMEOUT); @@ -2146,7 +2146,7 @@ UINT8 l2c_fcr_process_peer_cfg_req(tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg) p_ccb->p_lcb->w4_info_rsp = FALSE; /* Handles T61x SonyEricsson Bug in Info Request */ L2CAP_TRACE_EVENT5 ("l2c_fcr_process_peer_cfg_req() CFG fcr_present:%d fcr.mode:%d CCB FCR mode:%d preferred: %u allowed:%u", - p_cfg->fcr_present, p_cfg->fcr.mode, p_ccb->our_cfg.fcr.mode, p_ccb->ertm_info.preferred_mode, + p_cfg->fcr_present, p_cfg->fcr.mode, p_ccb->our_cfg.fcr.mode, p_ccb->ertm_info.preferred_mode, p_ccb->ertm_info.allowed_modes); /* If Peer wants basic, we are done (accept it or disconnect) */ @@ -2181,10 +2181,10 @@ UINT8 l2c_fcr_process_peer_cfg_req(tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg) p_cfg->fcr.max_transmit = p_cfg->fcr.tx_win_sz = 0; p_cfg->fcr.rtrans_tout = p_cfg->fcr.mon_tout = p_cfg->fcr.mps = 0; p_ccb->our_cfg.fcr.rtrans_tout = p_ccb->our_cfg.fcr.mon_tout = p_ccb->our_cfg.fcr.mps = 0; - fcr_ok = L2CAP_PEER_CFG_UNACCEPTABLE; + fcr_ok = L2CAP_PEER_CFG_UNACCEPTABLE; } - /* Only other valid case is if they want ERTM and we wanted STM which should be + /* Only other valid case is if they want ERTM and we wanted STM which should be accepted if we support it; otherwise the channel should be disconnected */ else if ( (p_cfg->fcr.mode != L2CAP_FCR_ERTM_MODE) || !(p_ccb->ertm_info.allowed_modes & L2CAP_FCR_CHAN_OPT_ERTM) ) @@ -2669,7 +2669,7 @@ static void l2c_fcr_collect_ack_delay (tL2C_CCB *p_ccb, UINT8 num_bufs_acked) p_ccb->fcrb.throughput_start = timestamp; - sprintf(str, "[%02u] throughput: %5u, ack_delay avg:%3u, min:%3u, max:%3u, ack_q_count avg:%3u, min:%3u, max:%3u", + sprintf(str, "[%02u] throughput: %5u, ack_delay avg:%3u, min:%3u, max:%3u, ack_q_count avg:%3u, min:%3u, max:%3u", index, p_ccb->fcrb.throughput[index], p_ccb->fcrb.ack_delay_avg[index], p_ccb->fcrb.ack_delay_min[index], p_ccb->fcrb.ack_delay_max[index], p_ccb->fcrb.ack_q_count_avg[index], p_ccb->fcrb.ack_q_count_min[index], p_ccb->fcrb.ack_q_count_max[index] ); @@ -2678,12 +2678,12 @@ static void l2c_fcr_collect_ack_delay (tL2C_CCB *p_ccb, UINT8 num_bufs_acked) index = (index + 1) % L2CAP_ERTM_STATS_NUM_AVG; p_ccb->fcrb.ack_delay_avg_index = index; - + p_ccb->fcrb.ack_q_count_max[index] = 0; p_ccb->fcrb.ack_q_count_min[index] = 0xFFFFFFFF; p_ccb->fcrb.ack_q_count_avg[index] = 0; - + p_ccb->fcrb.ack_delay_max[index] = 0; p_ccb->fcrb.ack_delay_min[index] = 0xFFFFFFFF; p_ccb->fcrb.ack_delay_avg[index] = 0; diff --git a/stack/l2cap/l2c_int.h b/stack/l2cap/l2c_int.h index dcbe8dc..0630e12 100644 --- a/stack/l2cap/l2c_int.h +++ b/stack/l2cap/l2c_int.h @@ -293,7 +293,7 @@ typedef struct t_l2c_ccb UINT8 flags; tL2CAP_CFG_INFO our_cfg; /* Our saved configuration options */ - tL2CAP_CH_CFG_BITS peer_cfg_bits; /* Store what peer wants to configure */ + tL2CAP_CH_CFG_BITS peer_cfg_bits; /* Store what peer wants to configure */ tL2CAP_CFG_INFO peer_cfg; /* Peer's saved configuration options */ BUFFER_Q xmit_hold_q; /* Transmit data hold queue */ @@ -332,7 +332,7 @@ typedef struct t_l2c_ccb /*********************************************************************** ** Define a queue of linked CCBs. */ -typedef struct +typedef struct { tL2C_CCB *p_first_ccb; /* The first channel in this queue */ tL2C_CCB *p_last_ccb; /* The last channel in this queue */ @@ -745,7 +745,7 @@ extern void l2c_fcr_stop_timer (tL2C_CCB *p_ccb); #if (BLE_INCLUDED == TRUE) extern BOOLEAN l2cble_create_conn (tL2C_LCB *p_lcb); extern void l2cble_process_sig_cmd (tL2C_LCB *p_lcb, UINT8 *p, UINT16 pkt_len); -extern void l2cble_conn_comp (UINT16 handle, UINT8 role, BD_ADDR bda, tBLE_ADDR_TYPE type, +extern void l2cble_conn_comp (UINT16 handle, UINT8 role, BD_ADDR bda, tBLE_ADDR_TYPE type, UINT16 conn_interval, UINT16 conn_latency, UINT16 conn_timeout); #endif diff --git a/stack/l2cap/l2c_link.c b/stack/l2cap/l2c_link.c index 8da26be..2183888 100644 --- a/stack/l2cap/l2c_link.c +++ b/stack/l2cap/l2c_link.c @@ -389,7 +389,7 @@ BOOLEAN l2c_link_hci_disc_comp (UINT16 handle, UINT8 reason) /* If waiting for disconnect and reconnect is pending start the reconnect now race condition where layer above issued connect request on link that was - disconnecting + disconnecting */ if (p_lcb->ccb_queue.p_first_ccb != NULL) { @@ -481,12 +481,12 @@ void l2c_link_timeout (tL2C_LCB *p_lcb) UINT16 timeout; tBTM_STATUS rc; - L2CAP_TRACE_EVENT3 ("L2CAP - l2c_link_timeout() link state %d first CCB %p is_bonding:%d", + L2CAP_TRACE_EVENT3 ("L2CAP - l2c_link_timeout() link state %d first CCB %p is_bonding:%d", p_lcb->link_state, p_lcb->ccb_queue.p_first_ccb, p_lcb->is_bonding); /* If link was connecting or disconnecting, clear all channels and drop the LCB */ if ((p_lcb->link_state == LST_CONNECTING_WAIT_SWITCH) || - (p_lcb->link_state == LST_CONNECTING) || + (p_lcb->link_state == LST_CONNECTING) || (p_lcb->link_state == LST_CONNECT_HOLDING) || (p_lcb->link_state == LST_DISCONNECTING)) { @@ -503,7 +503,7 @@ void l2c_link_timeout (tL2C_LCB *p_lcb) p_ccb = pn; } #if (BLE_INCLUDED == TRUE) - if (p_lcb->link_state == LST_CONNECTING && + if (p_lcb->link_state == LST_CONNECTING && l2cb.is_ble_connecting == TRUE) { L2CA_CancelBleConnectReq(l2cb.ble_connecting_bda); @@ -661,7 +661,7 @@ void l2c_link_adjust_allocation (void) UINT16 hi_quota, low_quota; UINT16 num_lowpri_links = 0; UINT16 num_hipri_links = 0; - UINT16 controller_xmit_quota = l2cb.num_lm_acl_bufs; + UINT16 controller_xmit_quota = l2cb.num_lm_acl_bufs; UINT16 high_pri_link_quota = L2CAP_HIGH_PRI_MIN_XMIT_QUOTA_A; /* If no links active, nothing to do. */ @@ -758,8 +758,8 @@ void l2c_link_adjust_allocation (void) /* There is a special case where we have readjusted the link quotas and */ /* this link may have sent anything but some other link sent packets so */ /* so we may need a timer to kick off this link's transmissions. */ - if ( (p_lcb->link_state == LST_CONNECTED) - && (p_lcb->link_xmit_data_q.count) + if ( (p_lcb->link_state == LST_CONNECTED) + && (p_lcb->link_xmit_data_q.count) && (p_lcb->sent_not_acked < p_lcb->link_xmit_quota) ) btu_start_timer (&p_lcb->timer_entry, BTU_TTYPE_L2CAP_LINK, L2CAP_LINK_FLOW_CONTROL_TOUT); } @@ -803,7 +803,7 @@ void l2c_link_adjust_chnl_allocation (void) /* channel required higher data rate will get more buffer quota */ for (xx = 0; xx < MAX_L2CAP_CHANNELS; xx++) { - p_ccb = l2cb.ccb_pool + xx; + p_ccb = l2cb.ccb_pool + xx; if (!p_ccb->in_use) continue; @@ -844,7 +844,7 @@ void l2c_link_adjust_chnl_allocation (void) else quota_per_weighted_chnls[xx] = 1; - L2CAP_TRACE_DEBUG5 ("POOL ID:%d, GKI_poolcount = %d, reserved_buff = %d, weighted_chnls = %d, quota_per_weighted_chnls = %d", + L2CAP_TRACE_DEBUG5 ("POOL ID:%d, GKI_poolcount = %d, reserved_buff = %d, weighted_chnls = %d, quota_per_weighted_chnls = %d", xx, GKI_poolcount(xx), reserved_buff[xx], weighted_chnls[xx], quota_per_weighted_chnls[xx] ); } else @@ -855,7 +855,7 @@ void l2c_link_adjust_chnl_allocation (void) /* assign buffer quota to each channel based on its data rate requirement */ for (xx = 0; xx < MAX_L2CAP_CHANNELS; xx++) { - p_ccb = l2cb.ccb_pool + xx; + p_ccb = l2cb.ccb_pool + xx; if (!p_ccb->in_use) continue; @@ -1046,14 +1046,14 @@ BOOLEAN l2c_link_check_power_mode (tL2C_LCB *p_lcb) { L2CAP_TRACE_DEBUG1 ("LCB(0x%x) is in park mode", p_lcb->handle); // Coverity: -// FALSE-POSITIVE error from Coverity test tool. Please do NOT remove following comment. +// FALSE-POSITIVE error from Coverity test tool. Please do NOT remove following comment. // coverity[uninit_use_in_call] False-positive: setting the mode to BTM_PM_MD_ACTIVE only uses settings.mode the other data members of tBTM_PM_PWR_MD are ignored memset((void*)&pm, 0, sizeof(pm)); pm.mode = BTM_PM_MD_ACTIVE; BTM_SetPowerMode(BTM_PM_SET_ONLY_ID, p_lcb->remote_bd_addr, &pm); - btu_start_timer (&p_lcb->timer_entry, + btu_start_timer (&p_lcb->timer_entry, BTU_TTYPE_L2CAP_LINK, L2CAP_WAIT_UNPARK_TOUT); return TRUE; } @@ -1062,7 +1062,7 @@ BOOLEAN l2c_link_check_power_mode (tL2C_LCB *p_lcb) { L2CAP_TRACE_DEBUG1 ("LCB(0x%x) is in PM pending state", p_lcb->handle); - btu_start_timer (&p_lcb->timer_entry, + btu_start_timer (&p_lcb->timer_entry, BTU_TTYPE_L2CAP_LINK, L2CAP_WAIT_UNPARK_TOUT); return TRUE; } @@ -1126,11 +1126,11 @@ void l2c_link_check_send_pkts (tL2C_LCB *p_lcb, tL2C_CCB *p_ccb, BT_HDR *p_buf) for (xx = 0; xx < MAX_L2CAP_LINKS; xx++, p_lcb++) { /* If controller window is full, nothing to do */ - if ( (l2cb.controller_xmit_window == 0 + if ( (l2cb.controller_xmit_window == 0 #if (BLE_INCLUDED == TRUE) - && !p_lcb->is_ble_link + && !p_lcb->is_ble_link #endif - ) + ) #if (BLE_INCLUDED == TRUE) || (p_lcb->is_ble_link && l2cb.controller_le_xmit_window == 0 ) #endif @@ -1188,7 +1188,7 @@ void l2c_link_check_send_pkts (tL2C_LCB *p_lcb, tL2C_CCB *p_ccb, BT_HDR *p_buf) /* See if we can send anything from the link queue */ #if (BLE_INCLUDED == TRUE) while ( ((l2cb.controller_xmit_window != 0 && !p_lcb->is_ble_link) || - (l2cb.controller_le_xmit_window != 0 && p_lcb->is_ble_link)) + (l2cb.controller_le_xmit_window != 0 && p_lcb->is_ble_link)) && (p_lcb->sent_not_acked < p_lcb->link_xmit_quota)) #else while ( (l2cb.controller_xmit_window != 0) @@ -1207,7 +1207,7 @@ void l2c_link_check_send_pkts (tL2C_LCB *p_lcb, tL2C_CCB *p_ccb, BT_HDR *p_buf) /* See if we can send anything for any channel */ #if (BLE_INCLUDED == TRUE) while ( ((l2cb.controller_xmit_window != 0 && !p_lcb->is_ble_link) || - (l2cb.controller_le_xmit_window != 0 && p_lcb->is_ble_link)) + (l2cb.controller_le_xmit_window != 0 && p_lcb->is_ble_link)) && (p_lcb->sent_not_acked < p_lcb->link_xmit_quota)) #else while ((l2cb.controller_xmit_window != 0) && (p_lcb->sent_not_acked < p_lcb->link_xmit_quota)) @@ -1256,7 +1256,7 @@ static BOOLEAN l2c_link_send_to_lower (tL2C_LCB *p_lcb, BT_HDR *p_buf) p_lcb->sent_not_acked++; p_buf->layer_specific = 0; - + #if (BLE_INCLUDED == TRUE) if (p_lcb->is_ble_link) { @@ -1342,8 +1342,8 @@ static BOOLEAN l2c_link_send_to_lower (tL2C_LCB *p_lcb, BT_HDR *p_buf) if (p_lcb->is_ble_link) { L2CAP_TRACE_DEBUG6 ("TotalWin=%d,Hndl=0x%x,Quota=%d,Unack=%d,RRQuota=%d,RRUnack=%d", - l2cb.controller_le_xmit_window, - p_lcb->handle, + l2cb.controller_le_xmit_window, + p_lcb->handle, p_lcb->link_xmit_quota, p_lcb->sent_not_acked, l2cb.round_robin_quota, l2cb.round_robin_unacked); } @@ -1351,8 +1351,8 @@ static BOOLEAN l2c_link_send_to_lower (tL2C_LCB *p_lcb, BT_HDR *p_buf) #endif { L2CAP_TRACE_DEBUG6 ("TotalWin=%d,Hndl=0x%x,Quota=%d,Unack=%d,RRQuota=%d,RRUnack=%d", - l2cb.controller_xmit_window, - p_lcb->handle, + l2cb.controller_xmit_window, + p_lcb->handle, p_lcb->link_xmit_quota, p_lcb->sent_not_acked, l2cb.round_robin_quota, l2cb.round_robin_unacked); } @@ -1403,7 +1403,7 @@ void l2c_link_process_num_completed_pkts (UINT8 *p) #endif { - /* Maintain the total window to the controller */ + /* Maintain the total window to the controller */ l2cb.controller_xmit_window += num_sent; } @@ -1428,7 +1428,7 @@ void l2c_link_process_num_completed_pkts (UINT8 *p) l2c_link_check_send_pkts (p_lcb, NULL, NULL); /* If we were doing round-robin for low priority links, check 'em */ - if ( (p_lcb->acl_priority == L2CAP_PRIORITY_HIGH) + if ( (p_lcb->acl_priority == L2CAP_PRIORITY_HIGH) && (l2cb.check_round_robin) && (l2cb.round_robin_unacked < l2cb.round_robin_quota) ) { @@ -1443,7 +1443,7 @@ void l2c_link_process_num_completed_pkts (UINT8 *p) if (p_lcb->is_ble_link) { L2CAP_TRACE_DEBUG5 ("TotalWin=%d,LinkUnack(0x%x)=%d,RRCheck=%d,RRUnack=%d", - l2cb.controller_le_xmit_window, + l2cb.controller_le_xmit_window, p_lcb->handle, p_lcb->sent_not_acked, l2cb.check_round_robin, l2cb.round_robin_unacked); } @@ -1451,7 +1451,7 @@ void l2c_link_process_num_completed_pkts (UINT8 *p) #endif { L2CAP_TRACE_DEBUG5 ("TotalWin=%d,LinkUnack(0x%x)=%d,RRCheck=%d,RRUnack=%d", - l2cb.controller_xmit_window, + l2cb.controller_xmit_window, p_lcb->handle, p_lcb->sent_not_acked, l2cb.check_round_robin, l2cb.round_robin_unacked); @@ -1462,13 +1462,13 @@ void l2c_link_process_num_completed_pkts (UINT8 *p) #if (BLE_INCLUDED == TRUE) L2CAP_TRACE_DEBUG5 ("TotalWin=%d LE_Win: %d, Handle=0x%x, RRCheck=%d, RRUnack=%d", l2cb.controller_xmit_window, - l2cb.controller_le_xmit_window, - handle, + l2cb.controller_le_xmit_window, + handle, l2cb.check_round_robin, l2cb.round_robin_unacked); #else L2CAP_TRACE_DEBUG4 ("TotalWin=%d Handle=0x%x RRCheck=%d RRUnack=%d", - l2cb.controller_xmit_window, - handle, + l2cb.controller_xmit_window, + handle, l2cb.check_round_robin, l2cb.round_robin_unacked); #endif } @@ -1508,7 +1508,7 @@ BT_HDR *l2cap_link_chk_pkt_start (BT_HDR *p_cur_buf) tL2C_LCB *p_lcb; BT_HDR * p_return_buf; /* CR419: To avoid returning from too many places */ - + if (p_cur_buf) { p = (UINT8 *)(p_cur_buf + 1) + p_cur_buf->offset; @@ -1579,7 +1579,7 @@ BT_HDR *l2cap_link_chk_pkt_start (BT_HDR *p_cur_buf) + p_cur_buf->offset + HCI_DATA_PREAMBLE_SIZE; UINT8 * p1 = (UINT8 *)(p_return_buf + 1) - + p_return_buf->offset + + p_return_buf->offset + p_return_buf->len; /* Copy data from new buffer into base buffer then update the data */ diff --git a/stack/l2cap/l2c_main.c b/stack/l2cap/l2c_main.c index a60140c..17b9df1 100644 --- a/stack/l2cap/l2c_main.c +++ b/stack/l2cap/l2c_main.c @@ -43,7 +43,7 @@ extern void tcs_proc_bcst_msg( BD_ADDR addr, BT_HDR *p_msg ) ; ** ** Function l2c_bcst_msg ** -** Description +** Description ** ** Returns void ** @@ -251,7 +251,7 @@ void l2c_rcv_acl_data (BT_HDR *p_msg) } #endif #if (L2CAP_NUM_FIXED_CHNLS > 0) - else if ((rcv_cid >= L2CAP_FIRST_FIXED_CHNL) && (rcv_cid <= L2CAP_LAST_FIXED_CHNL) && + else if ((rcv_cid >= L2CAP_FIRST_FIXED_CHNL) && (rcv_cid <= L2CAP_LAST_FIXED_CHNL) && (l2cb.fixed_reg[rcv_cid - L2CAP_FIRST_FIXED_CHNL].pL2CA_FixedData_Cb != NULL) ) { /* If no CCB for this channel, allocate one */ @@ -262,7 +262,7 @@ void l2c_rcv_acl_data (BT_HDR *p_msg) if (p_ccb->peer_cfg.fcr.mode != L2CAP_FCR_BASIC_MODE) l2c_fcr_proc_pdu (p_ccb, p_msg); else - (*l2cb.fixed_reg[rcv_cid - L2CAP_FIRST_FIXED_CHNL].pL2CA_FixedData_Cb)(p_lcb->remote_bd_addr, p_msg); + (*l2cb.fixed_reg[rcv_cid - L2CAP_FIRST_FIXED_CHNL].pL2CA_FixedData_Cb)(p_lcb->remote_bd_addr, p_msg); } else GKI_freebuf (p_msg); @@ -457,7 +457,7 @@ static void process_l2cap_cmd (tL2C_LCB *p_lcb, UINT8 *p, UINT16 pkt_len) p_cfg_start = p; - cfg_info.flush_to_present = cfg_info.mtu_present = cfg_info.qos_present = + cfg_info.flush_to_present = cfg_info.mtu_present = cfg_info.qos_present = cfg_info.fcr_present = cfg_info.fcs_present = FALSE; while (p < p_cfg_end) @@ -559,7 +559,7 @@ static void process_l2cap_cmd (tL2C_LCB *p_lcb, UINT8 *p, UINT16 pkt_len) STREAM_TO_UINT16 (cfg_info.flags, p); STREAM_TO_UINT16 (cfg_info.result, p); - cfg_info.flush_to_present = cfg_info.mtu_present = cfg_info.qos_present = + cfg_info.flush_to_present = cfg_info.mtu_present = cfg_info.qos_present = cfg_info.fcr_present = cfg_info.fcs_present = FALSE; while (p < p_cfg_end) @@ -688,7 +688,7 @@ static void process_l2cap_cmd (tL2C_LCB *p_lcb, UINT8 *p, UINT16 pkt_len) l2cu_send_peer_echo_rsp (p_lcb, id, NULL, 0); #endif break; - + case L2CAP_CMD_ECHO_RSP: #if (L2CAP_ENHANCED_FEATURES != 0) l2cu_check_feature_rsp (p_lcb, id, p, cmd_len); @@ -722,7 +722,7 @@ static void process_l2cap_cmd (tL2C_LCB *p_lcb, UINT8 *p, UINT16 pkt_len) p_lcb->info_rx_bits |= (1 << info_type); - if ( (info_type == L2CAP_EXTENDED_FEATURES_INFO_TYPE) + if ( (info_type == L2CAP_EXTENDED_FEATURES_INFO_TYPE) && (result == L2CAP_INFO_RESP_RESULT_SUCCESS) ) { STREAM_TO_UINT32( p_lcb->peer_ext_fea, p ); @@ -783,7 +783,7 @@ static void process_l2cap_cmd (tL2C_LCB *p_lcb, UINT8 *p, UINT16 pkt_len) ** Function l2c_process_held_packets ** ** Description This function processes any L2CAP packets that arrived before -** the HCI connection complete arrived. It is a work around for +** the HCI connection complete arrived. It is a work around for ** badly behaved controllers. ** ** Returns void @@ -946,9 +946,9 @@ UINT8 l2c_data_write (UINT16 cid, BT_HDR *p_data, UINT16 flags) return (L2CAP_DW_FAILED); } -#ifndef TESTER /* Tester may send any amount of data. otherwise sending message +#ifndef TESTER /* Tester may send any amount of data. otherwise sending message bigger than mtu size of peer is a violation of protocol */ - if (p_data->len > p_ccb->peer_cfg.mtu) + if (p_data->len > p_ccb->peer_cfg.mtu) { L2CAP_TRACE_WARNING1 ("L2CAP - CID: 0x%04x cannot send message bigger than peer's mtu size", cid); GKI_freebuf (p_data); diff --git a/stack/l2cap/l2c_ucd.c b/stack/l2cap/l2c_ucd.c index 03e55af..375988e 100644 --- a/stack/l2cap/l2c_ucd.c +++ b/stack/l2cap/l2c_ucd.c @@ -125,7 +125,7 @@ static void l2c_ucd_congestion_status_cback (BD_ADDR rem_bda, BOOLEAN is_congest { L2CAP_TRACE_DEBUG4 ("L2CAP - Calling UCDCongestionStatus_Cb (%d), PSM=0x%04x, BDA: %08x%04x,", is_congested, p_rcb->psm, - (rem_bda[0]<<24)+(rem_bda[1]<<16)+(rem_bda[2]<<8)+rem_bda[3], + (rem_bda[0]<<24)+(rem_bda[1]<<16)+(rem_bda[2]<<8)+rem_bda[3], (rem_bda[4]<<8)+rem_bda[5]); p_rcb->ucd.cb_info.pL2CA_UCD_Congestion_Status_Cb ( rem_bda, is_congested ); @@ -305,7 +305,7 @@ BOOLEAN L2CA_UcdDeregister ( UINT16 psm ) ** Parameters: PSM ** BD_ADDR of remote device ** info_type : L2CAP_UCD_INFO_TYPE_RECEPTION -** L2CAP_UCD_INFO_TYPE_MTU +** L2CAP_UCD_INFO_TYPE_MTU ** ** ** Return value: TRUE if successs @@ -318,7 +318,7 @@ BOOLEAN L2CA_UcdDiscover ( UINT16 psm, BD_ADDR rem_bda, UINT8 info_type ) tL2C_RCB *p_rcb; L2CAP_TRACE_API4 ("L2CA_UcdDiscover() PSM: 0x%04x BDA: %08x%04x, InfoType=0x%02x", psm, - (rem_bda[0]<<24)+(rem_bda[1]<<16)+(rem_bda[2]<<8)+rem_bda[3], + (rem_bda[0]<<24)+(rem_bda[1]<<16)+(rem_bda[2]<<8)+rem_bda[3], (rem_bda[4]<<8)+rem_bda[5], info_type); /* Fail if the PSM is not registered */ @@ -368,7 +368,7 @@ BOOLEAN L2CA_UcdDiscover ( UINT16 psm, BD_ADDR rem_bda, UINT8 info_type ) ** ** Parameters: PSM ** BD Address of remote -** Pointer to buffer of type BT_HDR +** Pointer to buffer of type BT_HDR ** flags : L2CAP_FLUSHABLE_CH_BASED ** L2CAP_FLUSHABLE_PKT ** L2CAP_NON_FLUSHABLE_PKT @@ -385,7 +385,7 @@ UINT16 L2CA_UcdDataWrite (UINT16 psm, BD_ADDR rem_bda, BT_HDR *p_buf, UINT16 fla UINT8 *p; L2CAP_TRACE_API3 ("L2CA_UcdDataWrite() PSM: 0x%04x BDA: %08x%04x", psm, - (rem_bda[0]<<24)+(rem_bda[1]<<16)+(rem_bda[2]<<8)+rem_bda[3], + (rem_bda[0]<<24)+(rem_bda[1]<<16)+(rem_bda[2]<<8)+rem_bda[3], (rem_bda[4]<<8)+rem_bda[5]); /* Fail if the PSM is not registered */ @@ -436,7 +436,7 @@ UINT16 L2CA_UcdDataWrite (UINT16 psm, BD_ADDR rem_bda, BT_HDR *p_buf, UINT16 fla if (p_ccb->cong_sent) { L2CAP_TRACE_ERROR3 ("L2CAP - Handle: 0x%04x UCD cannot be sent, already congested count: %u buff_quota: %u", - p_lcb->handle, + p_lcb->handle, (p_ccb->xmit_hold_q.count + p_lcb->ucd_out_sec_pending_q.count), p_ccb->buff_quota); @@ -473,7 +473,7 @@ BOOLEAN L2CA_UcdSetIdleTimeout ( BD_ADDR rem_bda, UINT16 timeout ) tL2C_CCB *p_ccb; L2CAP_TRACE_API3 ("L2CA_UcdSetIdleTimeout() Timeout: 0x%04x BDA: %08x%04x", timeout, - (rem_bda[0]<<24)+(rem_bda[1]<<16)+(rem_bda[2]<<8)+rem_bda[3], + (rem_bda[0]<<24)+(rem_bda[1]<<16)+(rem_bda[2]<<8)+rem_bda[3], (rem_bda[4]<<8)+rem_bda[5]); /* First, see if we already have a link to the remote */ @@ -506,7 +506,7 @@ BOOLEAN L2CA_UCDSetTxPriority ( BD_ADDR rem_bda, tL2CAP_CHNL_PRIORITY priority ) tL2C_CCB *p_ccb; L2CAP_TRACE_API3 ("L2CA_UCDSetTxPriority() priority: 0x%02x BDA: %08x%04x", priority, - (rem_bda[0]<<24)+(rem_bda[1]<<16)+(rem_bda[2]<<8)+rem_bda[3], + (rem_bda[0]<<24)+(rem_bda[1]<<16)+(rem_bda[2]<<8)+rem_bda[3], (rem_bda[4]<<8)+rem_bda[5]); if ((p_lcb = l2cu_find_lcb_by_bd_addr (rem_bda)) == NULL) @@ -545,8 +545,8 @@ static BOOLEAN l2c_ucd_connect ( BD_ADDR rem_bda ) tL2C_CCB *p_ccb; tL2C_RCB *p_rcb; - L2CAP_TRACE_DEBUG2 ("l2c_ucd_connect() BDA: %08x%04x", - (rem_bda[0]<<24)+(rem_bda[1]<<16)+(rem_bda[2]<<8)+rem_bda[3], + L2CAP_TRACE_DEBUG2 ("l2c_ucd_connect() BDA: %08x%04x", + (rem_bda[0]<<24)+(rem_bda[1]<<16)+(rem_bda[2]<<8)+rem_bda[3], (rem_bda[4]<<8)+rem_bda[5]); /* Fail if we have not established communications with the controller */ @@ -674,8 +674,8 @@ BOOLEAN l2c_ucd_check_pending_info_req(tL2C_CCB *p_ccb) l2cu_release_ccb (p_ccb); } - p_ccb->p_rcb->ucd.cb_info.pL2CA_UCD_Discover_Cb (p_ccb->p_lcb->remote_bd_addr, - L2CAP_UCD_INFO_TYPE_RECEPTION, + p_ccb->p_rcb->ucd.cb_info.pL2CA_UCD_Discover_Cb (p_ccb->p_lcb->remote_bd_addr, + L2CAP_UCD_INFO_TYPE_RECEPTION, p_ccb->p_lcb->peer_ext_fea & L2CAP_EXTFEA_UCD_RECEPTION); } else @@ -694,8 +694,8 @@ BOOLEAN l2c_ucd_check_pending_info_req(tL2C_CCB *p_ccb) /* if this information is available */ if ( p_ccb->p_lcb->info_rx_bits & (1 << L2CAP_CONNLESS_MTU_INFO_TYPE)) { - p_ccb->p_rcb->ucd.cb_info.pL2CA_UCD_Discover_Cb (p_ccb->p_lcb->remote_bd_addr, - L2CAP_UCD_INFO_TYPE_MTU, + p_ccb->p_rcb->ucd.cb_info.pL2CA_UCD_Discover_Cb (p_ccb->p_lcb->remote_bd_addr, + L2CAP_UCD_INFO_TYPE_MTU, p_ccb->p_lcb->ucd_mtu); } else @@ -750,7 +750,7 @@ BOOLEAN l2c_ucd_check_pending_out_sec_q(tL2C_CCB *p_ccb) STREAM_TO_UINT16(psm, p) p_ccb->chnl_state = CST_ORIG_W4_SEC_COMP; - btm_sec_l2cap_access_req (p_ccb->p_lcb->remote_bd_addr, psm, + btm_sec_l2cap_access_req (p_ccb->p_lcb->remote_bd_addr, psm, p_ccb->p_lcb->handle, CONNLESS_ORIG, &l2c_link_sec_comp, p_ccb); return (TRUE); @@ -827,7 +827,7 @@ BOOLEAN l2c_ucd_check_pending_in_sec_q(tL2C_CCB *p_ccb) STREAM_TO_UINT16(psm, p) p_ccb->chnl_state = CST_TERM_W4_SEC_COMP; - btm_sec_l2cap_access_req (p_ccb->p_lcb->remote_bd_addr, psm, + btm_sec_l2cap_access_req (p_ccb->p_lcb->remote_bd_addr, psm, p_ccb->p_lcb->handle, CONNLESS_TERM, &l2c_link_sec_comp, p_ccb); return (TRUE); @@ -989,7 +989,7 @@ BOOLEAN l2c_ucd_process_event(tL2C_CCB *p_ccb, UINT16 event, void *p_data) break; } break; - + case CST_ORIG_W4_SEC_COMP: switch (event) { @@ -1045,7 +1045,7 @@ BOOLEAN l2c_ucd_process_event(tL2C_CCB *p_ccb, UINT16 event, void *p_data) } break; - + case CST_TERM_W4_SEC_COMP: switch (event) { diff --git a/stack/l2cap/l2c_utils.c b/stack/l2cap/l2c_utils.c index 698e336..80d092e 100644 --- a/stack/l2cap/l2c_utils.c +++ b/stack/l2cap/l2c_utils.c @@ -85,8 +85,8 @@ void l2cu_update_lcb_4_bonding (BD_ADDR p_bd_addr, BOOLEAN is_bonding) if (p_lcb) { - L2CAP_TRACE_DEBUG3 ("l2cu_update_lcb_4_bonding BDA: %08x%04x is_bonding: %d", - (p_bd_addr[0]<<24)+(p_bd_addr[1]<<16)+(p_bd_addr[2]<<8)+p_bd_addr[3], + L2CAP_TRACE_DEBUG3 ("l2cu_update_lcb_4_bonding BDA: %08x%04x is_bonding: %d", + (p_bd_addr[0]<<24)+(p_bd_addr[1]<<16)+(p_bd_addr[2]<<8)+p_bd_addr[3], (p_bd_addr[4]<<8)+p_bd_addr[5], is_bonding); p_lcb->is_bonding = is_bonding; } @@ -340,7 +340,7 @@ void l2cu_send_peer_cmd_reject (tL2C_LCB *p_lcb, UINT16 reason, UINT8 rem_id, return; } - p = (UINT8 *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET + HCI_DATA_PREAMBLE_SIZE + + p = (UINT8 *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET + HCI_DATA_PREAMBLE_SIZE + L2CAP_PKT_OVERHEAD + L2CAP_CMD_OVERHEAD; UINT16_TO_STREAM (p, reason); @@ -376,14 +376,14 @@ void l2cu_send_peer_connect_req (tL2C_CCB *p_ccb) p_ccb->local_id = p_ccb->p_lcb->id; - if ((p_buf = l2cu_build_header (p_ccb->p_lcb, L2CAP_CONN_REQ_LEN, L2CAP_CMD_CONN_REQ, + if ((p_buf = l2cu_build_header (p_ccb->p_lcb, L2CAP_CONN_REQ_LEN, L2CAP_CMD_CONN_REQ, p_ccb->local_id)) == NULL) { L2CAP_TRACE_WARNING0 ("L2CAP - no buffer for conn_req"); return; } - p = (UINT8 *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET+HCI_DATA_PREAMBLE_SIZE + + p = (UINT8 *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET+HCI_DATA_PREAMBLE_SIZE + L2CAP_PKT_OVERHEAD + L2CAP_CMD_OVERHEAD; UINT16_TO_STREAM (p, p_ccb->p_rcb->real_psm); @@ -423,7 +423,7 @@ void l2cu_send_peer_connect_rsp (tL2C_CCB *p_ccb, UINT16 result, UINT16 status) return; } - p = (UINT8 *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET+HCI_DATA_PREAMBLE_SIZE + + p = (UINT8 *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET+HCI_DATA_PREAMBLE_SIZE + L2CAP_PKT_OVERHEAD + L2CAP_CMD_OVERHEAD; UINT16_TO_STREAM (p, p_ccb->local_cid); @@ -509,7 +509,7 @@ void l2cu_send_peer_config_req (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg) return; } - p = (UINT8 *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET + HCI_DATA_PREAMBLE_SIZE + + p = (UINT8 *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET + HCI_DATA_PREAMBLE_SIZE + L2CAP_PKT_OVERHEAD + L2CAP_CMD_OVERHEAD; UINT16_TO_STREAM (p, p_ccb->remote_cid); @@ -739,7 +739,7 @@ void l2cu_send_peer_config_rej (tL2C_CCB *p_ccb, UINT8 *p_data, UINT16 data_len, p_data += cfg_len + L2CAP_CFG_OPTION_OVERHEAD; break; - /* unknown options; copy into rsp if not hints */ + /* unknown options; copy into rsp if not hints */ default: /* sanity check option length */ if ((cfg_len + L2CAP_CFG_OPTION_OVERHEAD) <= data_len) @@ -800,7 +800,7 @@ void l2cu_send_peer_disc_req (tL2C_CCB *p_ccb) UINT16_TO_STREAM (p, p_ccb->remote_cid); UINT16_TO_STREAM (p, p_ccb->local_cid); - /* Move all queued data packets to the LCB. In FCR mode, assume the higher + /* Move all queued data packets to the LCB. In FCR mode, assume the higher layer checks that all buffers are sent before disconnecting. */ if (p_ccb->peer_cfg.fcr.mode == L2CAP_FCR_BASIC_MODE) @@ -831,7 +831,7 @@ void l2cu_send_peer_disc_req (tL2C_CCB *p_ccb) ** Returns void ** *******************************************************************************/ -void l2cu_send_peer_disc_rsp (tL2C_LCB *p_lcb, UINT8 remote_id, UINT16 local_cid, +void l2cu_send_peer_disc_rsp (tL2C_LCB *p_lcb, UINT8 remote_id, UINT16 local_cid, UINT16 remote_cid) { BT_HDR *p_buf; @@ -905,9 +905,9 @@ void l2cu_send_peer_echo_rsp (tL2C_LCB *p_lcb, UINT8 id, UINT8 *p_data, UINT16 d UINT16 maxlen; /* Don't return data if it does not fit in ACL and L2CAP MTU */ - maxlen = (GKI_get_pool_bufsize(L2CAP_CMD_POOL_ID) > btu_cb.hcit_acl_pkt_size) ? + maxlen = (GKI_get_pool_bufsize(L2CAP_CMD_POOL_ID) > btu_cb.hcit_acl_pkt_size) ? btu_cb.hcit_acl_data_size : (UINT16)GKI_get_pool_bufsize(L2CAP_CMD_POOL_ID); - maxlen -= (UINT16)(BT_HDR_SIZE + HCI_DATA_PREAMBLE_SIZE + L2CAP_PKT_OVERHEAD + + maxlen -= (UINT16)(BT_HDR_SIZE + HCI_DATA_PREAMBLE_SIZE + L2CAP_PKT_OVERHEAD + L2CAP_CMD_OVERHEAD + L2CAP_ECHO_RSP_LEN); if (data_len > maxlen) @@ -919,7 +919,7 @@ void l2cu_send_peer_echo_rsp (tL2C_LCB *p_lcb, UINT8 id, UINT8 *p_data, UINT16 d return; } - p = (UINT8 *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET + HCI_DATA_PREAMBLE_SIZE + + p = (UINT8 *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET + HCI_DATA_PREAMBLE_SIZE + L2CAP_PKT_OVERHEAD + L2CAP_CMD_OVERHEAD; if (data_len) @@ -935,7 +935,7 @@ void l2cu_send_peer_echo_rsp (tL2C_LCB *p_lcb, UINT8 id, UINT8 *p_data, UINT16 d ** Function l2cu_send_peer_info_req ** ** Description Build and send an L2CAP "info request" message -** to the peer. +** to the peer. ** Returns void ** *******************************************************************************/ @@ -956,7 +956,7 @@ void l2cu_send_peer_info_req (tL2C_LCB *p_lcb, UINT16 info_type) L2CAP_TRACE_EVENT1 ("l2cu_send_peer_info_req: type 0x%04x", info_type); - p = (UINT8 *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET+HCI_DATA_PREAMBLE_SIZE + + p = (UINT8 *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET+HCI_DATA_PREAMBLE_SIZE + L2CAP_PKT_OVERHEAD + L2CAP_CMD_OVERHEAD; UINT16_TO_STREAM (p, info_type); @@ -988,7 +988,7 @@ void l2cu_send_peer_info_rsp (tL2C_LCB *p_lcb, UINT8 remote_id, UINT16 info_type if ((info_type == L2CAP_EXTENDED_FEATURES_INFO_TYPE) && (l2cb.test_info_resp & (L2CAP_EXTFEA_ENH_RETRANS | L2CAP_EXTFEA_STREAM_MODE | L2CAP_EXTFEA_NO_CRC | L2CAP_EXTFEA_EXT_FLOW_SPEC | - L2CAP_EXTFEA_FIXED_CHNLS | L2CAP_EXTFEA_EXT_WINDOW | + L2CAP_EXTFEA_FIXED_CHNLS | L2CAP_EXTFEA_EXT_WINDOW | L2CAP_EXTFEA_UCD_RECEPTION )) ) #else if ((info_type == L2CAP_EXTENDED_FEATURES_INFO_TYPE) @@ -1034,7 +1034,7 @@ void l2cu_send_peer_info_rsp (tL2C_LCB *p_lcb, UINT8 remote_id, UINT16 info_type if (p_lcb->is_ble_link) { /* optional data are not added for now */ - UINT32_TO_STREAM (p, L2CAP_BLE_EXTFEA_MASK); + UINT32_TO_STREAM (p, L2CAP_BLE_EXTFEA_MASK); } else #endif @@ -1110,7 +1110,7 @@ void l2cu_enqueue_ccb (tL2C_CCB *p_ccb) return; } - L2CAP_TRACE_DEBUG2 ("l2cu_enqueue_ccb CID: 0x%04x priority: %d", + L2CAP_TRACE_DEBUG2 ("l2cu_enqueue_ccb CID: 0x%04x priority: %d", p_ccb->local_cid, p_ccb->ccb_priority); /* If the queue is empty, we go at the front */ @@ -1264,7 +1264,7 @@ void l2cu_dequeue_ccb (tL2C_CCB *p_ccb) ** ** Function l2cu_change_pri_ccb ** -** Description +** Description ** ** Returns - ** @@ -1408,7 +1408,7 @@ tL2C_CCB *l2cu_allocate_ccb (tL2C_LCB *p_lcb, UINT16 cid) // btla-specific ++ /* CSP408639 Fix: When L2CAP send amp move channel request or receive - * L2CEVT_AMP_MOVE_REQ do following sequence. Send channel move + * L2CEVT_AMP_MOVE_REQ do following sequence. Send channel move * request -> Stop retrans/monitor timer -> Change channel state to CST_AMP_MOVING. */ if (p_ccb->fcrb.mon_retrans_timer.in_use) btu_stop_quick_timer (&p_ccb->fcrb.mon_retrans_timer); @@ -1544,8 +1544,8 @@ void l2cu_release_ccb (tL2C_CCB *p_ccb) l2c_fcr_cleanup (p_ccb); /* Channel may not be assigned to any LCB if it was just pre-reserved */ - if ( (p_lcb) && - ( (p_ccb->local_cid >= L2CAP_BASE_APPL_CID) + if ( (p_lcb) && + ( (p_ccb->local_cid >= L2CAP_BASE_APPL_CID) #if (L2CAP_UCD_INCLUDED == TRUE) ||(p_ccb->local_cid == L2CAP_CONNECTIONLESS_CID) #endif @@ -1597,7 +1597,7 @@ void l2cu_release_ccb (tL2C_CCB *p_ccb) ** Function l2cu_find_ccb_by_remote_cid ** ** Description Look through all active CCBs on a link for a match based -** on the remote CID. +** on the remote CID. ** ** Returns pointer to matched CCB, or NULL if no match ** @@ -1760,7 +1760,7 @@ UINT8 l2cu_process_peer_cfg_req (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg) if (!p_cfg->fcr_present) p_cfg->fcr.mode = L2CAP_FCR_BASIC_MODE; - /* Save the MTU that our peer can receive */ + /* Save the MTU that our peer can receive */ if (p_cfg->mtu_present) { /* Make sure MTU is at least the minimum */ @@ -1902,7 +1902,7 @@ void l2cu_process_peer_cfg_rsp (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg) else p_ccb->fcrb.max_held_acks = p_ccb->our_cfg.fcr.tx_win_sz / 3; - L2CAP_TRACE_DEBUG3 ("l2cu_process_peer_cfg_rsp(): peer tx_win_sz: %d, our tx_win_sz: %d, max_held_acks: %d", + L2CAP_TRACE_DEBUG3 ("l2cu_process_peer_cfg_rsp(): peer tx_win_sz: %d, our tx_win_sz: %d, max_held_acks: %d", p_cfg->fcr.tx_win_sz, p_ccb->our_cfg.fcr.tx_win_sz, p_ccb->fcrb.max_held_acks); } } @@ -2027,7 +2027,7 @@ void l2cu_process_our_cfg_rsp (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg) ** ** Function l2cu_device_reset ** -** Description This function is called when reset of the device is +** Description This function is called when reset of the device is ** completed. For all active connection simulate HCI_DISC ** ** Returns void @@ -2055,7 +2055,7 @@ extern UINT16 tcs_wug_get_clk_offset( BD_ADDR addr ) ; ** ** Function l2cu_create_conn ** -** Description This function initiates an acl connection via HCI +** Description This function initiates an acl connection via HCI ** ** Returns TRUE if successful, FALSE if gki get buffer fails. ** @@ -2107,7 +2107,7 @@ BOOLEAN l2cu_create_conn (tL2C_LCB *p_lcb) if (is_sco_active == TRUE) continue; /* No Master Slave switch not allowed when SCO Active */ #endif - + if (HCI_SWITCH_SUPPORTED(btm_cb.devcb.local_features)) { /* mark this lcb waiting for switch to be completed and @@ -2135,7 +2135,7 @@ BOOLEAN l2cu_create_conn (tL2C_LCB *p_lcb) ** ** Description Gets the number of high priority channels. ** -** Returns +** Returns ** *******************************************************************************/ UINT8 l2cu_get_num_hi_priority (void) @@ -2159,7 +2159,7 @@ UINT8 l2cu_get_num_hi_priority (void) ** ** Function l2cu_create_conn_after_switch ** -** Description This function initiates an acl connection via HCI +** Description This function initiates an acl connection via HCI ** If switch required to create connection it is already done. ** ** Returns TRUE if successful, FALSE if gki get buffer fails. @@ -2280,7 +2280,7 @@ tL2C_LCB *l2cu_find_lcb_by_state (tL2C_LINK_STATE state) ** Function l2cu_lcb_disconnecting ** ** Description On each active lcb, check if the lcb is in disconnecting -** state, or if there are no ccb's on the lcb (implying +** state, or if there are no ccb's on the lcb (implying idle timeout is running), or if last ccb on the link is in disconnecting state. ** @@ -2437,9 +2437,9 @@ BOOLEAN l2cu_check_feature_req (tL2C_LCB *p_lcb, UINT8 id, UINT8 *p_data, UINT16 UINT8 pe_type, pe_len; if ((data_len <= 4) - || (p_data[0] != 'R') + || (p_data[0] != 'R') || (p_data[1] != 'Q') - || (p_data[data_len - 2] != 'r') + || (p_data[data_len - 2] != 'r') || (p_data[data_len - 1] != 'q') || (id != L2CAP_FEATURE_REQ_ID)) return (FALSE); @@ -2494,9 +2494,9 @@ void l2cu_check_feature_rsp (tL2C_LCB *p_lcb, UINT8 id, UINT8 *p_data, UINT16 da UINT8 *p_end = p_data + data_len - 2; if ((data_len <= 4) - || (p_data[0] != 'R') + || (p_data[0] != 'R') || (p_data[1] != 'S') - || (p_data[data_len - 2] != 'r') + || (p_data[data_len - 2] != 'r') || (p_data[data_len - 1] != 's') || (id != L2CAP_FEATURE_RSP_ID)) { @@ -2608,7 +2608,7 @@ void l2cu_resubmit_pending_sec_req (BD_ADDR p_bda) ** ** Function l2cu_set_info_rsp_mask ** -** Description This function allows the script wrapper to change the +** Description This function allows the script wrapper to change the ** info resp mask for conformance testing. ** ** Returns pointer to CCB, or NULL if none @@ -2649,8 +2649,8 @@ void l2cu_adjust_out_mps (tL2C_CCB *p_ccb) /* We try to negotiate MTU that each packet can be split into whole number of max packets. For example if link is 1.2 max packet size is 339 bytes. At first calculate how many whole packets it is. MAX L2CAP is 1691 + 4 overhead. - 1695, that will be 5 Dh5 packets. Now maximum L2CAP packet is - 5 * 339 = 1695. Minus 4 bytes L2CAP header 1691. + 1695, that will be 5 Dh5 packets. Now maximum L2CAP packet is + 5 * 339 = 1695. Minus 4 bytes L2CAP header 1691. For EDR 2.0 packet size is 1027. So we better send RFCOMM packet as 1 3DH5 packet 1 * 1027 = 1027. Minus 4 bytes L2CAP header 1023. */ @@ -2763,7 +2763,7 @@ void l2cu_no_dynamic_ccbs (tL2C_LCB *p_lcb) { p_lcb->link_state = LST_DISCONNECTING; timeout = L2CAP_LINK_DISCONNECT_TOUT; - } + } else if (rc == BTM_SUCCESS) { /* BTM SEC will make sure that link is release (probably after pairing is done) */ @@ -2775,7 +2775,7 @@ void l2cu_no_dynamic_ccbs (tL2C_LCB *p_lcb) { p_lcb->link_state = LST_DISCONNECTING; timeout = L2CAP_LINK_DISCONNECT_TOUT; - } + } else { /* probably no buffer to send disconnect */ @@ -2807,7 +2807,7 @@ void l2cu_no_dynamic_ccbs (tL2C_LCB *p_lcb) void l2cu_process_fixed_chnl_resp (tL2C_LCB *p_lcb) { int xx; -#if BLE_INCLUDED == TRUE +#if BLE_INCLUDED == TRUE UINT16 reason = (p_lcb->is_ble_link ) ? 1 : 0; #else UINT16 reason =0; @@ -2862,7 +2862,7 @@ void l2cu_send_peer_ble_par_req (tL2C_LCB *p_lcb, UINT16 min_int, UINT16 max_int return; } - p = (UINT8 *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET + HCI_DATA_PREAMBLE_SIZE + + p = (UINT8 *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET + HCI_DATA_PREAMBLE_SIZE + L2CAP_PKT_OVERHEAD + L2CAP_CMD_OVERHEAD; UINT16_TO_STREAM (p, min_int); @@ -2894,7 +2894,7 @@ void l2cu_send_peer_ble_par_rsp (tL2C_LCB *p_lcb, UINT16 reason, UINT8 rem_id) return; } - p = (UINT8 *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET + HCI_DATA_PREAMBLE_SIZE + + p = (UINT8 *)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET + HCI_DATA_PREAMBLE_SIZE + L2CAP_PKT_OVERHEAD + L2CAP_CMD_OVERHEAD; UINT16_TO_STREAM (p, reason); @@ -3031,7 +3031,7 @@ static tL2C_CCB *l2cu_get_next_channel_in_rr(tL2C_LCB *p_lcb) return NULL; } - L2CAP_TRACE_DEBUG3("RR scan pri=%d, lcid=0x%04x, q_cout=%d", + L2CAP_TRACE_DEBUG3("RR scan pri=%d, lcid=0x%04x, q_cout=%d", p_ccb->ccb_priority, p_ccb->local_cid, p_ccb->xmit_hold_q.count ); /* store the next serving channel */ @@ -3095,9 +3095,9 @@ static tL2C_CCB *l2cu_get_next_channel_in_rr(tL2C_LCB *p_lcb) if (p_serve_ccb) { - L2CAP_TRACE_DEBUG3("RR service pri=%d, quota=%d, lcid=0x%04x", - p_serve_ccb->ccb_priority, - p_lcb->rr_serv[p_serve_ccb->ccb_priority].quota, + L2CAP_TRACE_DEBUG3("RR service pri=%d, quota=%d, lcid=0x%04x", + p_serve_ccb->ccb_priority, + p_lcb->rr_serv[p_serve_ccb->ccb_priority].quota, p_serve_ccb->local_cid ); } @@ -3110,7 +3110,7 @@ static tL2C_CCB *l2cu_get_next_channel_in_rr(tL2C_LCB *p_lcb) ** ** Function l2cu_get_next_channel ** -** Description get the next channel to send on a link bassed on priority +** Description get the next channel to send on a link bassed on priority ** scheduling. ** ** Returns pointer to CCB or NULL @@ -3120,7 +3120,7 @@ static tL2C_CCB *l2cu_get_next_channel(tL2C_LCB *p_lcb) { tL2C_CCB *p_ccb; - /* Get the first CCB with data to send. + /* Get the first CCB with data to send. */ for (p_ccb = p_lcb->ccb_queue.p_first_ccb; p_ccb; p_ccb = p_ccb->p_next_ccb) { @@ -3373,7 +3373,7 @@ void l2cu_check_channel_congestion (tL2C_CCB *p_ccb) { L2CAP_TRACE_DEBUG3 ("L2CAP - Calling CongestionStatus_Cb (TRUE),CID:0x%04x,XmitQ:%u,Quota:%u", p_ccb->local_cid, q_count, p_ccb->buff_quota); - + (*p_ccb->p_rcb->api.pL2CA_CongestionStatus_Cb)(p_ccb->local_cid, TRUE); } #if (L2CAP_UCD_INCLUDED == TRUE) |