Commit graph

22,555 commits

Author SHA1 Message Date
Pavel Vasilyev
6f3248b34f bluetooth: host: id: Print identity handle upon collision detection
To improve clarity, print identity handle upon collision detection.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2025-08-14 15:49:09 +02:00
Nirav Agrawal
27e4533038 bluetooth: tbs: fix issues for setting URI scheme for GTBS
- "bt_tbs_set_uri_scheme_list()" function does not setting URI for
 GTBS instance. Using "inst_lookup_index()" fixes issue to find
 registered GTBS instance for provided bearer_index.
- "bt_tbs_set_uri_scheme_list()" function overrides URI scheme list
 with latest provided list. But the expectation is that it should
 keep previously added URI schemes and only update new scheme which
 are not part existing list. Code is updated to fix this.
- The same function uses net-buf to combine all URI schems for all
 TBS bearer if current request is not for GTBS instance. Currently,
 the code only uses combined URI scheme list for logging purpose and
 it is not used to send for URI Scheme notification to provide
 updated GTBS URI scheme to remote. Code is now updated to add
 dynamic buffer to add all TBS URI scheme list for GTBS instance
 and notify it similar to other functions to optimise memory usage.

Signed-off-by: Nirav Agrawal <nirav.agrawal@nxp.com>
2025-08-14 15:48:50 +02:00
Emil Gydesen
82a83cd3fc Bluetooth: BAP: BA: Fix sonarcloud issue with assignment and ++
Sonarcloud does not allow to use the result of a incremental
(++) as an assignment.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-08-14 15:48:42 +02:00
Emil Gydesen
65550f5ff4 Bluetooth: BAP: BA: Add log and return on invalid UUID
If the chrc->uuid is somehow an invalid UUID, we log it and
terminate the discovery procedure.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-08-14 15:48:42 +02:00
Emil Gydesen
ebf206cd08 Bluetooth: TBS: Fix TBS API accessing NULL inst
Some TBS API functions attempted to take the mutex
of an instance before the NULL check.

Reorder the checks of the functions, and also modify function
to be more similar (using the same terms and structure).

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-08-14 15:48:01 +02:00
Lyle Zhu
0af3fd6faa Bluetooth: Classic: RFCOMM: Remove TX thread from DLC
There are two main issues found with using DLC TX thread,
Issue 1, the RAM consumption. Every DLC will have a dedicated thread
and thread stack.
Issue 2, the thread stack overflow issue. There is no way to strike a
balance between stack size and RAM consumption. Since the deep of call
stack is depended on the upper layer, the thread stack needs to set by
application. Due to the thread stack of DLC is dedicated, RAM
consumption is the product of the added value and the number of DLCs.

Use a TX worker to replace DLC TX thread.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-08-14 10:40:38 +03:00
Adam Wojasinski
8fb7f8a19d net: lib: ptp: Fix PTP_UDP_IPv6_PROTOCOL compilation error
When the `PTP_UDP_IPv6_PROTOCOL` configuration is enabled
the `mcast_addr` variable is defined as an IPv6 structure, which
doesn't have `s_addr` member.

To not introduce preprocessor guarded code blocks in functions
added union to represent both configurations: IPv4 and IPv6.

Fixes: #92975

Signed-off-by: Adam Wojasinski <awojasinski@baylibre.com>
2025-08-14 10:40:16 +03:00
Lyle Zhu
3a46e25582 Bluetooth: Classic: Shell: Add connectionless command set
Add connectionless shell commands, `register`, `unregister`, and
`send`.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-08-14 10:39:54 +03:00
Lyle Zhu
0b3f572d85 Bluetooth: Classic: L2CAP: Add connectionless data reception feature
Add a Kconfig `BT_L2CAP_CONNLESS` to enable the feature.

Add an API `bt_l2cap_br_connless_register()` to register the monitor
to receive the unicast connectionless data.

Add an API `bt_l2cap_br_connless_unregister()` to unregister the
registered callbacks.

Add an API `bt_l2cap_br_connless_send()` to send unicast
connectionless data.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-08-14 10:39:54 +03:00
WenBin Zhang
d28602adaf tracing: systemview: Add isr name for Segger-sysview
With symtab enabled, the isr name is collected by symbol table

Signed-off-by: WenBin Zhang <freey7955@gmail.com>
2025-08-13 22:12:01 -04:00
Yangbo Lu
0e1b918066 net: dsa: support tag protocol setup
Supported tag protocol setup.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-08-13 22:09:50 -04:00
Yangbo Lu
28d0198ef1 net: dsa: add NXP NETC tag protocol driver
Added NXP NETC tag protocol driver.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-08-13 22:09:50 -04:00
Yangbo Lu
560249bcbc net: dsa: move DSA core options to subsystem
Moved DSA core options to subsystem.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2025-08-13 22:09:50 -04:00
Jordan Yates
19134fc53f net: lib: tls_credentials: fix unregistered log module
A logging module named `tls_credentials` was being declared, but no
other source module was creating and registering it. Do the registration
in the file to fix the compiler error.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-08-13 22:08:46 -04:00
Dmitrii Sharshakov
6e2001ba90 Bluetooth: isoal: fix building with verbose logging
Fixes d414cab87a (likely a missed rename)

Signed-off-by: Dmitrii Sharshakov <d3dx12.xx@gmail.com>
2025-08-13 11:08:48 +01:00
Tomasz Bursztyka
60e5a5622b shell: Improve device list command with an optional filter
It might come in handy to filter the output of a device list
command, by adding a filter (auto-completion enabled as well).

Such as:
$ device list uart
devices:
- uart@2f8 (READY)
  DT node labels: uart1
- uart@3f8 (READY)
  DT node labels: uart0

Signed-off-by: Tomasz Bursztyka <tobu@bang-olufsen.dk>
Co-authored-by: Dimitris Karnikis <dika@bang-olufsen.dk>
Co-authored-by: Hans Binderup <habi@bang-olufsen.dk>
2025-08-13 11:08:07 +01:00
Tomasz Bursztyka
1cb1a2777e shell: Add an init command to device module
Optional, this command can be helpful to debug device initialization
process.

Signed-off-by: Tomasz Bursztyka <tobu@bang-olufsen.dk>
2025-08-13 11:08:07 +01:00
Tomasz Bursztyka
c30cbe39b4 shell: utils: Add non-ready device handling functions
It might come in handy to access non-initialized devices throuhg the
shell. I.e. devices which 'zephyr,deferred-init' DTS attribute was set.

Signed-off-by: Tomasz Bursztyka <tobu@bang-olufsen.dk>
2025-08-13 11:08:07 +01:00
Tomasz Bursztyka
eb85374e2a shell: Fix device name lookup buffer size
It is actually easy to have device name going beyond 20 characters.
There is a maximum defined internally, better using it.

Signed-off-by: Tomasz Bursztyka <tobu@bang-olufsen.dk>
2025-08-13 11:08:07 +01:00
Johan Hedberg
381ec33879 Bluetooth: Controlller: Remove deprecated BT_CTLR Kconfig option
This option was deprecated in Zephyr 4.1.0, so it can be removed for Zephyr
4.3.0.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2025-08-12 18:40:20 -04:00
Jeppe Odgaard
7c796c417e shell: mqtt: add configurable delays
Allow changing delays via Kconfig values.

Use identical delay (`SHELL_MQTT_WORK_DELAY_MS`) for connect, subscribe and
process work instead of varying 1 or 2 second delay.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2025-08-12 21:31:35 +02:00
Emil Gydesen
965bcd6312 Bluetooth: CAP: Implement unicast to broadcast handover
Implement the unicast to broadcast handover procedure,
as per the Bluetooth CAP specificiation.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-08-12 12:35:57 +02:00
Muzaffar Ahmed
445e993491 net: l2: wifi: Fix get RTS threshold in Wi-Fi shell
Changed the number of mandatory options of `rts threshold` to 1, so as
to allow no arguments for querying.

Signed-off-by: Muzaffar Ahmed <muzaffar.ahmed@silabs.com>
2025-08-12 12:35:22 +02:00
Jamie McCrae
637082efb0 lorawan: Imply soft-se instead of selecting it
This allows the software secure enclave to be changed to a
different implementation, which currently is not possible

Signed-off-by: Jamie McCrae <spam@helper3000.net>
2025-08-12 09:56:06 +03:00
Andrey Dodonov
98db4d975c net: lib: http_server: prevent busfault if socket family is AF_UNSPEC
If webserver uses custom socket creation,
and it's family is AF_UNSPEC, net_sprint_addr will return NULL,
which leads to LOG_DBG crashing with busfault.
Add NULL check for that.

Signed-off-by: Andrey Dodonov <Andrey.Dodonov@endress.com>
2025-08-11 15:57:35 -04:00
Robert Lubos
09cbd286c5 net: connection: Use NET_CONN_*_PORT_SPEC flag when comparing ports
The NET_CONN_LOCAL/REMOTE_PORT_SPEC flags were set on the connection but
not really used. At the same time, when remote address was being
cleared, only the flag was unset, but the actual port number left
intact. This could lead to false port comparisons when remote address
was cleared from the connection context.

In order to avoid that, use the NET_CONN_*_PORT_SPEC flags to determine
whether to compare local/remote ports instead of checking the port value
right away (which may not be valid anymore if the flag is unset).

Also align with MISRA rules when comparing flags in other cases.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-08-11 13:23:42 -05:00
Robert Lubos
841035a2d6 net: connection: Fix mixed up comments
Local/remote address port comments were mixed up in the flags
documentation.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-08-11 13:23:42 -05:00
Robert Lubos
271e0c54ed net: context: Reset peer address on connect with AF_UNSPEC
As per POSIX, for non-connection-mode sockets the peer address should be
reset if AF_UNSPEC family type is provided to the connect() call:

  "If the sa_family member of address is AF_UNSPEC, the socket's peer
   address shall be reset.""

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-08-11 13:23:42 -05:00
Chris Friedt
ef7c4dc3aa net: lib: ocpp: use sys_clock_gettime() instead of gettimeofday()
Use the native zephyr sys_clock_gettime() call instead of the XSI
gettimeofday(), since XSI is not required here and would normally
require CONFIG_XSI_SINGLE_PROCESS to be selected.

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2025-08-11 13:21:11 -05:00
Chris Friedt
e197c312cc net: lib: ocpp: select Kconfig for reentrant function gmtime_r()
Select CONFIG_POSIX_C_LANG_SUPPORT_R for the reentrant version of
gmtime(), gmtime_r().

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2025-08-11 13:21:11 -05:00
Jamie McCrae
c58ae17389 mgmt: mcumgr: grp: img_mgmt: Show firmware loader slot info
Allows returning image information for the firmware loader image
slot, showing version of the application and flags

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-08-11 13:18:20 -05:00
Daniel Flodin
a4b66f9214 cmake: assembler optimization options
Commit f499ea0 made it so that the compiler optimization flags are also
passed to the assembler. However, this breaks for the IAR toolchain
since it uses the GNU assembler which does not have the same
optimization flags as the IAR compiler.

This commit separates the compiler and assembler optimizations to make
it possible to specify appropriate flags in a toolchains corresponding
`compiler_flags.cmake`

Signed-off-by: Daniel Flodin <daniel.flodin@iar.com>
2025-08-11 12:49:21 +03:00
Alex Fabre
bfd2ac78ad shell: add app version command
This commit brings a shell command to retreive the following application
version information:

- APP_VERSION_STRING
- APP_VERSION_EXTENDED_STRING
- APP_BUILD_VERSION

Signed-off-by: Alex Fabre <alex.fabre@rtone.fr>
2025-08-09 20:27:30 -04:00
Chris Friedt
62f62dbb0b bluetooth: classic: shell: mitigate label followed by declaration
A recent change triggered a warning in LLVM that was promoted to error
when run with twister.

```shell
goep.c:102:3: error: label followed by a declaration is a C23 extension
  [-Werror,-Wc23-extensions]
  102 |                 int err;
```

Add a scope to the switch case so that the declaration has proper scope.

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2025-08-09 12:39:05 +03:00
Radosław Koppel
c62bd3a88e Bluetooth: Remove _node field of bt_conn_cb if not used
After the #93703 PR was merged we get a possibility to remove _node field
from bt_conn_cb struct if the BT_CONN_DYNAMIC_CALLBACKS option is disabled.
The list conn_cbs can also be safely removed by more macro usage.

Signed-off-by: Radosław Koppel <r.koppel@k-el.com>
2025-08-09 03:39:52 -04:00
Sam Friedman
a9dc9395a4 Bluetooth: Controller: Allow default to maximum DLE value
CONFIG_BT_CTLR_DATA_LENGTH_MAX should set its default value up to
and including the maximum value supported by the Bluetooth spec
(251 bytes).

Signed-off-by: Sam Friedman <sam@golioth.io>
2025-08-09 03:39:42 -04:00
Lyle Zhu
34bd7dc6b8 Bluetooth: GOEP: Support the empty Name header case
According to the OBEX Version 1.5, the Name header could be a empty
string.

Update function `bt_obex_add_header_name` to support the case that the
length of name could be 0.

Update function `bt_obex_get_header_name` to support the case that the
name header is found but the name length is 0.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-08-08 10:43:07 -05:00
Lyle Zhu
5d5add259e test: shell: GOEP: Optimize TLV-triplet setting
Add a TLV array `tlvs` to keep the pending TLV data.

Update `app_param`, `auth_challenge`, and `auth_rsp` to set the one
TLV information each time. When the optional argument `last` set,
write the all pending TLVs to the tx buffer.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-08-08 10:43:07 -05:00
Lyle Zhu
c418d21793 Bluetooth: GOEP: Improve TLV triplet encoding and parsing
Add a structure `struct bt_obex_tlv` to pass/save the one TLV info.

Use a array of `struct bt_obex_tlv` as the set of all TLV-triplets.
Update the following functions to  support the feature, including
`bt_obex_add_header_app_param`, `bt_obex_add_header_auth_challenge`,
and `bt_obex_add_header_auth_rsp`.

Add a function `bt_obex_tlv_parse` to parse the encoded TLV-triplets.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-08-08 10:43:07 -05:00
Lyle Zhu
0dfae64699 Bluetooth: OBEX: Check if the added string is valid
There are types of string can be added by using OBEX adding header
function bt_obex_add_header_*(). One is byte sequence. Another is null
terminated Unicode text.

Add a function bt_obex_string_is_valid() to check if the added string
is valid. And add a function bt_obex_unicode_is_valid() dedicated to
check Unicode string.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-08-08 10:43:07 -05:00
Lyle Zhu
ccad303d50 Bluetooth: shell: Add OBEX commands for GOEP
Add commands for GOEP to test OBEX features.

Add command `alloc-buf` and `release-buf` to allocate and release TX
buffer.

Add command set `add-header` to add the OBEX headers to allocated TX
buffer.

Add command set `client` to send OBEX client requests with allocated
TX buffer.

Add command set `server` to send OBEX responses with allocated TX
buffer.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-08-08 10:43:07 -05:00
Lyle Zhu
8d1b3e9111 Bluetooth: shell: Add transport commands for GOEP
Add commands for GOEP to test transport features.

Add commands for transport over RFCOMM, including `register-rfcomm`,
`connect-rfcomm`, and `disconnect-rfcomm`.

Add commands for transport over L2CAP, including `register-l2cap`,
`connect-l2cap`, and `disconnect-l2cap`.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-08-08 10:43:07 -05:00
Lyle Zhu
bfd42f5c80 Bluetooth: GOEP: Improve the MTU configuration
The MTU of the GOEP should be not less than 255. So, if the transport
is RFCOMM, the CONFIG_BT_BUF_ACL_RX_SIZE should be not less than 264.
It includes,
- 255 bytes for the minimum MTU of GOEP,
- 4 bytes for L2CAP Header,
- 5 bytes for RFCOMM header and FCS.

And if the transport is L2CAP, the CONFIG_BT_BUF_ACL_RX_SIZE should
be not less than 259.
It includes,
- 255 bytes for the minimum MTU of GOEP,
- 4 bytes for L2CAP Header.

Add Kconfig `BT_GOEP_RFCOMM_MTU` to configure the maximum size for
RFCOMM transport. The range of `BT_GOEP_RFCOMM_MTU` is
`[264, BT_RFCOMM_L2CAP_MTU]`. And the GOEP MTU via RFCOMM transport
should be in the range `[255, (BT_GOEP_RFCOMM_MTU-9)]`.

Add Kconfig `BT_GOEP_L2CAP_MTU` to configure the maximum size for
L2CAP transport. The range of `BT_GOEP_L2CAP_MTU` is
`[259, BT_BUF_ACL_RX_SIZE]`. And the GOEP MTU via L2CAP transport
should be in the range `[255, (BT_GOEP_L2CAP_MTU-4)]`.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-08-08 10:43:07 -05:00
Lyle Zhu
3d91b89ed0 Bluetooth: GOEP: Enable GOEP feature
Add a Kconfig BT_GOEP to control the GOEP feature.

Implement the GOEP protocol and transport, both for GOEP 1.1 and GOEP
2.x.

For GOEP transport, OBEX over RFCOMM, and OBEX over L2CAP are
supported.

For GOEP protocol, `put`, `get`, `abort`, `setpath`, and `action` are
supported. And only one operation can be processed at the same time.
The feature `Reliable Session` is unsupported.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-08-08 10:43:07 -05:00
Håvard Reierstad
f231c5f070 Bluetooth: Host: Add req/rsp l2cap validation
L2CAP channels will now, along with the ident, store the opcode of the
pending request. This commit expands the ident lookup function to also
compare received response types to this opcode, and will ignore
unsolicited responses.

Setting of idents for channels are moved after verification of buffer
allocation for the request to be sent. A TODO is added for improving
this functionality at a later time.

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2025-08-08 11:53:43 +03:00
Chaitanya Tata
9dda88fcbd net: ip: Use rate limited version
As this is the hot data path, use a rate limited warning variant.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2025-08-08 11:52:54 +03:00
Chaitanya Tata
f3511602c0 logging: Add ratelimited variants
These are helpful for logging in data-path, not to overwhelm the
console but still keep the user informed about the issues.

This is similar to printk_ratelimited in Linux kernel.

Add only basic build tests for now.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2025-08-08 11:52:54 +03:00
Tyler Joseph Huffman
e57dd8e12d Bluetooth: Controller: Adds path loss monitoring functionality
This functionality is implemented in the HCI-facing side of the
controller and the ULL. LLL functionality is not implemented in this
commit.

Furthermore, this removes a dependency for LE Power Control, as the
features are related, but not necessarily required.

Signed-off-by: Tyler Joseph Huffman <tyhu@demant.com>
2025-08-08 11:52:03 +03:00
Alberto Escolar Piedras
dece77924f net: ocpp: Fix multiple issues detected by clang
Fix multiple warnings detected by clang:
* implicit conversions back and forth from enumeration type
  'enum ocpp_notify_reason' to 'enum ocpp_pdu_msg'
  in ocpp_internal_handler()
* label followed by a declarations
* variable declared after one switch case and used in another
* mapping a int to uint and later using it in < 0 comparisons
  and with negative values

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-08-07 16:20:41 +02:00
Jaro Van Landschoot
1a23d459bc modbus: serial: Divide by zero check
Check if the baudrate is not 0 before dividing by it
to get the rtu_timeout.

Signed-off-by: Jaro Van Landschoot <jaro.vanlandschoot@basalte.be>
2025-08-07 13:15:55 +02:00