Commit graph

21541 commits

Author SHA1 Message Date
Lyle Zhu
63dbc4c7f9 Bluetooth: Classic: L2CAP: Support zero-length SDU in none basic mode
Support zero-length SDU sending if the L2CAP channel connection is not
in basic mode.

Flag the zero-length SDU buffer and clear it if it has been processed.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-06-10 12:25:55 +02:00
Arunmani Alagarsamy
0faba15717 net: l2: wifi: Fix mode change issue in Wi-Fi shell
The help message for the wifi mode -s command indicates it sets
the Wi-Fi mode to station. However, the Zephyr Wi-Fi shell subsystem
was incorrectly using a get operation instead of set.

This commit corrects the behavior to properly set the Wi-Fi mode,
aligning the implementation with the help message.

Signed-off-by: Arunmani Alagarsamy <arunmani.a@silabs.com>
2025-06-10 08:51:15 +02:00
Qiankun Li
f31a411770 drivers: wifi: nxp: Modify shim driver to support btwt changes.
Align struct wlan_btwt_config_t in shim driver
with nxp wifi driver.

Signed-off-by: Qiankun Li <qiankun.li@nxp.com>
2025-06-10 08:47:25 +02:00
Qiankun Li
448b787c82 net: l2: wifi: Modify btwt_setup usage.
Soft ap supports WIFI_BTWT_AGREEMENT_MAX BTWT sessions.
The BTWT parameters for each session can be different.

The current usage can only set one set of parameters.
All sessions follow this set of parameters.

Add enhance code to support setting different
BTWT parameters for every sessions.

Usage:
wifi twt btwt_setup <sta_wait> <offset>
<twtli> <session_num>
<id0> <mantissa0> <exponent0> <nominal_wake0>
<id1> <mantissa1> <exponent1> <nominal_wake1>
<idx> <mantissax> <exponentx> <nominal_wakex>
The total number of '0, 1, ..., x' is session_num

For example:
wifi twt btwt_setup 0 0 0 2 0 112 10 128 1 32 10 64

Signed-off-by: Qiankun Li <qiankun.li@nxp.com>
2025-06-10 08:47:25 +02:00
Joel Holdsworth
08d496b5f5 usb: device_next: Disassociate USB contexts from classes
The usbd_class_remove_all removes all registered classes from a
configuration. However, it previously left the uds_ctx back-pointer to the
usdb_context set, meaning that if the class is re-registered with the
usbd_register_class function, this fails with the error message "Class
registered to other context at different speed" due to uds_ctx being set to
another context.

This patch corrects the issue by clearing udc_ctx after usbd_class_shutdown
has been called.

Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
2025-06-09 15:02:55 -07:00
Aleksandr Khromykh
2411238196 bluetooth: mesh: clarify mesh dfu fwid max length
Commit changes BT_MESH_DFU_FWID_MAXLEN option to be
compliant with BLE Mesh specification.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2025-06-05 15:14:35 -05:00
Jordan Yates
3a595f2859 sd: fix incorrect error logging
Fix logging `Could not disable card power via SDHC` when the attempted
operation is turning power on. Update several other logging strings to
minimise the number of unique strings required.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-06-05 15:02:15 -05:00
Alex Ivanov
5a9394a1e0 llext: add dynamic heap allocation support
Some applications require loading extensions into the memory which does
not exist during the boot time and cannot be allocated statically. Make
the application responsible for LLEXT heap allocation. Do not allocate
LLEXT heap statically.

Signed-off-by: Alex Ivanov <alexivanov@google.com>
2025-06-04 15:50:57 -04:00
Yishai Jaffe
8299817fba cfb: support non vtiled displays
Added support for drawing points on non-vtiled displays.

Signed-off-by: Yishai Jaffe <yishai1999@gmail.com>
2025-06-04 17:00:30 +02:00
Adrien Ricciardi
2f17465421 ipc: icbmsg: Add a workqueue name
This allows to easily identify the workqueue thread when using the kernel
shell commands.

Signed-off-by: Adrien Ricciardi <aricciardi@baylibre.com>
2025-06-04 16:59:04 +02:00
Alex Ivanov
3aace9520f llext: Do not print symbol resolution messages
If the LLEXT extension is really large, these messages really add up.
Making them debug messages.

Signed-off-by: Alex Ivanov <alexivanov@google.com>
2025-06-03 21:37:26 -07:00
Tim Pambor
a760ba76b6 net: ip: 6lo: Fix undefined behavior reported by UBSAN
htonl() and htons() take uint32_t/uint16_t as argument. Add the 'u' suffix
to constants to ensure the correct unsigned type is used and to avoid
undefined behavior if these functions are implemented as macros using
bit shifts.

Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
2025-06-03 21:32:54 -07:00
Mark Wang
2d4e05afc2 bluetooth: improve the controller address resolution enablement
If the controller resolving list is cleared by HCI_LE_Clear_Resolving_List,
don't need to enable the controller address resolution.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2025-06-03 17:09:02 +02:00
Johann Fischer
fe3c001eeb usb: device_next: disable high-speed USB device descriptor if not used
Disable the high-speed USB device descriptor if it is not in use.
Add checks to the code where the high-speed descriptor may be used.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2025-06-03 14:48:29 +01:00
Johann Fischer
8457f50278 usb: device_next: use common UDC pool on full-speed devices for CDC ACM
The required buffer is 128 bytes per instance on a full-speed device.
Use common (UDC) buffer, as this results in a smaller footprint.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2025-06-03 14:48:29 +01:00
Johann Fischer
81bf9d1102 usb: device_next: disable high-speed descriptors when not in use
Disable high-speed descriptors when they are not in use saves 64 bytes
in flash/RAM. It is unlikely that it will scale well enough to be used
in all class implementations or to support a different speed.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2025-06-03 14:48:29 +01:00
Johann Fischer
1c2d692d60 usb: device_next: use system workqueue in CDC ACM by default
Add Kconfig option to use dedicated workqueue in CDC ACM but use the
system work queue in CDC ACM by default.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2025-06-03 14:48:29 +01:00
Johann Fischer
6ea06038d9 usb: device_next: allow message callback to be executed from USBD thread
Allowing message callback execution from the USBD thread saves about 800
bytes. For small devices, the option can be useful to reduce flash/RAM
usage, those with enough resources should not bother about it.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2025-06-03 14:48:29 +01:00
Johann Fischer
187703c777 usb: device_next: allow vendor request support to be disabled
Disabling it if not needed can save about 100 bytes of flash memory.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2025-06-03 14:48:29 +01:00
Johann Fischer
ed4c27bd41 usb: device_next: allow BOS support to be disabled
Disabling it if not needed can save about 400 bytes of flash memory.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2025-06-03 14:48:29 +01:00
Cla Mattia Galliard
02d2cc519a net: sockets: Enable gethostname even if socket-offloading is selected
Also allow `gethostname` to be compiled in, even when the socket offloading
option is selected.

Signed-off-by: Cla Mattia Galliard <cla-mattia.galliard@zuehlke.com>
2025-06-03 13:51:23 +02:00
Fin Maaß
bf111b44ad mgmt: hawkbit: add shell autohandler timeout Kconfig
Add shell autohandler timeout configuration option.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-06-02 22:10:13 +02:00
Chaitanya Tata
2f991f2bff net: lib: zperf: Add support for skipping UDP upload server report
Add support for skipping UDP upload server report, useful in test TX
only with loopback (packets are dropped, so, no report).

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2025-06-02 17:37:55 +02:00
Shrek Wang
6e7756a542 net: tcp: Change SYN FIN to use send_data_timer
The send_queue was used as SYN/FIN packet retransmission. Before
the SYN/FIN being ACKed and dequeue-ed, the following packets in
the send_queue cannot be sent out. That's why Zephyr had to send
a FIN+ACK instead of a duplicated ACK-only in FINWAIT1, CLOSING.
In fact, we can take SYN/FIN as kind of data and use the same
send_data_timer for retransmission, like other OSes do. This way,
the send_queue is simply used for local traffics.
Benefits (in theory):
1. The code is easier,
2. TxPkt performance is better after skipping enq/deq send_queue,
3. The struct tcp{} node is a few bytes smaller, saving memory.

Signed-off-by: Shrek Wang <inet_eman@outlook.com>
2025-06-02 13:30:19 +02:00
Luis Ubieda
94a7f028ef ubx: Refactor codebase in order to improve usability
During testing and code inspection, there were various anti-patterns
on this (and U-Blox driver) codebase(s), including obfuscation, and
lack of data validation. This made it increasingly difficult to
introduce further variants of u-blox GNSS modems.

With this patch, both the UBX modem and the M8 driver have been
refactored to ease the reliability and maintainability of these
codebases. Here are some highlights:

WRT UBX modem:
- Helper macros to easily create UBX frames, (including checksum
calculation), at compile time; thus, making it easier to extend UBX
commands.
- Logic validation by the inclusion of the modem_ubx testsuite, used to
refactor the code through TDD.
- Ability to receive unsolicited messages, in order to enable U-Blox
drivers to rely on modem_ubx to transceive all commands, and avoid
hopping between modem_ubx and modem_chat.

WRT M8 driver:
- Remove GNSS specific protocol header files. Instead, unify them under
modem/ubx/protocol.h. Background: After a survey and looking at ubxlib
SDK I conclude the UBX protocol is by definition a GNSS protocol (there
are non-GNSS u-blox modems, but they're not interfaced through UBX
protocol).
- Establish pattern to create and send/receive commands using new
foundations on modem ubx.
- Remove dependency of Modem chat, and instead use UBX unsolicited
messages to get Navigation and Satellites data.
- Switch from the auto-baudrate detection pattern to a pattern of
transitioning between an initial known baudrate to a desired baudrate,
in order to improve initialization time.
- Add dts property to configure default fix-rate.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-05-30 19:40:19 +02:00
Declan Snyder
6bd6e50838 pm: Add API to check if a state disables a device
Add an API function that can be used by client code to check if a state
disables a device.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-05-30 19:40:11 +02:00
Declan Snyder
65ebecbf78 pm: refactor policy_device_ get/put
Refactor this code so it has less nesting and is able to share some code
between functions, by making a function to find the device constraints
object which can be called before doing operations using it.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-05-30 19:40:11 +02:00
Pieter De Gendt
d5931bae93 net: lib: coap: Return an error on removing a non-existing observer
If we're parsing a CoAP request with an observe option of '1', but there is
no matching observer, return an error instead of returning a zero.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-05-30 10:28:02 +02:00
Lyle Zhu
f34d7766af Bluetooth: Classic: L2CAP: Add echo command set
Add echo test shell commands, `register`, `unregister`, `req`, and
`rsp`.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-05-29 20:19:38 -04:00
Lyle Zhu
6f2b8f8a97 Bluetooth: Classic: L2CAP: implement ECHO REQ/RSP
Handle the ECHO request/response of classic L2CAP signaling packets.

Add the functions `bt_l2cap_br_echo_cb_register()` and
`bt_l2cap_br_echo_cb_unregister()` to register/unregister the ECHO
callbacks to monitor the ECHO REQ and RSP.

Add the function `bt_l2cap_br_echo_req()` to send the ECHO REQ through
classic L2CAP signaling channel.

Add the function `bt_l2cap_br_echo_rsp()` to reply the ECHO REQ
through the classic L2CAP signaling channel.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-05-29 20:19:38 -04:00
Guðni Már Gilbert
f32223aac5 debug: ASSERT_VERBOSE depends on PRINTK
When both PRINTK and ASSERT are disabled, the firmware image will still
contain a symbol for assert_print function which increases the memory
footprint by 14 bytes. In this case the function doesn't do anything and
so these 14 bytes are not useful.

This change also reduces the memory footprint elsewhere such as in the
bluetooth subsystem which implements BT_ASSERT_VERBOSE. Now it will be
nop. On nRF52832 this is on the order of 300 - 400 bytes when configured
for peripheral only (just as an example).

Signed-off-by: Guðni Már Gilbert <gudni.m.g@gmail.com>
2025-05-29 15:16:41 +01:00
Robert Lubos
38e00d1969 net: tcp: Fix user_data provided to accept callback
TCP implementation provided the parent net_context pointer to the
accept callback instead of the user_data pointer registered with
net_tcp_accept(). This worked fine with the socket integration, as
sockets explicitly registered parent context as user_data, however it
shouldn't be hardcoded like this at the TCP level.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-05-29 12:05:58 +02:00
Pieter De Gendt
b029d792c6 debug: coredump: coredump_backend_flash: Update checksum only on success
If the flash stream API fails to write a buffer, exclude it from the
calculated checksum.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-05-29 12:05:42 +02:00
Pieter De Gendt
125389ea32 debug: coredump: coredump_backend_flash: Keep error in context on flush
Do not override the last known value in backend_ctx.error with the result
of flushing.
Any previous error would be cleared and the coredump would appear to have
succeeded.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-05-29 12:05:42 +02:00
Lyle Zhu
d1deb20b95 Bluetooth: Classic: L2CAP: Disconn channel if proposed MTU is invalid
Disconnect the L2CAP channel connection if the proposed MTU is less
than min MTU or more than local supported MTU.

The main scenes are as follows.
If the proposed MTU is less than MIN MTU.
1. The channel connection of client and server is established,
2. Client/server sends channel config REQ (MTU=50),
3. Peer replies channel config RQP (Unaccepted/success with MTU=30),
4. The client/server will repeat step 3~4 if the RSP is unacceptable.

With the change applied, the local will disconnect the L2CAP channel
connection in step 3.

If the proposed MTU is more than local supported MTU.
1. The channel connection of client and server is established,
2. Client/server sends channel config REQ (MTU=50),
3. Peer replies channel config RQP (Unaccepted/success with MTU=80),
4. The client/server will repeat step 3~4 if the RSP is unacceptable.

With the change applied, the local will disconnect the L2CAP channel
connection in step 3.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-05-29 10:46:26 +02:00
Lyle Zhu
858e64cded Bluetooth: Shell: Classic: Add command select to select BR connect
Add a shell command `select` to select a specific BR connect according
to the given BR address.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-05-29 10:46:12 +02:00
Lyle Zhu
1572277a2e Bluetooth: Shell: Classic: Add command info to get conn info
Add shell command `info` to get the BR connect info.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-05-29 10:46:12 +02:00
Shrek Wang
744380a278 net: tcp: Use correct seqnum for tcp_out and tcp_out_ext
Based on TCP Spec., the outgoing TCP packets shoud use SND.NXT as
the seqnum. In Zephyr, the conn->seq works as the SND.UNA and the
conn->seq + conn->unacked_len works as the SND.NXT. Currently, it
uses SND.UNA in tcp_out() as the seqnum, which might get dropped
as old packets and could not deliver the message to the peer.
A few exceptions use SND.NXT - 1 as the seqnum are: keepalive,
zero-window-probe, FIN/SYN retransmissions. And, for closing a
connection, Zephyr won't send out FIN until all the data has been
ACKed, so the conn->unacked_len is 0 and it is ok to use conn->seq
as the SND.NXT.

Signed-off-by: Shrek Wang <inet_eman@outlook.com>
2025-05-29 08:42:20 +02:00
Lyle Zhu
ff41c71737 Bluetooth: Class: Shell: HFP_HF: Add auto_select_codec command
Add shell command `auto_select_codec` to select codec automatically
when codec negotiation callback is notified.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-05-29 06:31:32 +02:00
Lyle Zhu
aaef7eb658 Bluetooth: Classic: HGP_AG: change get_ongoing_call() to async mode
Change the callback `get_ongoing_call()` of the AG from synchronous to
asynchronous mode. It will help to avoid the Bluetooth host stack be
blocked in the context of callback `get_ongoing_call()`.

Add a function `bt_hfp_ag_ongoing_calls()` to set the ongoing calls and
reply the AT command `AT+CIND?` after the callback `get_ongoing_call()`
has been notified.

Add a delayable worker to avoid the AT command `AT+CIND?` never being
replied. After the time exceeds
@kconfig{CONFIG_BT_HFP_AG_GET_ONGOING_CALL_TIMEOUT}, the response of
the AT command `AT+CIND?` will be replied.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-05-29 06:31:32 +02:00
Lyle Zhu
d6dc7fbd66 Bluetooth: Classic: Shell: Add command ongoing_calls
Add shell command `ongoing_calls` to set the ongoing calls.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-05-29 06:31:32 +02:00
Lyle Zhu
488d577910 Bluetooth: Classic: HFP_HF: Support ongoing calls before SLC
If the any value of Call, Call Setup, and Held Call indicators is not
zero in the response of `AT+CIND?`, get all calls via `AT+CLCC`.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-05-29 06:31:32 +02:00
Lyle Zhu
09f3c31818 Bluetooth: Classic: HFP_AG: Remove unnecessary lock/unlock
For read-only access to fields, `lock/unlock` is unnecessary.

Remove unnecessary `lock/unlock` protection for read-only access
fields of AG.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-05-29 06:31:32 +02:00
Lyle Zhu
2b4de08c7c Bluetooth: Classic: HFP_AG: Support ongoing calls before SLC
Support the case that there are some calls existed before SLC
established.

Add a callback to get the ongoing calls one by one from upper layer
when the response of the AT command `AT+CIND=?` from HF has been sent.

And set the Call, Call Setup, and Held Call indicators and report the
values int the response of AT command `AT+CIND?`. Then report all
ongoing calls in the `+CLCC` response.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-05-29 06:31:32 +02:00
Olivier Lalonde
afc481ab31 modem_cellular: Add support for the simcom a76xx modem
Add support for the simcom a76xx modem which is similar to the simcom 7080
but has a few key differences. Tested with a simcom A7672SA module but as
there is a single simcom A76XX AT commands manual, the driver should work
with other modems of the series.

Signed-off-by: Olivier Lalonde <o@syskall.com>
2025-05-28 16:37:53 +02:00
Robert Lubos
c26f39450d net: context: Verify if CONFIG_NET_SOCKETS_PACKET_DGRAM is enabled
Verify if CONFIG_NET_SOCKETS_PACKET_DGRAM is enabled when creating a
datagram packet socket. Otherwise, it's possible to create
non-functional AF_PACKET/SOCK_DGRAM socket w/o an error.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-05-28 15:33:24 +02:00
Lyle Zhu
5f7fbb6c1d Bluetooth: Classic: Fix LTK cannot be derived issue
The LTK cannot be derived by LK when LK is not weaker than the old LTK.

Improve the function `smp_br_pairing_allowed()` to avoid the LTK be
overwrote when old LTK has MITM protection but new LK has not MITM
protection.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-05-28 11:13:40 +02:00
Can Wang
a95f900bfa Bluetooth: Shell: Fix issue that BR connection is not selected.
LE and BR connection have already been established, after that, LE
disconnection occurs, BR connection will not be selected as the next
default connection.

Fix this issue by searching for both BR and LE after disconnection
occurs.

Signed-off-by: Can Wang <can.wang@nxp.com>
2025-05-28 11:09:44 +02:00
Can Wang
361f8e2795 Bluetooth: Shell: Fix issue that BR security level cannot be set to 4.
Host stack supports to set BR security level to 4 but the security level
cannot be set to 4 by the shell command.

Update the code to support BR security level 4.

Signed-off-by: Can Wang <can.wang@nxp.com>
2025-05-28 11:09:44 +02:00
Can Wang
c24594a7bb Bluetooth: Shell: Remove redundant spaces in string.
This string contains two consecutive spaces. Remove one of them.

Signed-off-by: Can Wang <can.wang@nxp.com>
2025-05-28 11:09:44 +02:00