]> git.karo-electronics.de Git - oswald.git/blobdiff - metawatch/bt_hci.c
Sanity check for enabled BT
[oswald.git] / metawatch / bt_hci.c
index 7bf74449eb8f9d8fe1f85d846241abf2f9e71ac1..56e490ece0b20bfdb3c75ef1eaccbde00ca7f9b5 100644 (file)
@@ -422,6 +422,10 @@ void bt_hci_cmd(const uint8_t OGF, const uint8_t OCF, const uint8_t data_len, co
 {
        bt_hci_cmd_t packet;
 
+       // refuse any HCI if interface is not enabled
+       if (mw_bt_is_enabled() == 0)
+               return;
+
        if (state == EHCILL_SLEEPING) {
                uint8_t ehcill_p = EHCILL_WAKE_UP_IND;
 
@@ -472,6 +476,10 @@ void bt_acl_send(const uint16_t handle, const uint8_t PB, const uint8_t BC, cons
 {
        bt_hci_acl_t packet;
 
+       // refuse any HCI if interface is not enabled
+       if (mw_bt_is_enabled() == 0)
+               return;
+
        packet.type = HCI_ACL_DATA_PACKET;
        packet.handle = handle | ((PB & 0x03) << 12) | ((BC & 0x03) << 14);
        packet.total_length = dlen + 4;