bluetooth: hci_core: Fix conn params validity check
Bluetooth Core Specification v5.0, Vol 2, Part E, 7.8.12: "The Supervision_Timeout parameter defines the link supervision timeout for the connection. The Supervision_Timeout in milliseconds shall be larger than (1 + Conn_Latency) * Conn_Interval_Max * 2, where Conn_Interval_Max is given in milliseconds." Let's remember that: conn_interval is given in units N * 1.25 ms sup_timeout is given in units N * 10 ms sup_timeout_ms > (1 + latency) * (conn_interval_ms * 2) yields: sup_timeout_n * 10 > (1 + latency) * (conn_interval_n * 1.25 * 2) yields: sup_timeout_n * 10 > (1 + latency) * (conn_interval_n * 2.5) yields: sup_timeout_n * 4 > (1 + latency) * (conn_interval_n) Change-id: I30ac1d375a1baaa3e61f4c29b1165110599e1f7c Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
This commit is contained in:
parent
e564de0deb
commit
93d7512215
1 changed files with 6 additions and 8 deletions
|
@ -786,22 +786,20 @@ static void le_remote_feat_complete(struct net_buf *buf)
|
|||
|
||||
bool bt_le_conn_params_valid(const struct bt_le_conn_param *param)
|
||||
{
|
||||
/* All limits according to BT Core spec 5.0 [Vol 2, Part E, 7.8.12] */
|
||||
|
||||
if (param->interval_min > param->interval_max ||
|
||||
param->interval_min < 6 || param->interval_max > 3200) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Limits according to BT Core spec 4.2 [Vol 2, Part E, 7.8.12] */
|
||||
if (param->timeout < 10 || param->timeout > 3200 ||
|
||||
((2 * param->timeout) <
|
||||
((1 + param->latency) * param->interval_max * 5))) {
|
||||
if (param->latency > 499) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Limits according to BT Core spec 4.2 [Vol 6, Part B, 4.5.1] */
|
||||
if (param->latency > 499 ||
|
||||
(((param->latency + 1) * param->interval_max) >
|
||||
(param->timeout * 4))) {
|
||||
if (param->timeout < 10 || param->timeout > 3200 ||
|
||||
((4 * param->timeout) <=
|
||||
((1 + param->latency) * param->interval_max))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue