Browse code

Sanity check for enabled BT

Nils Faerber authored on 06/07/2013 21:19:10
Showing 1 changed files
... ...
@@ -422,6 +422,10 @@ void bt_hci_cmd(const uint8_t OGF, const uint8_t OCF, const uint8_t data_len, co
422 422
 {
423 423
 	bt_hci_cmd_t packet;
424 424
 
425
+	// refuse any HCI if interface is not enabled
426
+	if (mw_bt_is_enabled() == 0)
427
+		return;
428
+
425 429
 	if (state == EHCILL_SLEEPING) {
426 430
 		uint8_t ehcill_p = EHCILL_WAKE_UP_IND;
427 431
 
... ...
@@ -472,6 +476,10 @@ void bt_acl_send(const uint16_t handle, const uint8_t PB, const uint8_t BC, cons
472 476
 {
473 477
 	bt_hci_acl_t packet;
474 478
 
479
+	// refuse any HCI if interface is not enabled
480
+	if (mw_bt_is_enabled() == 0)
481
+		return;
482
+
475 483
 	packet.type = HCI_ACL_DATA_PACKET;
476 484
 	packet.handle = handle | ((PB & 0x03) << 12) | ((BC & 0x03) << 14);
477 485
 	packet.total_length = dlen + 4;