You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by "sjanc (via GitHub)" <gi...@apache.org> on 2023/02/02 21:54:22 UTC

[GitHub] [mynewt-nimble] sjanc commented on a diff in pull request #1445: nimble/ll: Rework global chan_map handling

sjanc commented on code in PR #1445:
URL: https://github.com/apache/mynewt-nimble/pull/1445#discussion_r1095121805


##########
nimble/controller/src/ble_ll_hci.c:
##########
@@ -832,6 +833,36 @@ ble_ll_write_rf_path_compensation(const uint8_t *cmdbuf, uint8_t len)
     return BLE_ERR_SUCCESS;
 }
 
+static int
+ble_ll_hci_le_set_host_chan_class(const uint8_t *cmdbuf, uint8_t len)
+{
+    const struct ble_hci_le_set_host_chan_class_cp *cmd = (const void *)cmdbuf;
+    uint8_t chan_map_used;
+
+    if (len != sizeof(*cmd)) {
+        return BLE_ERR_INV_HCI_CMD_PARMS;
+    }
+
+    /* HCI command allows only single channel to be enabled, but LL needs at
+     * least 2 channels to work so let's reject in such case.
+     */
+    chan_map_used = ble_ll_utils_chan_map_used_get(cmd->chan_map);
+    if ((chan_map_used < 2) || (cmd->chan_map[4] & 0xe0)) {
+        return BLE_ERR_INV_HCI_CMD_PARMS;
+    }
+
+    if (!memcmp(g_ble_ll_data.chan_map, cmd->chan_map, BLE_LL_CHAN_MAP_LEN)) {
+        return 0;

Review Comment:
   nitpick: return BLE_ERR_SUCCESS



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org