mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-03 23:47:08 +00:00
hci: spellcheck
This commit is contained in:
parent
77f64391de
commit
a086dc35a9
58
src/hci.c
58
src/hci.c
@ -483,7 +483,7 @@ static void hci_connection_timestamp(hci_connection_t *connection){
|
||||
/**
|
||||
* add authentication flags and reset timer
|
||||
* @note: assumes classic connection
|
||||
* @note: bd_addr is passed in as litle endian uint8_t * as it is called from parsing packets
|
||||
* @note: bd_addr is passed in as little endian uint8_t * as it is called from parsing packets
|
||||
*/
|
||||
static void hci_add_connection_flags_for_flipped_bd_addr(uint8_t *bd_addr, hci_authentication_flags_t flags){
|
||||
bd_addr_t addr;
|
||||
@ -745,7 +745,7 @@ static int hci_number_free_sco_slots(void){
|
||||
#endif
|
||||
|
||||
// only used to send HCI Host Number Completed Packets
|
||||
static int hci_can_send_comand_packet_transport(void){
|
||||
static int hci_can_send_command_packet_transport(void){
|
||||
if (hci_stack->hci_packet_buffer_reserved) return 0;
|
||||
|
||||
// check for async hci transport implementations
|
||||
@ -759,7 +759,7 @@ static int hci_can_send_comand_packet_transport(void){
|
||||
|
||||
// new functions replacing hci_can_send_packet_now[_using_packet_buffer]
|
||||
bool hci_can_send_command_packet_now(void){
|
||||
if (hci_can_send_comand_packet_transport() == 0) return false;
|
||||
if (hci_can_send_command_packet_transport() == 0) return false;
|
||||
return hci_stack->num_cmd_packets > 0u;
|
||||
}
|
||||
|
||||
@ -895,7 +895,7 @@ static uint8_t hci_send_acl_packet_fragments(hci_connection_t *connection){
|
||||
log_debug("hci_send_acl_packet_fragments entered");
|
||||
|
||||
uint8_t status = ERROR_CODE_SUCCESS;
|
||||
// multiple packets could be send on a synchronous HCI transport
|
||||
// multiple packets could be sent on a synchronous HCI transport
|
||||
while (true){
|
||||
|
||||
log_debug("hci_send_acl_packet_fragments loop entered");
|
||||
@ -911,7 +911,7 @@ static uint8_t hci_send_acl_packet_fragments(hci_connection_t *connection){
|
||||
current_acl_data_packet_length = max_acl_data_packet_length & (~(HCI_ACL_CHUNK_SIZE_ALIGNMENT-1));
|
||||
}
|
||||
|
||||
// copy handle_and_flags if not first fragment and update packet boundary flags to be 01 (continuing fragmnent)
|
||||
// copy handle_and_flags if not first fragment and update packet boundary flags to be 01 (continuing fragment)
|
||||
if (acl_header_pos > 0u){
|
||||
uint16_t handle_and_flags = little_endian_read_16(hci_stack->hci_packet_buffer, 0);
|
||||
handle_and_flags = (handle_and_flags & 0xcfffu) | (1u << 12u);
|
||||
@ -1336,7 +1336,7 @@ static const uint8_t hci_acl_packet_type_feature_requirement_bit[] = {
|
||||
1, // 5 slot packets
|
||||
25, // EDR 2 mpbs
|
||||
26, // EDR 3 mbps
|
||||
39, // 3 slot EDR packts
|
||||
39, // 3 slot EDR packtes
|
||||
40, // 5 slot EDR packet
|
||||
};
|
||||
static const uint16_t hci_acl_packet_type_feature_packet_mask[] = {
|
||||
@ -1344,7 +1344,7 @@ static const uint16_t hci_acl_packet_type_feature_packet_mask[] = {
|
||||
0xf000, // 5 slot packets
|
||||
0x1102, // EDR 2 mpbs
|
||||
0x2204, // EDR 3 mbps
|
||||
0x0300, // 3 slot EDR packts
|
||||
0x0300, // 3 slot EDR packtes
|
||||
0x3000, // 5 slot EDR packet
|
||||
};
|
||||
|
||||
@ -2098,7 +2098,7 @@ static void hci_initializing_run(void){
|
||||
break;
|
||||
|
||||
case HCI_INIT_SET_EVENT_MASK_2:
|
||||
// On Bluettooth PTS dongle (BL 654) with PacketCraft HCI Firmware (LMP subversion) 0x5244,
|
||||
// On Bluetooth PTS dongle (BL 654) with PacketCraft HCI Firmware (LMP subversion) 0x5244,
|
||||
// setting Event Mask 2 causes Controller to drop Encryption Change events.
|
||||
if (hci_command_supported(SUPPORTED_HCI_COMMAND_SET_EVENT_MASK_PAGE_2)
|
||||
&& (hci_stack->manufacturer != BLUETOOTH_COMPANY_ID_PACKETCRAFT_INC)){
|
||||
@ -2614,7 +2614,7 @@ static void hci_initializing_event_handler(const uint8_t * packet, uint16_t size
|
||||
|
||||
static void hci_handle_connection_failed(hci_connection_t * conn, uint8_t status){
|
||||
// CC2564C might emit Connection Complete for rejected incoming SCO connection
|
||||
// To prevent accidentally free'ing the HCI connection for the ACL connection,
|
||||
// To prevent accidentally freeing the HCI connection for the ACL connection,
|
||||
// check if we have been aware of the HCI connection
|
||||
switch (conn->state){
|
||||
case SENT_CREATE_CONNECTION:
|
||||
@ -3421,7 +3421,7 @@ static void hci_handle_le_connection_complete_event(const uint8_t * hci_event){
|
||||
// if we're master, it was an outgoing connection
|
||||
// note: no hci_connection_t object exists yet for connect with whitelist
|
||||
|
||||
// if a identity addresses was used without enhanced connection complete event,
|
||||
// if an identity addresses was used without enhanced connection complete event,
|
||||
// the connection complete event contains the current random address of the peer device.
|
||||
// This random address is needed in the case of a re-pairing
|
||||
if (hci_event_le_meta_get_subevent_code(hci_event) == HCI_SUBEVENT_LE_CONNECTION_COMPLETE){
|
||||
@ -3905,7 +3905,7 @@ static void event_handler(uint8_t *packet, uint16_t size){
|
||||
hci_stack->sco_can_send_now = true;
|
||||
}
|
||||
|
||||
// setup implict sco flow control
|
||||
// setup implicit sco flow control
|
||||
conn->sco_tx_ready = 0;
|
||||
conn->sco_tx_active = 0;
|
||||
conn->sco_established_ms = btstack_run_loop_get_time_ms();
|
||||
@ -4161,7 +4161,7 @@ static void event_handler(uint8_t *packet, uint16_t size){
|
||||
}
|
||||
#else
|
||||
// We consider even Legacy Secure Connections as authenticated as BTstack mandates encryption
|
||||
// with encryption key size > hci_stack->gap_required_encyrption_key_size
|
||||
// with encryption key size > hci_stack->gap_required_encryption_key_size
|
||||
// for all operations that require any security. See BIAS attacks.
|
||||
conn->authentication_flags |= AUTH_FLAG_CONNECTION_AUTHENTICATED;
|
||||
#endif
|
||||
@ -4300,7 +4300,7 @@ static void event_handler(uint8_t *packet, uint16_t size){
|
||||
hci_pairing_complete(conn, ERROR_CODE_REMOTE_USER_TERMINATED_CONNECTION);
|
||||
#endif
|
||||
|
||||
// emit dedicatd bonding event
|
||||
// emit dedicated bonding event
|
||||
if (conn->bonding_flags & BONDING_EMIT_COMPLETE_ON_DISCONNECT){
|
||||
hci_emit_dedicated_bonding_result(conn->address, conn->bonding_status);
|
||||
}
|
||||
@ -4376,7 +4376,7 @@ static void event_handler(uint8_t *packet, uint16_t size){
|
||||
hci_notify_if_sco_can_send_now();
|
||||
return;
|
||||
|
||||
// explode inquriy results for easier consumption
|
||||
// explode inquiry results for easier consumption
|
||||
case HCI_EVENT_INQUIRY_RESULT:
|
||||
case HCI_EVENT_INQUIRY_RESULT_WITH_RSSI:
|
||||
case HCI_EVENT_EXTENDED_INQUIRY_RESPONSE:
|
||||
@ -4989,7 +4989,7 @@ void hci_init(const hci_transport_t *transport, const void *config){
|
||||
// Page Timeout
|
||||
hci_stack->page_timeout = 0x6000; // ca. 15 sec
|
||||
|
||||
// All ACL packet types are enabledh
|
||||
// All ACL packet types are enabled
|
||||
hci_stack->enabled_packet_types_acl = ACL_PACKET_TYPES_ALL;
|
||||
#endif
|
||||
|
||||
@ -5102,7 +5102,7 @@ static void hci_discard_connections(void){
|
||||
btstack_linked_list_iterator_t it;
|
||||
btstack_linked_list_iterator_init(&it, &hci_stack->connections);
|
||||
while (btstack_linked_list_iterator_has_next(&it)){
|
||||
// cancel all l2cap connections by emitting dicsconnection complete before shutdown (free) connection
|
||||
// cancel all l2cap connections by emitting disconnection complete before shutdown (free) connection
|
||||
hci_connection_t * connection = (hci_connection_t*) btstack_linked_list_iterator_next(&it);
|
||||
hci_emit_disconnection_complete(connection->con_handle, 0x16); // terminated by local host
|
||||
hci_shutdown_connection(connection);
|
||||
@ -5142,7 +5142,7 @@ void hci_set_sco_transport(const btstack_sco_transport_t *sco_transport){
|
||||
|
||||
#ifdef ENABLE_CLASSIC
|
||||
void gap_set_required_encryption_key_size(uint8_t encryption_key_size){
|
||||
// validate ranage and set
|
||||
// validate range and set
|
||||
if (encryption_key_size < 7) return;
|
||||
if (encryption_key_size > 16) return;
|
||||
hci_stack->gap_required_encyrption_key_size = encryption_key_size;
|
||||
@ -5567,7 +5567,7 @@ static void hci_halting_run(void) {
|
||||
hci_connection_t *connection;
|
||||
#ifdef ENABLE_BLE
|
||||
#ifdef ENABLE_LE_PERIPHERAL
|
||||
bool stop_advertismenets;
|
||||
bool stop_advertisements;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -5591,7 +5591,7 @@ static void hci_halting_run(void) {
|
||||
#ifdef ENABLE_LE_PERIPHERAL
|
||||
if (!hci_can_send_command_packet_now()) return;
|
||||
|
||||
stop_advertismenets = (hci_stack->le_advertisements_state & LE_ADVERTISEMENT_STATE_ACTIVE) != 0;
|
||||
stop_advertisements = (hci_stack->le_advertisements_state & LE_ADVERTISEMENT_STATE_ACTIVE) != 0;
|
||||
|
||||
#ifdef ENABLE_LE_EXTENDED_ADVERTISING
|
||||
if (hci_le_extended_advertising_supported()){
|
||||
@ -5620,7 +5620,7 @@ static void hci_halting_run(void) {
|
||||
} else
|
||||
#else /* ENABLE_LE_PERIPHERAL */
|
||||
{
|
||||
if (stop_advertismenets) {
|
||||
if (stop_advertisements) {
|
||||
hci_stack->le_advertisements_state &= ~LE_ADVERTISEMENT_STATE_ACTIVE;
|
||||
hci_send_cmd(&hci_le_set_advertise_enable, 0);
|
||||
return;
|
||||
@ -5695,7 +5695,7 @@ static void hci_halting_run(void) {
|
||||
|
||||
btstack_run_loop_remove_timer(&hci_stack->timeout);
|
||||
|
||||
// no connections left, wait a bit to assert that btstack_cyrpto isn't waiting for an HCI event
|
||||
// no connections left, wait a bit to assert that btstack_crypto isn't waiting for an HCI event
|
||||
log_info("HCI_STATE_HALTING: wait 50 ms");
|
||||
hci_stack->substate = HCI_HALTING_W4_CLOSE_TIMER;
|
||||
btstack_run_loop_set_timer(&hci_stack->timeout, 50);
|
||||
@ -5754,7 +5754,7 @@ static void hci_falling_asleep_run(void){
|
||||
log_info("HCI_STATE_HALTING, disabling inq scans");
|
||||
hci_send_cmd(&hci_write_scan_enable, hci_stack->connectable << 1); // drop inquiry scan but keep page scan
|
||||
|
||||
// continue in next sub state
|
||||
// continue in next substate
|
||||
hci_stack->substate = HCI_FALLING_ASLEEP_W4_WRITE_SCAN_ENABLE;
|
||||
break;
|
||||
}
|
||||
@ -6890,7 +6890,7 @@ static bool hci_run_general_gap_le(void){
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// post-pone all actions until stack is fully working
|
||||
// postpone all actions until stack is fully working
|
||||
if (hci_stack->state != HCI_STATE_WORKING) return false;
|
||||
|
||||
// advertisements, active scanning, and creating connections requires random address to be set if using private address
|
||||
@ -7947,7 +7947,7 @@ void gap_ssp_set_authentication_requirement(int authentication_requirement){
|
||||
hci_stack->ssp_authentication_requirement = authentication_requirement;
|
||||
}
|
||||
|
||||
// if set, BTstack will confirm a numberic comparion and enter '000000' if requested
|
||||
// if set, BTstack will confirm a numeric comparison and enter '000000' if requested
|
||||
void gap_ssp_set_auto_accept(int auto_accept){
|
||||
hci_stack->ssp_auto_accept = auto_accept;
|
||||
}
|
||||
@ -7974,7 +7974,7 @@ uint8_t hci_send_cmd_va_arg(const hci_cmd_t * cmd, va_list argptr){
|
||||
}
|
||||
|
||||
/**
|
||||
* pre: numcmds >= 0 - it's allowed to send a command to the controller
|
||||
* pre: num_commands >= 0 - it's allowed to send a command to the controller
|
||||
*/
|
||||
uint8_t hci_send_cmd(const hci_cmd_t * cmd, ...){
|
||||
va_list argptr;
|
||||
@ -8248,7 +8248,7 @@ static gap_security_level_t gap_security_level_for_connection(hci_connection_t *
|
||||
if ((connection->authentication_flags & AUTH_FLAG_CONNECTION_AUTHENTICATED) == 0) return LEVEL_0;
|
||||
if (connection->encryption_key_size < hci_stack->gap_required_encyrption_key_size) return LEVEL_0;
|
||||
gap_security_level_t security_level = gap_security_level_for_link_key_type(connection->link_key_type);
|
||||
// LEVEL 4 always requires 128 bit encrytion key size
|
||||
// LEVEL 4 always requires 128 bit encryption key size
|
||||
if ((security_level == LEVEL_4) && (connection->encryption_key_size < 16)){
|
||||
security_level = LEVEL_3;
|
||||
}
|
||||
@ -9612,7 +9612,7 @@ static uint16_t hci_sco_packet_length_for_payload_length(uint16_t payload_size){
|
||||
uint16_t sco_packet_length = 0;
|
||||
|
||||
#if defined(ENABLE_SCO_OVER_HCI) || defined (HAVE_SCO_TRANSPORT)
|
||||
// Transparent = mSBC => 1, CVSD with 16-bit samples requires twice as much bytes
|
||||
// Transparent = mSBC => 1, CVSD with 16-bit samples requires twice as many bytes
|
||||
int multiplier;
|
||||
if (((hci_stack->sco_voice_setting_active & 0x03) != 0x03) &&
|
||||
((hci_stack->sco_voice_setting_active & 0x20) == 0x20)) {
|
||||
@ -9718,7 +9718,7 @@ static sm_connection_t * sm_get_connection_for_handle(hci_con_handle_t con_handl
|
||||
}
|
||||
|
||||
// extracted from sm.c to allow enabling of l2cap le data channels without adding sm.c to the build
|
||||
// without sm.c default values from create_connection_for_bd_addr_and_type() resulg in non-encrypted, not-authenticated
|
||||
// without sm.c default values from create_connection_for_bd_addr_and_type() result in non-encrypted, not-authenticated
|
||||
#endif
|
||||
|
||||
uint8_t gap_encryption_key_size(hci_con_handle_t con_handle){
|
||||
@ -9818,7 +9818,7 @@ authorization_state_t gap_authorization_state(hci_con_handle_t con_handle){
|
||||
sm_connection_t * sm_conn = sm_get_connection_for_handle(con_handle);
|
||||
if (sm_conn == NULL) return AUTHORIZATION_UNKNOWN; // wrong connection
|
||||
if (sm_conn->sm_connection_encrypted == 0u) return AUTHORIZATION_UNKNOWN; // unencrypted connection cannot be authorized
|
||||
if (sm_conn->sm_connection_authenticated == 0u) return AUTHORIZATION_UNKNOWN; // unauthenticatd connection cannot be authorized
|
||||
if (sm_conn->sm_connection_authenticated == 0u) return AUTHORIZATION_UNKNOWN; // unauthenticated connection cannot be authorized
|
||||
return sm_conn->sm_connection_authorization_state;
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user