You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2016/06/08 11:50:51 UTC

[4/7] incubator-mynewt-core git commit: BLE Host - Don't print status for no-op event.

BLE Host - Don't print status for no-op event.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/f4673d2f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/f4673d2f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/f4673d2f

Branch: refs/heads/upf54
Commit: f4673d2f2361b1f8cac0db4fed0e4e458428253f
Parents: a33be91
Author: Christopher Collins <cc...@apache.org>
Authored: Wed Jun 8 18:46:27 2016 +0800
Committer: Christopher Collins <cc...@apache.org>
Committed: Wed Jun 8 18:46:27 2016 +0800

----------------------------------------------------------------------
 net/nimble/host/src/host_dbg.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f4673d2f/net/nimble/host/src/host_dbg.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/host_dbg.c b/net/nimble/host/src/host_dbg.c
index 6303f62..d7a31e3 100644
--- a/net/nimble/host/src/host_dbg.c
+++ b/net/nimble/host/src/host_dbg.c
@@ -325,18 +325,30 @@ host_hci_dbg_cmd_complete_disp(uint8_t *evdata, uint8_t len)
     uint8_t status;
     uint16_t opcode;
 
+    if (len < 3) {
+        BLE_HS_LOG(DEBUG, "Invalid command complete: len=%d "
+                          "(expected >= 3)", len);
+        goto done;
+    }
+
     cmd_pkts = evdata[0];
     opcode = le16toh(evdata + 1);
     ogf = BLE_HCI_OGF(opcode);
     ocf = BLE_HCI_OCF(opcode);
+
+    BLE_HS_LOG(DEBUG, "Command complete: cmd_pkts=%u ogf=0x%x ocf=0x%x",
+               cmd_pkts, ogf, ocf);
+
+    if (len == 3) {
+        goto done;
+    }
+
     status = evdata[3];
+    BLE_HS_LOG(DEBUG, " status=%u ", status);
 
     /* Move past header and status */
     evdata += 4;
 
-    BLE_HS_LOG(DEBUG, "Command Complete: cmd_pkts=%u ogf=0x%x ocf=0x%x "
-                      "status=%u ", cmd_pkts, ogf, ocf, status);
-
     /* Display parameters based on command. */
     switch (ogf) {
     case BLE_HCI_OGF_INFO_PARAMS:
@@ -398,6 +410,8 @@ host_hci_dbg_cmd_complete_disp(uint8_t *evdata, uint8_t len)
     default:
         break;
     }
+
+done:
     BLE_HS_LOG(DEBUG, "\n");
 }