Commit graph

22,409 commits

Author SHA1 Message Date
Mark Wang
a713aedb53 bluetooth: a2dp: check the reject response's error code
If the reject response's error codes is success, change as FORMAT ERROR.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2025-10-16 17:16:53 +03:00
Mark Wang
60c7ec6915 bluetooth: a2dp: set req->status as 0
create internal bt_a2dp_init_req and bt_a2dp_init_ctrl_req to init `req`,
then the `req->status` will not be forgotten to be cleared as 0.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2025-10-16 17:16:53 +03:00
Mark Wang
c994c9e02e bluetooth: a2dp set right endpoint state for start and abort cmd
If the start cmd fail, need set back as OPEN state.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2025-10-16 17:16:53 +03:00
Lyle Zhu
40bba4057f Bluetooth: Classic: HFP_HF: Fix AT+CLCC can not be sent issue
Due to the flag `BT_HFP_HF_FLAG_CLCC_PENDING` is set when receiving
the +CIEV or +CIND notification, the command `AT+CLCC` will be
pending due to the flag is not cleared.

Add a flag `BT_HFP_HF_FLAG_INITIATING` to indicate the HF
initialization is ongoing.

Add a flag `BT_HFP_HF_FLAG_QUERY_CALLS` to indicate the current calls
list needs to be queried.

Set the flag `BT_HFP_HF_FLAG_INITIATING` at the beginning of the HF
initialization. Set the flag `BT_HFP_HF_FLAG_QUERY_CALLS` instead of
setting the flag `BT_HFP_HF_FLAG_CLCC_PENDING` if the current calls
list needs to be queried and the flag `BT_HFP_HF_FLAG_INITIATING` is
set.

After the HF initialization is done, query list of the current calls
by calling the function `hf_query_current_calls()` if the flag
`BT_HFP_HF_FLAG_QUERY_CALLS` is set.

Set the flag `BT_HFP_HF_FLAG_CLCC_PENDING` if it is not set in the
function `hf_query_current_calls()`.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-10-16 17:15:51 +03:00
Krzysztof Chruściński
3595c9d0d4 tests: pm: policy_api: Add test for locking all PM states
Add test case that validates behavior of pm_policy_state_all_lock_get
and pm_policy_state_all_lock_put.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2025-10-16 17:15:20 +03:00
Krzysztof Chruściński
336e89efd6 pm: policy: Add option to lock all power states
Add function for getting and putting a lock for all power states.
It is much faster version of requesting 0 us latency with actual
intention to disable all power states.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2025-10-16 17:15:20 +03:00
Jordan Yates
9f1e166abd modem: modem_ppp: optimise frame wrapping
Optimise the PPP frame wrapping process by performing all work inside a
single function into a contiguous buffer, instead of operating on the
ring buffer one byte at a time.

On a nRF54L15 (M33 @ 128 MHz) before the change:
```
Wrapping 1062 byte packet: ~4.1 ms
Wrapping 1355 byte packet: ~5.0 ms
```
After the change:
```
Wrapping 1026 byte packet: ~2.4 ms
Wrapping 1341 byte packet: ~3.1 ms
```

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-10-16 17:15:08 +03:00
Emil Gydesen
572d4d438b Bluetooth: BAP: BA: Improve some logging
Fix additional space in active receive states.
Add additional information when logging duplicate
broadcasts.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-10-16 17:14:20 +03:00
Emil Gydesen
cb9c64947f Bluetooth: CAP: Add missing failed_conn for reception_start
When cap_commander_broadcast_reception_start is called during the
handover, the failed_conn was not correctly.
It is now being set by cap_commander_broadcast_reception_start
and if that is called via handover, it will be correctly set.
If it is called via bt_cap_commander_broadcast_reception_start
then it will be cleared in case of error.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-10-16 17:14:08 +03:00
Cristian Bulacu
a2b554c699 net: l2: openthread: Improve Border Router packet forwarding logic
There are some cases when OpenThread opens a sockets and doesn't choose
as default it's internal interface, this leading to usage of
platform UDP module which will then send back the packet to the
OpenThread interface. In this case, the packet should not be treated as
originated from backbone interface.

Backbone router multicast listener callback functionality is improved.
A route with a prefix length of 128 is set
and a multicast address is added for each listener registration.
OpenThread interface joins that multicast address group.

Enabled forwarding capabilities for Backbone interface.
A border router should be able to perform default packet forwarding for
destination addresses with a multicast scope greater than admin-local.
In order to achieve this, multicast routes have been added to those
addreses. [https://datatracker.ietf.org/doc/rfc7346/]

For Border Router application, `ip6_addr_cb` is not installed.
otIp6SubscribeMulticastAddress call would re-register an IPV6 multicast
address which might have been registered by an OpenThread node using
`ipmadd add` command and even if that node performed `ipmaddr del`,
the address was still present in multicast listener table. This also
led to a missing MLDv2 message with that specific multicast IPV6
address.

Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
2025-10-16 17:10:51 +03:00
Julien Vermillard
9ee47f2856 net: lwm2m: add cache filtering
Introduce `lwm2m_set_cache_filter()` so applications can drop cached
samples before they reach the LwM2M SEND path.

Fixes #91590

Signed-off-by: Julien Vermillard <julien@clunkymachines.com>
2025-10-16 17:10:24 +03:00
Flavio Ceolin
dabe815663 bt: host/classic: Fix possible integer overflow
Invalid header length and cause an integer overflow in
bt_br_acl_recv leading to undesired behavior.

Signed-off-by: Flavio Ceolin <flavio@hubblenetwork.com>
2025-10-15 11:46:13 -04:00
Ludvig Jordet
f998357015 Bluetooth: Mesh: Minor cleanup of prov link close on success
Changes the link close upon success to use the `prov_link_close` helper
function instead of doing it manually, as minor cleanup.

Signed-off-by: Ludvig Jordet <ludvig.jordet@nordicsemi.no>
2025-10-15 11:43:00 -04:00
Ludvig Jordet
1c6f98aaf2 Bluetooth: Mesh: Provisioner closes link on failed
According to MshPrt 5.4.4, The Provisioner, upon receiving the
Provisioning Failed PDU, shall assume that the provisioning failed and
immediately disconnect the provisioning bearer.

Signed-off-by: Ludvig Jordet <ludvig.jordet@nordicsemi.no>
2025-10-15 11:43:00 -04:00
Jordan Yates
e655c0ed1a net: ip: conn_mgr_connectivity usage calls
Add interface usage notifications to the `NET_NATIVE` code paths.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-10-15 15:39:25 +03:00
Jordan Yates
b92a43d7c0 net: conn_mgr_connectivity: idle timeouts
Implement idle timeouts, primarily in the common connectivity library,
with individual interfaces notifying the library when the interface has
been used.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-10-15 15:39:25 +03:00
Jordan Yates
e3a7bb30bd net: conn_mgr_connectivity: idle timeout parameter
Add an interface idle timeout parameter to the connectivity
binding structure. This will be used to track idle timeouts for
interfaces.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-10-15 15:39:25 +03:00
Jordan Yates
65b616f6d8 net: conn_mgr: connectivity: replace !binding
Replace all `!binding` checks with `binding == NULL` for MISRA
compliance.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-10-15 15:39:25 +03:00
Fabian Otto
8d097554dd logging: backend: add KConfig option for SWO sync packets
Add KConfig LOG_BACKEND_SWO_SYNC_PACKET to allow disabling SWO
synchronization packets. Useful if the SWO is used as a UART replacement
to avoid that the sync packets show up as special characters in a terminal
application.

Signed-off-by: Fabian Otto <fabian.otto@rohde-schwarz.com>
2025-10-15 15:39:01 +03:00
Emil Gydesen
0ebe84cc5a Bluetooth: Host: bt_iso_reset before bt_conn_cleanup_all
Move the call to bt_iso_reset to before bt_conn_cleanup_all.
The reason for this is that bt_conn_cleanup_all will disconnect
all the ACL connections, which will put the CIS in a disconnecting
state, without finalizing them.
This means that if we get a num_completed_packet event between
the call to bt_conn_cleanup_all and before the BT_HCI_OP_RESET
request has been completed, we will trigger an assert in the
hci_num_completed_packets function as the CIS still exists,
but where we would already have cleaned up the pending TX
without telling the controller.

Moving the call to bt_iso_reset means that the CIS will have
been fully terminated at this point, which will prevent
the assert from happening. Since CIS depends on ACLs, this
is also the logical order for resetting them.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-10-15 15:37:21 +03:00
Jamie McCrae
1c756cbef5 mgmt: mcumgr: transport: udp: Increase default stack size to 1KiB
Fixes an issue in a board using ethernet that faults with the
default 512 byte size by doubling the default to 1KiB. The actual
size of the thread depends upon the device and application
configuration so needs to be fine tined for each application
anyhow

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-10-15 15:36:53 +03:00
Michael Zimmermann
f2bed4d6af net: mqtt_sn: Add support for publishing with QOS=-1
This doesn't try to optimize memory usage for QOS=-1 publications, because
it's easier to use existing structs and allocators instead of adding new
ones with less fields.

Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
2025-10-15 15:35:58 +03:00
Michael Zimmermann
be0adf76b5 net: mqtt_sn: add support for short topics
The publish and subscribe APIs allocate topics implicitly, but don't
support allocating predefined or short topics. Additionally, we don't want
to force using short topics in case the passed topic is 2 bytes long, in
case the user doesn't want that (e.g. because the server doesn't support
it).

So instead, we add a new API which works similar to
mqtt_sn_predefine_topic, which allows allocating a short topic before using
any of these APIs.

Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
2025-10-15 15:35:58 +03:00
Michael Zimmermann
e82b8cb150 net: mqtt_sn: never clear predefined and short topics
- These are independent from connections since they are always valid.
- Implicitly created topics(e.g. from publish or subscribe) can't be
  deleted either, so that doesn't make things worse compared to those.

Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
2025-10-15 15:35:58 +03:00
Mark Wang
b3d56349a1 bluetooth: shell: a2dp: use static for functions
add static for functions and variables.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
(cherry picked from commit 1282bf7b8d814ef7a217c6f0c424aa4b2f34d363)
2025-10-15 12:06:56 +03:00
Mark Wang
a1cbaf77a6 bluetooth: shell: a2dp: remove unused function
remove app_configured

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
(cherry picked from commit c0be42f10341ea4a6ed1df152375335a5f514c92)
2025-10-15 12:06:56 +03:00
Mark Wang
e468dd3371 bluetooth: avdtp: add copyright
add copyright to avdtp.c

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
(cherry picked from commit 8761b2884726ccc33f953e4679a3d9c86b17da84)
2025-10-15 12:06:56 +03:00
Mark Wang
ef1b4463aa bluetooth: a2dp: remove the digital hardcode
use the sizeof of struct or variable; use macro to do the data shift.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
(cherry picked from commit d6d567355d08cefd1e11d88563fc300928af4972)
2025-10-15 12:06:56 +03:00
Mark Wang
642dc278d1 bluetooth: a2dp: save configuration when cmd success
In the cmd result callback, save the configuration to stream if result is
success.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
(cherry picked from commit 9a9477fa0214f245a66e24a2edd90132293d5086)
2025-10-15 12:06:56 +03:00
Mark Wang
c8763596c9 bluetooth: avdtp: unify the avdtp error code based on Zephyr err code
get the avdtp error code based on Zephyr err code to make the codes more
clear.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
(cherry picked from commit 1d4d97fdb41791501eb63934f096bcc88cb2da81)
2025-10-15 12:06:56 +03:00
Mark Wang
1032b1e567 bluetooth: a2dp: avoid clearing the cmd req
If the previous cmd req is triggered, the cmd fail to trigger again and
keep the previous cmd req.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
(cherry picked from commit f4197d51b62799748a75c97bd0b68778185ff293)
2025-10-15 12:06:56 +03:00
Mark Wang
eb3af0b9a6 bluetooth: a2dp: remove meaningless if
The `a2dp` is got by `req` through CONTAINER_OF, then the if always is
true.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
(cherry picked from commit 24ef59d835c69a30fe8a8e6569405791532d9e0d)
2025-10-15 12:06:56 +03:00
Mark Wang
d5fb16bd31 bluetooth: a2dp: use avdtp struct to fill data to net buf
avdtp defines the data format by struct, use it to fill net buf.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
(cherry picked from commit a89f4eddac6f13f981f2ca0b94f07edaad104afa)
2025-10-15 12:06:56 +03:00
Mark Wang
8e6a853654 bluetooth: avdtp: check buf tail room
check the buf tail room before adding data to buf.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
(cherry picked from commit 65f8a9e03baf899684198e707170ad17817f7ce5)
2025-10-15 12:06:56 +03:00
Mark Wang
0fd58cc20c bluetooth: a2dp: implement get_config
implement get configuration

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
(cherry picked from commit 54cae2e75bcb7ee38ec4d7c24cef8835e3836a05)
2025-10-15 12:06:56 +03:00
Mark Wang
3d81dc086d bluetooth: a2dp: implement delay report
implement delay report

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2025-10-15 12:06:56 +03:00
Lyle Zhu
64a544935b Bluetooth: HFP_AG: Fix SLC connected event early notify issue
In current implementation, the SLC connected event will be early
notified. It causes the SLC state of AG is not aligned with the state
of HF.

The SLC connected event should be notified after the procedure of HF
indicators is done if the HF indicators feature is supported by both
devices.

Do not notify the SLC connected event after the AG has successfully
responded with information about how call hold and multiparty services
are supported if the HF indicators feature is supported by both
devices.

Notify the SLC connected event after the procedure of HF indicators is
done.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-10-15 12:06:22 +03:00
Charles Hardin
7158f33c2b net: dns: extend the service resolver command line for ptr, srv, addr
The address resoution from RFC6763 is generally a PTR, SRV, TXT, and
an A or AAAA. Records, so this change is mainly to start drawing a
clear functional change between the DNS query shell and the DNS
service shell that should be more of a "avahi-browse" or "dns-sd"
functional style.

So, this is not a very robust implementation since it is a chain of
queries when the goal should be to get additional records from the
message itself but those changes can be added iteratively.

Basic point of this change is to show the procedure for the "browse"

- PTR service resolution
- SRV query from the result of the PTR
- AAAA (or A) from the result of the SRV

TXT records are ignored for now but should be added into this as
additional record support is extended.

Signed-off-by: Charles Hardin <ckhardin@gmail.com>
2025-10-15 12:05:14 +03:00
Jérôme Pouiller
505969a09e portability: cmsis: Fix possible race in osEventFlagsSet()
The CMSIS-RTOS specification says "The function returns the event flags
stored in the event control block".

In the original code, osEventFlagsSet() called k_event_post() and then
k_event_test(). It worked mostly fine if the thread has higher priority
than the waiter thread. In the opposite case, the event was not reported
to the user.

With the last changes, the waiter thread use k_event_wait_safe(). So, the
event is posted and consumed in an atomic way. So, the issue above happen
even if the waiter thread has a lower priority then the poster.

This patch fixes the both cases.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
2025-10-14 17:39:51 -04:00
Jérôme Pouiller
316452ca15 portability: cmsis: Fix possible race in osEventFlagsClear()
The CMSIS-RTOS specification says "The function returns the event flags
before clearing".

In the original code, if another thread set an event between k_event_test()
and k_event_clear(), there was a risk the function clear a flag without
reporting it to the caller:

        T1                                   T2
  k_event_test(..) == 0                      ...
        ...                             k_event_post(.. 1)
  k_event_clear(.. 1)                        ...
  return 0 (while event 1 has been cleared)

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
2025-10-14 17:39:51 -04:00
Jérôme Pouiller
fd500168f1 portability: cmsis: Fix possible race in osEventFlagsWait()
In osEventFlagsWait(), if an event raises after the call to k_event_wait()
and before the call to k_event_clear(), we may clear it while it is not
going to be report to the caller.

Reported-by: Rahul Gurram <rahul.gurram@silabs.com>
Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
2025-10-14 17:39:51 -04:00
Anas Nashif
8607714da0 testsuite: split coverage kconfig into own file
Coverage options deserve their own kconfig, otherwise the testsuite
Kconfig will be very crowded and difficult to read.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-10-14 17:32:46 -04:00
Anas Nashif
f22a0afc74 testsuite: coverage: Support semihosting
Use semihosting to collect coverage data instead of dumping data to
serial console.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-10-14 17:32:46 -04:00
Johan Hedberg
3fa1b98c4f Bluetooth: Update TX buffer calculation with auto PHY changes
Make sure to consider both the new peripheral and central Kconfig options
when calculating needed TX buffers.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2025-10-14 18:53:08 +02:00
Johan Hedberg
30b4c3e438 Bluetooth: Host: Add role-specific auto PHY update options
The BT_AUTO_PHY_UPDATE option was problematic in the sense that it didn't
really allow any kind of fine-tuning of what automation is desired. In
particular, it didn't allow specifying which PHY was the preferred one (it
was hardcoded to 2M) and also didn't allow specifying role-specific
(central vs peripheral) preferences.

To solve this, deprecate the old option, and instead introduce
role-specific options that allow specifying 1M/2M/Coded/None as the
preference. The new options have slightly different defaults than the new:
for central role 2M stays as the preference, however since it's uncommon to
require automated changes on the peripheral side the default is set to
None there.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2025-10-14 18:53:08 +02:00
Xiang Liu
8e9fa6a273 bluetooth: remove blocking operation in bt_conn_get_info
bt_conn_get_info API is used to retrieve connection-related
information. However, bt_conn_get_info sends the HCI command
BT_HCI_OP_READ_ENCRYPTION_KEY_SIZE to retrieve current
key_size, causing excessive blocking time.

Signed-off-by: Xiang Liu <liuxiang18@xiaomi.com>
2025-10-14 07:45:01 -04:00
Chaitanya Tata
f6cd5c0e7e net: lib: shell: Add options t display vendor data
Along with key-value pairs, add an option to dump vendor values as a
blob, use can choose either one or both.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2025-10-14 07:44:51 -04:00
Mark Wang
5422e3f21f bluetooth: avdtp: save avdtp session to ep
when ep is configured, the ep is used by the avdtp session, so combine
them together when ep is configured.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2025-10-14 12:53:27 +03:00
Mark Wang
02c5974e04 bluetooth: a2dp: ep->stream is cleared when stream l2cap is released
ep->stream is cleared when stream l2cap is released, it should not be
cleared by close and abort cmd procedure.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2025-10-14 12:53:27 +03:00
Mark Wang
39eaec0513 bluetooth: a2dp: improve the stream l2cap release
When signal l2cap is disconnected, use `release_work` to release the
related stream l2cap connections. When releasing the sep's stream l2cap,
use `delay_work` to check the stream l2cap disconnecting result.
Move the stream l2cap disconnecting callback to sep because the chan is
in sep, then use this callback to indicate the sep stream chan is
released and sep is idle.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2025-10-14 12:53:27 +03:00