system/bt
修订版 | 82728056c74840845a156b440fd4873ad534bb01 (tree) |
---|---|
时间 | 2016-11-15 10:08:00 |
作者 | Jaap Jan Meijer <jjmeijer88@gmai...> |
Commiter | Jaap Jan Meijer |
Do not read BLE vendor capability to restore AOSP behaviour
This makes it possible to support multiple device types. Otherwise devices
that do not support this command will cause enabling BT to time out.
This is a combination of 2 commits.
Revert "BT: Fix up device not turning on due to BLE command"
This reverts commit 1a2f814383ffde3cc77e8dbd5d4fa675d1211d04.
Revert "Bluetooth: Read BLE vendor capability to proceed on Secure conn"
This reverts commit e787d761ab50bae45c15a0c74bf9a43f44e7076c.
Conflicts:
hci/src/hci_layer.c
Change-Id: I71584f538ffe0aee506212ba0a4507586d6964c6
@@ -80,7 +80,6 @@ typedef struct controller_t { | ||
80 | 80 | uint8_t (*get_ble_resolving_list_max_size)(void); |
81 | 81 | void (*set_ble_resolving_list_max_size)(int resolving_list_max_size); |
82 | 82 | uint8_t *(*get_local_supported_codecs)(uint8_t *number_of_codecs); |
83 | - bool (*supports_ble_offload_features)(void); | |
84 | 83 | } controller_t; |
85 | 84 | |
86 | 85 | const controller_static_t *controller_get_static_interface(); |
@@ -78,7 +78,6 @@ static uint8_t number_of_local_supported_codecs = 0; | ||
78 | 78 | |
79 | 79 | static bool readable; |
80 | 80 | static bool ble_supported; |
81 | -static bool ble_offload_features_supported; | |
82 | 81 | static bool simple_pairing_supported; |
83 | 82 | static bool secure_connections_supported; |
84 | 83 |
@@ -205,18 +204,12 @@ static future_t *start_up(void) { | ||
205 | 204 | |
206 | 205 | page_number++; |
207 | 206 | } |
208 | -#if (BLE_INCLUDED == TRUE) | |
209 | - // read BLE offload features support from controller | |
210 | - response = AWAIT_COMMAND(packet_factory->make_ble_read_offload_features_support()); | |
211 | - packet_parser->parse_ble_read_offload_features_response(response, &ble_offload_features_supported); | |
212 | -#endif | |
207 | + | |
213 | 208 | #if (SC_MODE_INCLUDED == TRUE) |
214 | - if(ble_offload_features_supported) { | |
215 | - secure_connections_supported = HCI_SC_CTRLR_SUPPORTED(features_classic[2].as_array); | |
216 | - if (secure_connections_supported) { | |
217 | - response = AWAIT_COMMAND(packet_factory->make_write_secure_connections_host_support(HCI_SC_MODE_ENABLED)); | |
218 | - packet_parser->parse_generic_command_complete(response); | |
219 | - } | |
209 | + secure_connections_supported = HCI_SC_CTRLR_SUPPORTED(features_classic[2].as_array); | |
210 | + if (secure_connections_supported) { | |
211 | + response = AWAIT_COMMAND(packet_factory->make_write_secure_connections_host_support(HCI_SC_MODE_ENABLED)); | |
212 | + packet_parser->parse_generic_command_complete(response); | |
220 | 213 | } |
221 | 214 | #endif |
222 | 215 |
@@ -430,12 +423,6 @@ static bool supports_ble_connection_parameters_request(void) { | ||
430 | 423 | return HCI_LE_CONN_PARAM_REQ_SUPPORTED(features_ble.as_array); |
431 | 424 | } |
432 | 425 | |
433 | -static bool supports_ble_offload_features(void) { | |
434 | - assert(readable); | |
435 | - assert(ble_supported); | |
436 | - return ble_offload_features_supported; | |
437 | -} | |
438 | - | |
439 | 426 | static uint16_t get_acl_data_size_classic(void) { |
440 | 427 | assert(readable); |
441 | 428 | return acl_data_size_classic; |
@@ -540,8 +527,7 @@ static const controller_t interface = { | ||
540 | 527 | |
541 | 528 | get_ble_resolving_list_max_size, |
542 | 529 | set_ble_resolving_list_max_size, |
543 | - get_local_supported_codecs, | |
544 | - supports_ble_offload_features | |
530 | + get_local_supported_codecs | |
545 | 531 | }; |
546 | 532 | |
547 | 533 | const controller_static_t *controller_get_static_interface() { |
@@ -41,7 +41,6 @@ typedef struct { | ||
41 | 41 | BT_HDR *(*make_ble_read_suggested_default_data_length)(void); |
42 | 42 | BT_HDR *(*make_ble_set_event_mask)(const bt_event_mask_t *event_mask); |
43 | 43 | BT_HDR *(*make_read_local_supported_codecs)(void); |
44 | - BT_HDR *(*make_ble_read_offload_features_support)(void); | |
45 | 44 | } hci_packet_factory_t; |
46 | 45 | |
47 | 46 | const hci_packet_factory_t *hci_packet_factory_get_interface(); |
@@ -96,10 +96,6 @@ typedef struct { | ||
96 | 96 | BT_HDR *response, |
97 | 97 | uint8_t *number_of_local_supported_codecs, uint8_t *local_supported_codecs); |
98 | 98 | |
99 | - void (*parse_ble_read_offload_features_response)( | |
100 | - BT_HDR *response, | |
101 | - bool *ble_offload_features_supported); | |
102 | - | |
103 | 99 | } hci_packet_parser_t; |
104 | 100 | |
105 | 101 | const hci_packet_parser_t *hci_packet_parser_get_interface(); |
@@ -903,26 +903,6 @@ static waiting_command_t *get_waiting_command(command_opcode_t opcode) { | ||
903 | 903 | pthread_mutex_unlock(&commands_pending_response_lock); |
904 | 904 | return wait_entry; |
905 | 905 | } |
906 | - // look for any command complete with improper VS Opcode | |
907 | - for (const list_node_t *node = list_begin(commands_pending_response); | |
908 | - node != list_end(commands_pending_response); | |
909 | - node = list_next(node)) { | |
910 | - waiting_command_t *wait_entry = list_node(node); | |
911 | - | |
912 | - if (wait_entry && (wait_entry->opcode != opcode) && | |
913 | - (((wait_entry->opcode & HCI_GRP_VENDOR_SPECIFIC) == HCI_GRP_VENDOR_SPECIFIC) && | |
914 | - ((opcode & HCI_GRP_VENDOR_SPECIFIC) == HCI_GRP_VENDOR_SPECIFIC))) { | |
915 | - LOG_DEBUG("%s VS event found treat it as valid 0x%x", __func__, opcode); | |
916 | - } | |
917 | - else { | |
918 | - continue; | |
919 | - } | |
920 | - | |
921 | - list_remove(commands_pending_response, wait_entry); | |
922 | - | |
923 | - pthread_mutex_unlock(&commands_pending_response_lock); | |
924 | - return wait_entry; | |
925 | - } | |
926 | 906 | |
927 | 907 | pthread_mutex_unlock(&commands_pending_response_lock); |
928 | 908 | return NULL; |
@@ -141,10 +141,6 @@ static BT_HDR *make_read_local_supported_codecs(void) { | ||
141 | 141 | return make_command_no_params(HCI_READ_LOCAL_SUPPORTED_CODECS); |
142 | 142 | } |
143 | 143 | |
144 | -static BT_HDR *make_ble_read_offload_features_support(void) { | |
145 | - return make_command_no_params(HCI_BLE_VENDOR_CAP_OCF); | |
146 | -} | |
147 | - | |
148 | 144 | static BT_HDR *make_ble_set_event_mask(const bt_event_mask_t *event_mask) { |
149 | 145 | uint8_t *stream; |
150 | 146 | uint8_t parameter_size = sizeof(bt_event_mask_t); |
@@ -202,8 +198,7 @@ static const hci_packet_factory_t interface = { | ||
202 | 198 | make_ble_read_resolving_list_size, |
203 | 199 | make_ble_read_suggested_default_data_length, |
204 | 200 | make_ble_set_event_mask, |
205 | - make_read_local_supported_codecs, | |
206 | - make_ble_read_offload_features_support | |
201 | + make_read_local_supported_codecs | |
207 | 202 | }; |
208 | 203 | |
209 | 204 | const hci_packet_factory_t *hci_packet_factory_get_interface() { |
@@ -88,21 +88,6 @@ static void parse_read_local_supported_codecs_response( | ||
88 | 88 | buffer_allocator->free(response); |
89 | 89 | } |
90 | 90 | |
91 | - | |
92 | -static void parse_ble_read_offload_features_response( | |
93 | - BT_HDR *response, | |
94 | - bool *ble_offload_features_supported) { | |
95 | - | |
96 | - uint8_t *stream = read_command_complete_header(response, NO_OPCODE_CHECKING, 0 /* bytes after */); | |
97 | - if(stream) { | |
98 | - *ble_offload_features_supported = true; | |
99 | - } else { | |
100 | - *ble_offload_features_supported = false; | |
101 | - } | |
102 | - | |
103 | - buffer_allocator->free(response); | |
104 | -} | |
105 | - | |
106 | 91 | static void parse_read_bd_addr_response( |
107 | 92 | BT_HDR *response, |
108 | 93 | bt_bdaddr_t *address_ptr) { |
@@ -273,8 +258,7 @@ static const hci_packet_parser_t interface = { | ||
273 | 258 | parse_ble_read_local_supported_features_response, |
274 | 259 | parse_ble_read_resolving_list_size_response, |
275 | 260 | parse_ble_read_suggested_default_data_length_response, |
276 | - parse_read_local_supported_codecs_response, | |
277 | - parse_ble_read_offload_features_response | |
261 | + parse_read_local_supported_codecs_response | |
278 | 262 | }; |
279 | 263 | |
280 | 264 | const hci_packet_parser_t *hci_packet_parser_get_interface() { |