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/04/26 07:21:19 UTC

[GitHub] sjanc closed pull request #65: some minor scan cleanups

sjanc closed pull request #65: some minor scan cleanups
URL: https://github.com/apache/mynewt-nimble/pull/65
 
 
   

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_scan.c b/nimble/controller/src/ble_ll_scan.c
index bd43abe8..cc6a3970 100644
--- a/nimble/controller/src/ble_ll_scan.c
+++ b/nimble/controller/src/ble_ll_scan.c
@@ -68,10 +68,10 @@ static const uint8_t ble_ll_valid_scan_phy_mask = (BLE_HCI_LE_PHY_1M_PREF_MASK
 #endif
 
 /* The scanning parameters set by host */
-struct ble_ll_scan_params g_ble_ll_scan_params[BLE_LL_SCAN_PHY_NUMBER];
+static struct ble_ll_scan_params g_ble_ll_scan_params[BLE_LL_SCAN_PHY_NUMBER];
 
 /* The scanning state machine global object */
-struct ble_ll_scan_sm g_ble_ll_scan_sm;
+static struct ble_ll_scan_sm g_ble_ll_scan_sm;
 
 #define BLE_LL_EXT_ADV_ADVA_BIT         (0)
 #define BLE_LL_EXT_ADV_TARGETA_BIT      (1)
@@ -2652,9 +2652,13 @@ ble_ll_set_ext_scan_params(uint8_t *cmd)
     coded->scan_filt_policy = cmd[1];
     uncoded->scan_filt_policy = cmd[1];
 
-    if (!(cmd[2] & ble_ll_valid_scan_phy_mask)) {
-        return BLE_ERR_INV_HCI_CMD_PARMS;
-    }
+    /* Check if no reserved bits in PHYS are set and that at least one valid PHY
+     * is set.
+     */
+    if (!(cmd[2] & ble_ll_valid_scan_phy_mask) ||
+                                    (cmd[2] & ~ble_ll_valid_scan_phy_mask)) {
+         return BLE_ERR_INV_HCI_CMD_PARMS;
+     }
 
     idx = 3;
     if (cmd[2] & BLE_HCI_LE_PHY_1M_PREF_MASK) {
@@ -3168,10 +3172,10 @@ ble_ll_scan_common_init(void)
 
     /* Initialize extended scan timers */
 #if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
-    os_cputime_timer_init(&g_ble_ll_scan_sm.duration_timer,
-                            ble_ll_scan_duration_timer_cb, &g_ble_ll_scan_sm);
-    os_cputime_timer_init(&g_ble_ll_scan_sm.period_timer,
-                            ble_ll_scan_period_timer_cb, &g_ble_ll_scan_sm);
+    os_cputime_timer_init(&scansm->duration_timer,
+                                        ble_ll_scan_duration_timer_cb, scansm);
+    os_cputime_timer_init(&scansm->period_timer, ble_ll_scan_period_timer_cb,
+                                                                        scansm);
 #endif
 
     /* Get a scan request mbuf (packet header) and attach to state machine */


 

----------------------------------------------------------------
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