From f9c26e3f61a2d9bc1070cef0f6f08bd6f6240849 Mon Sep 17 00:00:00 2001 From: Nils Faerber Date: Sat, 6 Jul 2013 23:19:10 +0200 Subject: [PATCH] Sanity check for enabled BT --- metawatch/bt_hci.c | 8 ++++++++ 1 file changed, 8 insertions(+) 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; -- 2.39.2