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>
Fix the default Tx buffers to 3. While the first Tx-ed
buffer generates the HCI Number of Completed Packets Event,
the controller needs to have 2 additional Tx buffers queued
so that the second Tx PDU has the More Data (MD) bit set so
as to have the connection event to continue to transmit any
additional Tx buffers that the Host will enqueue in the same
connection event.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
1. Command handler can return command exectution status as int.
2. Existing command handlers rework.
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
This splits L2CAP commands under 'bt' to 'l2cap' removing 'l2cap-'
prefix from the commands:
l2cap - Bluetooth L2CAP shell commands
Options:
-h, --help :Show command help.
Subcommands:
connect :<psm>
disconnect :[none]
metrics :<value on, off>
recv :[delay (in miliseconds)
register :<psm> [sec_level]
send :<number of packets>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This splits BR/EDR command under 'bt' to 'br' to reduce the command
list and at same time cleaning the mix between different bearers.
In addition to that also remove "br-" prefix for the commands:
br - Bluetooth BR/EDR shell commands
Options:
-h, --help :Show command help.
Subcommands:
auth-pincode :<pincode>
connect :<address>
discovery :<value: on, off> [length: 1-48] [mode: limited]
iscan :<value: on, off>
l2cap-register :<psm>
oob :
pscan :value: on, off
sdp-find :<HFPAG>
rfcomm-register :<channel>
rfcomm-connect :<channel>
rfcomm-send :<number of packets>
rfcomm-disconnect :[none]
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Increase the resolution of advertising random delay from
1 ms unit to 1 us units. The controller scheduling will
floor it to nearest 32KHz clock unit on nRF5 series.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Auto connect code reuses bt_conn object and connection code was assuming
object was cleared which resulted in invalid code being provided to
application. Fix that by explicitly setting error code to 0 on
successful connection.
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
Depending on perhiperal advertising interval 3 seconds might not be
enough and would result in cancelling pending connection. Make this
Kconfig configurable and let application to decide.
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
Under GNU C, sizeof(void) = 1. This commit merely makes it explicit u8.
Pointer arithmetics over void types is:
* A GNU C extension
* Not supported by Clang
* Illegal across all ISO C standards
See also: https://gcc.gnu.org/onlinedocs/gcc/Pointer-Arith.html
Signed-off-by: Mark Ruvald Pedersen <mped@oticon.com>
Applications may require different scan windows and interval depending
on expected re-connection time or peer devices advertising parameters.
Default to GAP recommended slow values.
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
In order to avoid the build system complications that come from
including a timestamp, remove it by default from the version string in
HCI Vendor Extensions. Users can still include a unique identifier, be
it timestamp or not, using the CONFIG_BT_CTLR_HCI_VS_BUILD_INFO Kconfig
option.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
The Data Length Update implementation reused the flags used
by Encryption Procedure which caused invalid Encryption
Procedure sequence under conditions where Data Length Update
Procedure collide with Encryption Setup initiated by the
peer central device.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
The address of the device is also set via HCI interface when passive
scanning is used. As a result, LL does not filter out directed
advertising packets that are targeted at this device.
Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
This allows to configure desired parameters for peripheral. When set
PPCP characteristic is also added to GAP service. If disabled it is
up to application to controll connection parameters and stack will
only enforce 5 seconds delay before update.
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
This fixes a few issues with the handling of Connection Parameter
update in the Host:
- starting conn param update timer as master
- ignoring 5 seconds slave timer when calling bt_conn_le_param_update
- starting conn param update timer on every PHY update
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
There is an unnamed choice for the BT link layer selection.
Giving the choice a name would allow multiple declarations of the
option and the ability to select out-of-tree LL's.
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
So far the stack hasn't provided any way for the application to access
the existing bonds. This patch adds such an API.
Fixes#10122
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This uses net_buf_append_bytes to reassemble the SDU segments instead of
doing it manually.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
If the remote stack is not able to fully utilize each segment it is
possible it would run out of credits before completing the SDU, these
changes detects if that would happen and attempt to restore enough
credits for the SDU to be received.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This simplify the logic of restoring the credits after each SDU instead
of using an arbitrary threshold which was not configurable per channel.
Because the credits are restored only when the full SDU has been
reassembled it means the channels needs to be set up with enough for
the configured MTU otherwise there is a risk of the channel to run out
of RX credits before the packet is fully reassembled, because of such
corner case the code will now warn if a channel is setup with not enough
init_credits.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This adds a int return to recv callback which can be used to notify the
stack about errors when receiving a packet. In addition to that the user
can return -EINPROGRESS to inform the stack the data will be processed
asynchronously which can be complete by calling
bt_l2cap_chan_recv_complete.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
When activating SystemView internal kernel header files will be
included. This causes a name conflict with smp_init in smp.c
and smp_init in kernel_internal.h
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This fix ensures that the handle range used for next GATT discovery is
always inclusive. Previously, the discovery procedure could not be
started with equal value of start and end handle.
Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
This allows to provide public address for controller without using
VS HCI command from host. Useful for controller only builds or
combined builds that are not using VS HCI commands.
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
The current method relies heavily on the linker/compiler to
do the correct operation. Which is to eliminate the code that will
never get called. This posses a problem if the build even changes
by a smallest fraction.
The current patch will enforce proper inclusion of the code at the
pre-processing stage. Thereby not relying on the compiler/linker to
do the right thing.
Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
New shell implementation is on the way. For now old one and all
references are kept to be gradually replaced by new shell.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Add a new command in the shell which can be used to set the channel
map by specifying a 37 bit bitmask written as a five byte hex array.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Add functionality for setting the host channel classification in
the controller using the HCI command.
This closes issue #9851
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
When running combined build on nRF5 with disabled VS command it is
possible to simply read static random address from FICR in host.
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>