You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by we...@apache.org on 2017/04/27 00:39:18 UTC

[1/2] incubator-mynewt-core git commit: MYNEWT-738: Fix parameter array errors

Repository: incubator-mynewt-core
Updated Branches:
  refs/heads/master 02fd7c764 -> eb4f28984


MYNEWT-738: Fix parameter array errors

Fix number of completed packet events


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/af6fb7e0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/af6fb7e0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/af6fb7e0

Branch: refs/heads/master
Commit: af6fb7e052873dee489ebe73e3b52f867ba3e255
Parents: 271ab1b
Author: William San Filippo <wi...@runtime.io>
Authored: Sun Apr 23 16:40:46 2017 -0700
Committer: William San Filippo <wi...@runtime.io>
Committed: Sun Apr 23 16:40:46 2017 -0700

----------------------------------------------------------------------
 net/nimble/controller/src/ble_ll_conn_hci.c | 12 ++----------
 net/nimble/host/src/ble_hs_dbg.c            |  7 ++-----
 net/nimble/host/src/ble_hs_hci_evt.c        |  5 +++--
 3 files changed, 7 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/af6fb7e0/net/nimble/controller/src/ble_ll_conn_hci.c
----------------------------------------------------------------------
diff --git a/net/nimble/controller/src/ble_ll_conn_hci.c b/net/nimble/controller/src/ble_ll_conn_hci.c
index 80e7adc..bd235e7 100644
--- a/net/nimble/controller/src/ble_ll_conn_hci.c
+++ b/net/nimble/controller/src/ble_ll_conn_hci.c
@@ -250,7 +250,6 @@ ble_ll_conn_num_comp_pkts_event_send(struct ble_ll_conn_sm *connsm)
     int event_sent;
     uint8_t *evbuf;
     uint8_t *handle_ptr;
-    uint8_t *comp_pkt_ptr;
     uint8_t handles;
 
     if (connsm == NULL) {
@@ -291,7 +290,6 @@ skip_conn:
     evbuf = NULL;
     handles = 0;
     handle_ptr = NULL;
-    comp_pkt_ptr = NULL;
     event_sent = 0;
     SLIST_FOREACH(connsm, &g_ble_ll_conn_active_list, act_sle) {
         /*
@@ -308,15 +306,13 @@ skip_conn:
                 }
                 handles = 0;
                 handle_ptr = evbuf + 3;
-                comp_pkt_ptr = handle_ptr + (sizeof(uint16_t) * max_handles);
             }
 
             /* Add handle and complete packets */
             put_le16(handle_ptr, connsm->conn_handle);
-            put_le16(comp_pkt_ptr, connsm->completed_pkts);
+            put_le16(handle_ptr + 2, connsm->completed_pkts);
             connsm->completed_pkts = 0;
-            handle_ptr += sizeof(uint16_t);
-            comp_pkt_ptr += sizeof(uint16_t);
+            handle_ptr += (2 * sizeof(uint16_t));
             ++handles;
 
             /* Send now if the buffer is full. */
@@ -337,10 +333,6 @@ skip_conn:
         evbuf[0] = BLE_HCI_EVCODE_NUM_COMP_PKTS;
         evbuf[1] = (handles * 2 * sizeof(uint16_t)) + 1;
         evbuf[2] = handles;
-        if (handles < max_handles) {
-            /* Make the pkt counts contiguous with handles */
-            memmove(handle_ptr, evbuf + 3 + (max_handles * 2), handles * 2);
-        }
         ble_ll_hci_event_send(evbuf);
         event_sent = 1;
     }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/af6fb7e0/net/nimble/host/src/ble_hs_dbg.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_hs_dbg.c b/net/nimble/host/src/ble_hs_dbg.c
index 77c84f1..34ec884 100644
--- a/net/nimble/host/src/ble_hs_dbg.c
+++ b/net/nimble/host/src/ble_hs_dbg.c
@@ -247,7 +247,6 @@ ble_hs_dbg_num_comp_pkts_disp(uint8_t *evdata, uint8_t len)
 {
     uint8_t handles;
     uint8_t *handle_ptr;
-    uint8_t *pkt_ptr;
     uint16_t handle;
     uint16_t pkts;
 
@@ -263,12 +262,10 @@ ble_hs_dbg_num_comp_pkts_disp(uint8_t *evdata, uint8_t len)
                handles);
     if (handles) {
         handle_ptr = evdata + 1;
-        pkt_ptr = handle_ptr + (2 * handles);
         while (handles) {
             handle = get_le16(handle_ptr);
-            handle_ptr += 2;
-            pkts = get_le16(pkt_ptr);
-            pkt_ptr += 2;
+            pkts = get_le16(handle_ptr + 2);
+            handle_ptr += 4;
             BLE_HS_LOG(DEBUG, "handle:%u pkts:%u\n", handle, pkts);
             --handles;
         }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/af6fb7e0/net/nimble/host/src/ble_hs_hci_evt.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_hs_hci_evt.c b/net/nimble/host/src/ble_hs_hci_evt.c
index a9655e3..d7cca0e 100644
--- a/net/nimble/host/src/ble_hs_hci_evt.c
+++ b/net/nimble/host/src/ble_hs_hci_evt.c
@@ -219,8 +219,9 @@ ble_hs_hci_evt_num_completed_pkts(uint8_t event_code, uint8_t *data, int len)
     off++;
 
     for (i = 0; i < num_handles; i++) {
-        handle = get_le16(data + off + 2 * i);
-        num_pkts = get_le16(data + off + 2 * num_handles + 2 * i);
+        handle = get_le16(data + off);
+        num_pkts = get_le16(data + off + 2);
+        off += (2 * sizeof(uint16_t));
 
         /* XXX: Do something with these values. */
         (void)handle;


[2/2] incubator-mynewt-core git commit: This closes #245

Posted by we...@apache.org.
This closes #245

Fix number of completed packet events in both controller and host.


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/eb4f2898
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/eb4f2898
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/eb4f2898

Branch: refs/heads/master
Commit: eb4f28984bce5812e1759049425ef5fbe42518da
Parents: 02fd7c7 af6fb7e
Author: William San Filippo <wi...@runtime.io>
Authored: Wed Apr 26 17:38:34 2017 -0700
Committer: William San Filippo <wi...@runtime.io>
Committed: Wed Apr 26 17:38:34 2017 -0700

----------------------------------------------------------------------
 net/nimble/controller/src/ble_ll_conn_hci.c | 12 ++----------
 net/nimble/host/src/ble_hs_dbg.c            |  7 ++-----
 net/nimble/host/src/ble_hs_hci_evt.c        |  5 +++--
 3 files changed, 7 insertions(+), 17 deletions(-)
----------------------------------------------------------------------