You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2018/07/31 15:47:15 UTC

[GitHub] andrzej-kaczmarek closed pull request #154: nimble/ll: Fix setting suggested length values

andrzej-kaczmarek closed pull request #154: nimble/ll: Fix setting suggested length values
URL: https://github.com/apache/mynewt-nimble/pull/154
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/nimble/controller/src/ble_ll_hci.c b/nimble/controller/src/ble_ll_hci.c
index 2e246839..25f1879c 100644
--- a/nimble/controller/src/ble_ll_hci.c
+++ b/nimble/controller/src/ble_ll_hci.c
@@ -407,13 +407,16 @@ ble_ll_hci_le_wr_sugg_data_len(uint8_t *cmdbuf)
         g_ble_ll_conn_params.sugg_tx_octets = (uint8_t)tx_oct;
         g_ble_ll_conn_params.sugg_tx_time = tx_time;
 
-        /* XXX TODO: This has to change! They do not have to be the same
-           at this point. Deal with this */
-        if ((tx_time <= g_ble_ll_conn_params.supp_max_tx_time) &&
-            (tx_oct <= g_ble_ll_conn_params.supp_max_tx_octets)) {
-            g_ble_ll_conn_params.conn_init_max_tx_octets = tx_oct;
-            g_ble_ll_conn_params.conn_init_max_tx_time = tx_time;
-        }
+        /*
+         * We can disregard host suggestion, but we are a nice controller so
+         * let's use host suggestion, unless they exceed max supported values
+         * in which case we just use our max.
+         */
+        g_ble_ll_conn_params.conn_init_max_tx_octets =
+                        min(tx_oct, g_ble_ll_conn_params.supp_max_tx_octets);
+        g_ble_ll_conn_params.conn_init_max_tx_time =
+                        min(tx_time, g_ble_ll_conn_params.supp_max_tx_time);
+
         rc = BLE_ERR_SUCCESS;
     } else {
         rc = BLE_ERR_INV_HCI_CMD_PARMS;


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services