Implement mode change event handling and callback notification for
BR/EDR power mode transitions. Adds br_mode_changed callback to
notify applications when connection switches between active and
sniff modes. Handles HCI mode change events and propagates mode
and interval information to registered callbacks.
Signed-off-by: Kai Cheng <chengkai@xiaomi.com>
Implement BR/EDR power mode control with sniff mode functionality.
Adds APIs bt_conn_br_enter_sniff_mode() and bt_conn_br_exit_sniff_mode()
to manage power saving modes. Includes parameter validation and HCI
command handling for sniff mode configuration with min/max intervals,
attempt count, and timeout parameters.
Signed-off-by: Kai Cheng <chengkai@xiaomi.com>
Adjust the way the SKIP option worked. Before this patch, a constant
priority offset was considered "high priority" this had the effect, that
the threads assigned to work on the priority were effectively usesless.
To fix it, consider this immediate handling as a pseudo-queue and compute
the tc-thead-mapping based on the effective count (+1 if skipping is
enabled). This makes it so that all threads are usefull and the
high-priority skip-path is considered as a pseudo tc-thread.
Signed-off-by: Cla Mattia Galliard <clamattia@gmail.com>
This commit refactored IPV6 and IPV4 address events. Events have been
defined independently for each installed callback.
Previously, IPV6 address event was not triggered due to a mix of IPV4
and IPV6 flags.
Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
DIRECT_XIP requires different images based on
the slot where there it is saved, in hawkbit we
currently have no way of telling the server that or
chosing a image to download based on it, so
make sure it is not used.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
Updates the bt shell API to use the new Kconfig option
BT_APP_PASSKEY instead of BT_FIXED_PASSKEY as this is being
deprecated.
Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
The BT_FIXED_PASSKEY Kconfig option is being deprecated, and is replaced
by BT_APP_PASSKEY. The reason for the deprecation is an upcoming
errata, ES-24489, which mandates that a new passkey shall be generated
for each pairing procedure.
Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
Adds the BT_APP_PASSKEY Kconfig, which allows the application to provide
passkeys for pairing using the new `app_passkey()` callback.
This is an alternative to BT_FIXED_PASSKEY, which will be deprecated in
a later commit.
Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
Split the subgroup validation from
bt_bap_base_get_base_from_ad into a new function
base_pull_subgroup to make the function simpler and
make Sonarcloud happy.
The new function, base_pull_subgroup, is also used
in the bt_bap_base_foreach_subgroup to reduce
code duplication.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The long-term goal of Zephyr is to rely exclusively on PSA Crypto API for
crypto support. At the same time Mbed TLS is going to remove legacy crypto
support starting from the next relase (v4.0).
Therefore this commit removes usage of legacy Mbed TLS crypto in favor
of PSA Crypto API. Mbed TLS will still be used in case of a build where
TF-M is not enabled.
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
There's a bunch of convenience macros in sys/util.h that are intended to
help out with translating array indices and determining if an element is
part of an array or not. Use those instead of custom code.
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
Add support for 64-bit devmem operations for 64-bit devices.
Signed-off-by: Sergii Vystoropskyi <vistorop@meta.com>
Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
Move cpu_load to lib/os, as this functionality on its own does not
justify being a subsystem on its own.
Fixes#95498
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Adds support for the USB device binding for MCTP. Binding created based on
the DMTF specification for USB Transport Binding. The overall design of
this binding follows the existing UART and I2C+GPIO bindings that already
exist in Zephyr.
Signed-off-by: Eric Ocasio <eric.ocasio@nxp.com>
Explicitly cast down the string width to int, as otherwise it is
size_t which may have a bigger size.
Avoids the following build error:
subsys/net/lib/shell/dns.c:496:67: error: field precision specifier
‘.*’ expects argument of type ‘int’, but argument 4 has type ‘size_t’
{aka ‘long unsigned int’}
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Allow to spread tc threads by more then one priority level and cleanup the
computation of the priority.
Signed-off-by: Cla Mattia Galliard <clamattia@gmail.com>
To enable quality-of-service (QoS) applications, allow filters to modify
the priority of an incoming packet. This allows that processing can be
done on tc-queue-threads with different priorities.
Signed-off-by: Cla Mattia Galliard <clamattia@gmail.com>
Current implementation forces confirmation of current boot image and
second slot erase at hawkbit_init() and it is impossible to communicate
with hawkBit server without running it. This makes impossible to notify
update failures to server (#71750)
Add option HAWKBIT_CONFIRM_IMG_ON_INIT to allow disabling the auto image
confirmation and HAWKBIT_ERASE_SECOND_SLOT_ON_CONFIRM to select if the
second partition slot shall be erased or not.
Disable those to handle of these behaviors on application code.
Signed-off-by: Matheus Marques <code@matheusmbar.com>
Make sure that the CONFIG_NET_SOCKETS_TLS_MAX_CONTEXTS will
reflect the number of required file descriptors in the system.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The number of net_context now determines the minimum amount
of network sockets that are to be allocated.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Instead of user trying to figure out what is the amount of file /
socket descriptors in the system, let the various subsystems etc.
specify their need using a Kconfig option. The build system will
then add these smaller values together and set a suitable file
descriptor count in the system.
This works the same way as the heap size calculation introduced
in commit 3fbf12487c
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The current calls list should not be queried if the SLC is not
connected. Or the error `-ENOTCONN` will be returned by function
`hf_query_current_calls()`.
Check the connection status of HF before submitting a delay-able
worker. Only the SLC is established, submit the delay-able worker.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Add the command `query_calls` to query the current calls list.
The received current calls list will be printed in callback
`hf_query_call()`.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Add the function `bt_hfp_hf_query_list_of_current_calls()` to support
users to query current call list.
Add the callback `bt_hfp_hf_cb::query_call` to notify the received
current calls.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
This commit adds functionality to filter out duplicate entries in the
Bridged Subnets List message.
This is done by iterating through the part of the table we have already
processed, to check if this is the first time we see a given key pair or
not.
Signed-off-by: Ludvig Jordet <ludvig.jordet@nordicsemi.no>
Do not register the device when the class instance has already been
initialised. Fail on initialization if no HID device is registered.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Implement Modem Status Command(MSC) and a per DLC flow
control by using it.
Send flow control signals when our input buffer don't fit
full frame anymore.
Stop TX if we have received from controls on MSC.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
So far the TLS/DTLS credentials would only be validated upon first use,
i. e. when TLS/DTLS handshake was initiated. This could lead to some
confusion, especially when trying to understand the reason of the
handshake failure, as it wasn't clear whether the handshake failed due
to peer sending bad certificate or due to local configuration issues.
This commit attempts to improve this, by pre-validating the credentials
as soon as they are configured on a socket with TLS_SEC_TAG_LIST socket
option. That way, in case bad credentials are configured on a socket, or
more commonly, mbed TLS is misconfigured to handle certain credential
type, it will be caught early during socket configuration, instead of
during the handshake.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Following the removal of legacy crypto support the code could be further
simplified so this commit accomplish to this part.
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
The long-term Zephyr's goal is rely only on PSA Crypto API for crypto
support in Zephyr and at the same time Mbed TLS will remove this support
from the next release.
Therefore this commit removes usage of legacy crypto hash support from
updatehub.
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
A previous commit (84163d3) changed the RTT backend from outputting a
binary stream to a hex encoded stream when dictionary logging is
enabled.
This commit adds a Kconfig option to keep the binary format, which is
required for live_log_parser.py, and also for log_parser.py when the
--hex argument is not used.
Signed-off-by: Jesper Puge Nielsen <jpni@demant.com>
Fix the transmit timestamp value sent in SNTP queries:
* Use sys clock as a time source instead of the uptime,
* As NTP epoch is different from Unix epoch (starts in 1900), adjust
the seconds value with appropriate offset,
* Finally, adjust the fraction calculation to the nanoseconds value
from struct timespec. Do the math in 64-bit to avoid overflows and do
the division at the end for more accurate results.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The MTU of HFP HF or AG is fixed value. It cannot be configured.
Fix the issue to make the MTU of RFCOMM is consistency with the MTU
of L2CAP.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
If we immediately send disconnected event when CLD is received,
we might close the UART pipe before the response is actually send.
Also, shutdown_handler should not retry indefinitely.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
When bt_l2cap_send_pdu() succeeds, it transfers buffer ownership to the
stack, which must eventually invoke the provided callback. This contract
is honored in all paths where transmission becomes impossible:
- Normal transmission: callback invoked with err=0 after HCI Number of
Completed Packets event (tx_notify_process)
- Send errors (after tx allocated): callback invoked with err=-ESHUTDOWN
via conn_tx_destroy
- Send errors (before tx allocated): callback invoked with the specific
error code in send_buf error_return path
- Connection disconnect: callbacks invoked with err=-ESHUTDOWN via
process_unack_tx -> conn_tx_destroy for all PDUs in tx_pending
However, when a channel is deleted (l2cap_chan_del), PDUs remaining in
the tx_queue are dropped without invoking their callbacks, violating the
ownership contract.
Fix this by extracting and invoking any non-NULL callbacks from the
closure stored in buf->user_data before releasing the buffers. The
callback is invoked with err=-ESHUTDOWN, making this path analogous to
process_unack_tx: both drain queues of unsent PDUs when transmission
becomes impossible due to external events (channel deletion vs connection
disconnect). The only difference is the buffer lifecycle stage - in
l2cap_chan_del, PDUs are still in tx_queue (closure in buf->user_data),
while in process_unack_tx, they've progressed to tx_pending (callback in
bt_conn_tx struct).
Note: conn_tx_destroy() cannot be used here because no bt_conn_tx struct
has been allocated yet - the closure is still in buf->user_data.
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
Document the ownership contract and callback semantics for L2CAP
transmission buffers:
- Extend tx_queue documentation in bt_l2cap_le_chan to explain SDU/PDU
storage, callback handling, and transmission order semantics
- Document bt_l2cap_create_frag responsibilities regarding callback
invocation after HCI Number of Completed Packets or on disconnect
- Document bt_l2cap_send_pdu callback contract: invoked exactly once
after transmission completes or with -ESHUTDOWN on disconnect
These documentation additions clarify the requirements for proper
buffer lifecycle management and callback invocation throughout the
L2CAP transmission path.
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
fix(coap_link_format): Correct parameter constness in func signature
For function coap_link_format:coap_well_known_core_get_len()
the request parameter is declared to be a pointer-to-const,
but the const is missing for one of the two function definitions,
that are chosen via CONFIG_COAP_WELL_KNOWN_BLOCK_WISE.
With this fix the code also compiles when enabling
CONFIG_COAP_WELL_KNOWN_BLOCK_WISE.
Signed-off-by: Felix Kolbe <felix.kolbe@gmail.com>
The long-term goal of the Zephyr project is to rely exclusively on PSA
Crypto API for the crypto support. In parallel Mbed TLS is going to remove
legacy crypto support from the next (4.0) release.
Therefore this commit deprecates CONFIG_FLASH_AREA_CHECK_INTEGRITY_MBEDTLS
and it also updates the migration guide document about this change.
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
For devices that need an erase before a write, ZMS do not verify that
the next available location in the open sector is filled with the
erase_value.
Fix this by adding a check at init.
Signed-off-by: Riadh Ghaddab <rghaddab@baylibre.com>