The endif comment block is for CONFIG_BT_FIXED_PASSKEY not
CONFIG_SMP_FIXED_PASSKEY. Fix the comment to match.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
BT_LE_ADV_CONN_DIR_LOW_DUTY declares a local variable so it cannot go
out of scope, so instead of assigning in the scope of the if statement
this rework the code to mantain the declaration in the same scope it is
used.
Fixes#10570
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This makes mesh shell to register commands with the new shell subsystem
and stop using the legacy shell.
Fixes#11056
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
With multiple devices on auto-connect list it is possible that while
having pending connection to device A, device B disconnects. In that
case host should not try to start scan (currently controller doesn't
support concurrent scanning and initiating).
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
This commit moves the BLE GATT Device Information service
from /samples/bluetooth/gatt to /subsys/bluetooth/services and adds
a Kconfig entry to enable and configure the service;
when enabled, it will register itself automatically.
Signed-off-by: Emanuele Di Santo <emdi@nordicsemi.no>
Signed-off-by: Radoslaw Koppel <radoslaw.koppel@nordicsemi.no>
Add support for exchanging both minimum and maximum
connection interval values in Connection Parameter Request
Procedure implementation.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fallback to L2CAP Connection Parameters Update Request if LL Connection
Update Request was rejected by remote device that has this marked as
supported in features. This can happen if procedure is supported only
by remote controller, but not enabled by host. This is connection
parameters update with iOS devices.
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
The code had somehow gotten corrupt (yet in a way that it compiles) so
that an intended if-branch was missing.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This will exclude GATT Client response handlers from compilation
if GATT Client support is disabled.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This is a pure refactoring of the k32src_wait function. It used the
following rules when refactoring:
Don't use the preprocessor when unprocessed C language suffices.
Don't undefine macro's.
Avoid global variables when possible.
Use consistent names for similiar things (hf_clock, lf_clock).
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
k_poll_signal was being used by both, struct and function. Besides
this being extremely error prone it is also a MISRA-C violation.
Changing the function to contain a verb, since it performs an action
and the struct will be a noun. This pattern must be formalized and
followed and across the project.
MISRA-C rules 5.7 and 5.9
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Fix misspellings in Kconfig files that show up in the configuration
documentation (and make menuconfig screens).
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
Fix an integer overflow in the scheduling implementation
that calculates whether resources required for next radio
event be retained.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit optimizes access to RNG driver by taking advantage
of the data structures layout. As result, number of calls to RNG
driver is reduced.
Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
The entropy_nrf_get_entropy_isr(), which is specific to this driver,
is in fact equivalent of generic entropy_get_entropy_isr(..., 0).
This commit removes the entropy_nrf_get_entropy_isr() function
and replaces its usage by call to generic entropy API.
Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
In Bluetooth 5 the definition of LE security mode 1, has changed.
LE Security Mode 1 level 4 requires authenticated LE Secure Connections
pairing with encryption using a 128-bit strength encryption key.
This also changes the behaviour when a security request and response
would end up with a security level that is lower than the one requested.
Before pairing would complete, and the link would disconnect with error
authentication failure. Instead a SMP will abort pairing with error code
authentication requirement, or encryption key size.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This adds new API fuction to update running advertising data.
It will remove the need of advertising restarting.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
The bluetooth controller has been using the flag '-Ofast' to keep
within a real-time limit. There are two problems with this; firstly,
when a project should be optimized for size it is standard to use -O2,
not -Ofast.
Secondly, optimization flags have been deemed to be non-portable, so
instead of directly using "-Ofast" we should use the intent-macro
OPTIMIZE_FOR_SPEED_FLAG to ensure toolchain portability.
Testing has shown that we are still within the real-time limit when
changing from -Ofast to -O2. -Ofast is about 1us and 1% faster, but
increases the code size by 13kB (5% of the available flash on a
nRF51).
Since the slowdown is comparatively small compared to the code size
increase we have decided to use -O2 in place of -Ofast.
Other optimization combinations were also measured and their results
can be seen below:
-Ofast in BLE Controller and in #pragma in entropy driver.
Memory region Used Size Region Size %age Used
FLASH: 138920 B 256 KB 52.99%
[bt] [INF] encode_control: l: 6, 6, 7; t: 75, 45, 132.
-O2 in BLE Controller and in #pragma in entropy driver.
Memory region Used Size Region Size %age Used
FLASH: 125840 B 256 KB 48.00%
[bt] [INF] encode_control: l: 6, 6, 7; t: 75, 51, 133
-O3 in BLE Controller and in #pragma in entropy driver.
Memory region Used Size Region Size %age Used
FLASH: 138920 B 256 KB 52.99%
[bt] [INF] encode_control: l: 6, 6, 7; t: 75, 50, 132.
No extra CFLAGS for BLE and entropy driver (pragmas removed), using
CONFIG_SIZE_OPTIMIZATIONS=y
Memory region Used Size Region Size %age Used
FLASH: 120124 B 256 KB 45.82%
[bt] [ERR] isr_rx_conn: assert: '!radio_is_ready()' failed
No extra CFLAGS for BLE and entropy driver (pragmas removed), using
CONFIG_SPEED_OPTIMIZATIONS=y
Memory region Used Size Region Size %age Used
FLASH: 138004 B 256 KB 52.64%
[bt] [INF] encode_control: l: 6, 6, 7; t: 61, 51, 130.
NB: RAM usage differences were insignificant.
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
Connection complete event with error code can be received only for
central role and can be compiled conditionally.
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
This adds a possibility to reject incomming LE Connection request
due to insufficient authorization or encryption key size.
This is needed for qualification purposes
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This adds support for returning various return codes from
the channel accept callback.
This is needed for implementation of incoming connection
authorization for certification purposes.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Rename connection response results to map those that are defined
for BR.
BR: BT_L2CAP_BR_*
LE: BT_L2CAP_LE_*
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Convert the monitor protocol to a proper logger backend. This also
means that our log.h headerfile gets greatly simplified.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Now that log processing happens in a separate thread, the
BT_STACK_EXTRA macro is not needed (since there's no significant
overhead), and therefore the BT_STACK macros become unnecessary as
well.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Use irq_lock (same way as bt_hex does it) and increase the number of
static buffers to reduce the risk of reuse before a buffer gets
processed.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This shell command was tied to bluetooth and the bluetooth shell and
also had messages all related to nordic ICs.
Make it generic and put it under drivers/flash/ so it can be included by
anyone and independently of bluetooth.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Mkae sure that variable pointed by params is valid when passing it
as function argument.
Fixes#10587
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
Improve the error feedback when calling bt_le_adv_start and inputting
too much data in the advertisement.
Error feedback before:
Bluetooth initialized
Advertising failed to start (err -22)
Error feedback after:
Bluetooth initialized
[bt] [ERR] set_ad: Advertising data does not fit in buffer
Advertising failed to start (err -22)
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
Add option to disable legacy pairing and only use secure connection.
If legacy pairing was requested pairing will be denied with status
insufficient authenticated
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Added implementation to avoid retransmitting NACK-ed Tx PDU,
to save on current consumption in retrying to transmit in
case peer device has no free buffer to receive the PDU.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
To allow the BLE stack to be used both in the real nRF platforms
and simulated ones, change the used macros in the code to the
COMPATIBLE ones.
Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
Fix broken master role RSSI measurement. Since the original
contribution clean up into Zephyr, the radio shorts that was
set for measuring the RSSI for master role has been broken,
as it was cleared by the radio switching code further in the
Tx ISR.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix connection failed to be established regression
introduced by the commit 350c569aba ("Bluetooth:
controller: Avoid offseting to lldata").
As the Rx-ed PDU buffer is re-used to construct the
connection complete message towards HCI, the fields in the
Rx-ed PDU need to be backup for future use in the control
path. Here the channel selection bit is backup now.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix Connection Parameter Request Procedure implementation
to respond with sent interval_min and interval_max so that
certain peer devices dont reject the response as Invalid LL
Parameters.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit adds missed const modifier for addr pointer for
bt_le_set_auto_conn function
Signed-off-by: Radoslaw Koppel <radoslaw.koppel@nordicsemi.no>
Refactored the fix in the commit 685da02354 ("Bluetooth:
controller: Fix advertising random delay resolution calc")
to apply modulo in tick units before adding a tick.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix bluetooth config dependencies where the definitions depend on other
definitions.
BT_RX_PRIO is not always defined in a controller only build.
BT_CTLR_TX_BUFFER_SIZE does not depend on BT_CTLR, but BT_LL_SW.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Calling bt_recv in the Bluetooth host Tx thread by the
controller implementation caused deadlock in combined host
controller builds when HCI LE Create Connection Cancel
generated the HCI LE Connection Complete or HCI LE Enhanced
Connection Complete events.
Controller's HCI implementation has been updated to place
the generated event into Rx FIFO to avoid the deadlock.
Relates to commit a59f544fb4 ("bluetooth: controller:
Handle non-priority events correctly")
Relates to #10314.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
bt_conn_disconnect removes device from autoconnect list and thus
should not be called from le_conn_update when timeouting pending
connection. Also auto connect flag needs to be check on connection
failure to make sure scan is restarted.
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
In commit d5836195d7 ("Bluetooth: controller: Increase advertising
random delay resolution"), the resolution of random_delay was
increased from 8-bit to 16-bit. Due to this switch the result
of HAL_TICKER_US_TO_TICKS() can now be a 0, which causes the following
crash:
***** Kernel OOPS! *****
Current thread ID = 0x200043f0
Faulting instruction address = 0x17914
Fatal fault in ISR! Spinning...
Let's make sure we don't pass a 0 to ticker_update() by increasing
the result of HAL_TICKER_US_TO_TICKS() by 1.
Signed-off-by: Michael Scott <mike@foundries.io>