From: Nils Faerber Date: Sat, 6 Jul 2013 21:19:10 +0000 (+0200) Subject: Sanity check for enabled BT X-Git-Url: https://git.karo-electronics.de/?p=oswald.git;a=commitdiff_plain;h=f9c26e3f61a2d9bc1070cef0f6f08bd6f6240849;ds=sidebyside Sanity check for enabled BT --- diff --git a/metawatch/bt_hci.c b/metawatch/bt_hci.c index 7bf7444..56e490e 100644 --- a/metawatch/bt_hci.c +++ b/metawatch/bt_hci.c @@ -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;