nimble/controller: Fix checking PHY Options in LE Set PHY We need to check complete value here, then we can store only lsb since msb will be zero anyway.
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/502fbb75 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/502fbb75 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/502fbb75 Branch: refs/heads/bluetooth5 Commit: 502fbb752d18316eab8fb55e223a837b99452675 Parents: 2446dcb Author: Andrzej Kaczmarek <[email protected]> Authored: Fri Apr 28 00:44:15 2017 +0200 Committer: Andrzej Kaczmarek <[email protected]> Committed: Wed May 17 11:55:28 2017 +0200 ---------------------------------------------------------------------- net/nimble/controller/src/ble_ll_conn_hci.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/502fbb75/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 bea9e9b..f86b954 100644 --- a/net/nimble/controller/src/ble_ll_conn_hci.c +++ b/net/nimble/controller/src/ble_ll_conn_hci.c @@ -1233,7 +1233,7 @@ int ble_ll_conn_hci_le_set_phy(uint8_t *cmdbuf) { int rc; - uint8_t phy_options; + uint16_t phy_options; uint8_t tx_phys; uint8_t rx_phys; uint16_t handle; @@ -1253,11 +1253,11 @@ ble_ll_conn_hci_le_set_phy(uint8_t *cmdbuf) return BLE_ERR_CMD_DISALLOWED; } - phy_options = cmdbuf[5]; + phy_options = get_le16(cmdbuf + 5); if (phy_options > BLE_HCI_LE_PHY_CODED_S8_PREF) { return BLE_ERR_INV_HCI_CMD_PARMS; } - connsm->phy_data.phy_options = phy_options; + connsm->phy_data.phy_options = phy_options & 0x03; /* Check valid parameters */ rc = ble_ll_hci_chk_phy_masks(cmdbuf + 2, &tx_phys, &rx_phys);
