The websocket used mbedtls functions to calculate the
SHA1 needed. Update the code to use PSA crypto calls instead
when the configuration CONFIG_MBEDTLS_PSA_CRYPTO_CLIENT
is enabled.
This can be useful for applications which use TF-M
since it only provides PSA crypto APIs.
Also check the error code from the mbedtls_sha1
call since it can fail and it was not checked before.
Signed-off-by: Georgios Vasilakis <georgios.vasilakis@nordicsemi.no>
DSA is part of Ethernet and will utilize more Ethernet definitions for
more features support. So, it's proper to let DSA header include
Ethernet header with moving some DSA definiton from DSA header to
Ethernet header and adding DSA header including in c files using DSA
definition.
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
When we reconnect to a bonded device we always attempted to
send the changed PACS notifications, regardless of
whether the remote device has subscribed to them or not.
This resulted in a lot of failed attempts to send
notifications when
CONFIG_BT_GATT_ENFORCE_SUBSCRIPTION is enabled (which it is
by default).
Ideally we would not set the flags for devices that have not
subscribed, but since we cannot call bt_gatt_is_subscribed for
non-connected devices, we need to do this when the notify_cb
is called.
It would be possible to use BT_GATT_CCC_MANAGED instead
of BT_AUDIO_CCC to keep track of the writes for each client,
but that would be a minor optimization which would require
significant rework and additions to PACS. The current
solution is inspired by the implementation used in has.c
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Once running, a socket service could not be reconfigured (i.e. changing
file descriptors and/or events to be polled). This was due to an wrong
check at the end of the thread main loop of socket_service_thread that
evaluated to false as variable ret is zero if trigger_work(), which is
called previously for all returned events, returns successfully.
Signed-off-by: Philipp Finke <philipp_finke@gmx.de>
Define BT_AVDTP_SIGNAL_SDU_MAX Kconfig item to limit the max avdtp signal
SDU size, then use avdtp self defined net buf pool to prepare data. Use
default acl_tx_pool pool do to the fragmentation.
Signed-off-by: Mark Wang <yichang.wang@nxp.com>
In USB "in" refers to data going from device to host,
and "out" refers to data going from host to device.
From a BT perspective "usb_out" then refers to the data
we receive from the host, to be sent over BT, so the "out"
terminology still works for that, and vice versa for
incoming BT data.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When an IPv4 packet is received on a dual-stack socket, return
the mapped v4 to v6 address as source address.
Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
Fixed issue when `sendmsg()` was in use and `CONFIG_NET_IPV6`
and `CONFIG_NET_IPV4_MAPPING_TO_IPV6` were in use, as `dst_addr`
argument of `context_sendto()` was passed NULL,
but also used to determine `sa_family`.
Use msghdr, if available, to determine if v4 to v6 mapping is
present.
Also set `dst_addr` to unmapped value when v4 to v6 mapping is
used.
Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
If v4 to v6 mapping is used, cmsg_level and cmsg_type should
be compared with IPv6 values even if pkt family if AF_INET.
Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
Commit removes `Wrong state` warning from some DFU API.
This information has value only for debugging.
No any value for application to generate warning
on the regular basis.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
Print TCP connection pointer value for debug prints
consistently so that it is easier to find debug prints that
are related to a certain TCP connection.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Print return code on error and remove logging in `sntp_resync_handler`
since it calls `net_init_clock_via_sntp` which already does logging.
Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
Allow the rtio executor to handle the RTIO_OP_AWAIT for cases where no
rtio_iodev needs to be blocked while waiting for the signal.
When the RTIO_OP_AWAIT was introduced, the highlighted usecase was
performing transactions within an exact time window. This can be
achieved by blocking the rtio_iodev, effectively locking the bus, while
awaiting.
However, a relaxed implementation which doesn't block any rtio_iodev is
really useful for device drivers that use some kind of ready-event
during transactions. For example in order to read configuration out of
a sensor, the following flow may be required:
1. Write some cmd like "read accelerometer scale"
2. Await data-ready GPIO rising edge (might take "a long time")
3. Read the requested data payload from the sensor
Using a relaxed variant of the RTIO_OP_AWAIT this can be elegantly put
together in a single chained rtio sequence. And by not blocking the
rtio_iodev, other devices can be operated during the await period.
Of course, not blocking the rtio_iodev also means that the bus may be
busy when the RTIO_OP_AWAIT completes and thus, step 3 may be blocked
for a some time and the guarantee of an exact time window cannot be
achieved with the relaxed variant.
To make the API clearer, separate helpers are added for the strict
(blocking iodev) and relaxed (blocking only the sqe chain) variant
respectively.
Signed-off-by: Emil Dahl Juhl <emil@s16s.ai>
The bt_bap_unicast_client_qos function was recently
modified to check for presentation delay, however it did
not consider that a unicast group may contain streams that
are not configured, and thus do not have endpoints.
Add a stream->ep != NULL check to only consider configured
streams.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
List the file size helps in developer debugging experience. Provide
a config to disable new behavior in case any users depended on
command output to be a list.
Signed-off-by: Utsav Munendra <utsavm@meta.com>
Use the l2_processed-flag to decide whether a network packet needs to be
processed by an L2-handler. This could be used in the future to requeue
packets for later processing by a different traffic class queue.
Signed-off-by: Cla Mattia Galliard <clamattia@gmail.com>
There is an issue found that the L2CAP BR channel attempts to send
signaling commands through fixed channel when the ACL connect is
broken. At this time, the ACL connect of fixed channel is invalid.
Then the `__assert` occurs in function `bt_conn_ref()`.
Fixed the issue by checking the ACL conn of the L2CAP channel before
sending the data.
Here is a referred fault case for this changes,
There are two connected L2CAP Channels. The first one is primary
connection of the profile. And the second one is secondary connection
of the profile. When the primary connection is broken, the secondary
connection should also be disconnected.
In normal case, if the primary connection is disconnected by calling
L2CAP channel disconnection function, the secondary connection will
be disconnected by calling L2CAP channel disconnection in the
disconnected callback of primary connection.
But there is a corner case is that, the ACL connection is broken.
When the disconnected callback of primary connection is called, the
function call of L2CAP channel disconnection for secondary connection
will be asserted. Because the signaling channel (fixed channel ID
0x01) is disconnected and the `chan->conn` of the fixed channel is
NULL in this time.
The call stack is,
o bt_conn_ref() -> Asserted in this function.
o bt_conn_data_ready() -> The parameter is `br_chan->chan.conn`.
It is the NULL.
o raise_data_ready() -> The parameter `br_chan` is fixed channel.
o bt_l2cap_br_send_cb() -> The parameter is ACL conn and CID of fixed
channel (cid = 0x01). The channel can be found, but `chan->conn` is
NULL.
o l2cap_br_chan_send_req()
o bt_l2cap_br_chan_disconnect()
o bt_l2cap_chan_disconnect() -> The parameter is the channel of
secondary connection. The state of secondary channel is connected,
because the stack is handling the primary channel disconnecting.
And the function is called in disconnected callback of primary
channel.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
In current implementation, the ATTR ID list is set with fixed value
(0x0000, 0xffff). For the case that responding a lot of SDP record
data, the responded data cannot be processed properly due to the
receiving buffer size limitation. In this case, the ATTR ID list can
be used to reduce the length of the responding data. In this way, it
will help reduce the SDP's requirement for receiving data buffer size.
Add the attribute ID list configuration to the SDP discovery request
structure `struct bt_sdp_discover_params`.
If the `struct bt_sdp_discover_params::ids` is NULL, or
`struct bt_sdp_discover_params::ids::count` is 0, the default range
(0x0000, 0xffff) is used.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
In current implementation, if the response total data length is more
than the receiving buffer size, the request cannot be completed
properly.
Improve the SDP client with the following changes,
o Notify the received completed SDP records if the case occurs, and
then start the continuing SDP discovery,
o Stop the SDP discovery if the hold SDP record cannot be saved to the
receiving buffer,
o Stop the SDP discovery if the `BT_SDP_DISCOVER_UUID_STOP` is
returned by upper layer.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
In current implementation, after parsing the received service search
pattern and all matched SDP records are saved in the local variable
`matching_recs`. The max count of SDP records within its SDP
database that match the given service search pattern is
BT_SDP_MAX_SERVICES when parsing the received Service Search Pattern.
And it causes the max count registered SDP records is limited to
BT_SDP_MAX_SERVICES.
Refactor the parsing of service search pattern to remove the
limitation with the following steps.
1. Save the service search pattern to a simple buffer by calling
the function `parse_service_search_pattern()`.
2. Traverse all registered SDP record and check for each SDP record
if it is matched with given service search pattern by calling
function `service_search_pattern_matched()`.
3. Use the matched SDP records to response the SDP request.
And also remove the limitation of the max count of registered SDP
records.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Use slist instead of custom singly linked list to manage SDP records.
Check if the SDP record has been registered in the function
`bt_sdp_register_service()`.
Append the new SDP record to the tail of the SDP record list.
Check if the index of SDP record is overflow in the function
`bt_sdp_register_service()`.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Migrate support from crc library to new crc subsystem
Add hardware acclerator backend for crc subsystem
Signed-off-by: Duy Vo <duy.vo.xc@bp.renesas.com>
Fix incorrect LLL scheduling of subsequent subevents when
using single timer implementation, due to missing call to
accumulate the last PDU end timestamp which is essential to
setup next radio start and to setup header complete timeout.
Relates to commit 373dc0db71 ("Bluetooth: Controller:
Single timer use Extended Advertising nRF54L support").
Relates to commit 6e8f081385 ("Bluetooth: Controller: Fix
peripheral assert under single timer use").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Only upload to `slot1_ns_partition` if we're building for TF-M nonsecure
and we're doing split images. Single images need to upload to the whole
`slot1_partition`.
Signed-off-by: Jordan Yates <jordan@embeint.com>
This default value 2 of WIFI_NM_MAX_MANAGED_INTERFACES
ensures WiFi network manager can properly handle both
access point and station interfaces.
Signed-off-by: Muhammad Waleed Badar <walid.badar@gmail.com>
The bt_csip_set_member_unregister function unregisters
a CSIS instance and restores the attributes to the original
state (the attributes may change during registration).
The previously solution had some issues with a check when
using picolib (‘__ssp_bos_check3’ undeclared), and this
fixes that by using a proper variable for the memcpy.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Instead of re-implementing or assuming that POPCOUNT is available
we now use the generic function from Zephyr.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Modify the big_disconnect function to do cleanup_big before
calling the `stopped` callback. This will allow the ISO channels,
as well as the BIG itself, to be reused for other purposes directly
in the stopped callback, without having to offload such actions
to a separate thread.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add a new ec_host_cmd backend based on USB. The backend uses the new USB
device stack.
The backend implements a vendor-specific (Google) USB interface. It uses
three endpoints:
- bulk OUT to transfer a host command request
- bulk IN to transfer a host command response
- interrupt IN to signal an event and readiness of the response
Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
move variable declaration out of if,
because it will be optimized away, when
optimisation is enabled and leads to
undefined and unwanted behavior.
In my case `send_buf` of `http_client_req`
was put at the same address and the
http request was malformed.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
Do not directly include and use APIs from ksched.h outside of the
kernel. For now do this using more suitable (ipi.h and
kernel_internal.h) internal APIs until more cleanup is done.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Adds a function that verifies if an endpoint pointer is
part of ASCS before performing CONTAINER_OF operations on it.
Adds checks for this in the BAP Unicast server public API.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The bt_ascs_ase_status was stored directly in the
struct bt_bap_ep, which was an issue as
bt_ascs_ase_status is a variable sized struct.
The struct could have been moved to the end of
bt_bap_ep to avoid the issues it caused, but
there is no actual reason to use that struct
rather than storing the ID and state as
seperate values.
The ascs_ep_get_state exists but was not widely
used in ascs. Modify places to use the function
instead of directly accessing the state.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
CTF tracing relies on all packet timestamps being increasing- if a
timestamp of a later packet is less than the prior packet, the CTF
parser assumes the timestamp field has overflowed and adds to the
overall timestamp to account for this.
When taking a timestamp for a CTF packet, it was possible for an interrupt
to occur before the packet was submitted to the tracing core framework
but after the timestamp was generated. The interrupt itself would
generate a tracing event with a later timestamp then the packet in
question, leading to the packets being recorded out of order.
To resolve this, take an IRQ lock before generating the timestamp and
release it after submitting the packet to the tracing core.
Signed-off-by: Daniel DeGrasse <ddegrasse@tenstorrent.com>
This moves the declaration of the utf8 utils defined in lib/utils/utf8.c
in their own header. Main reason to do this is that the current setup
requried adding an include for sys/types.h in util.h, which can result
in a build falure due to a circular header depdenecy when using:
CONFIG_POSIX_API=y
CONFIG_NEWLIB_LIBC=y
_GNU_SOURCE
the loop and error are:
- include/sys/types.h:50: <- this is a NEWLIB one
- include/zephyr/posix/sys/select.h:9:
- include/zephyr/posix/posix_types.h:30:
- include/zephyr/kernel.h:17:
- include/zephyr/kernel_includes.h:25:
- include/zephyr/sys/atomic.h:18:
include/zephyr/sys/util.h:705:1:
error: unknown type name 'ssize_t'
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Some applications might require cleanup prior to performing a system
reboot. Add an option that disables hawkbits automatic reboots so that
it can be postponed until the application is ready.
Signed-off-by: Mandus Börjesson <borjessonmandus@gmail.com>
Fix missing ISO Receiver access address capture that caused
ISO PDU reception error. Missing access address capture for
subsequent subevent when prior subevent did not have an
anchor point sync prevent proper drift compensation hence
causing ISO PDU reception error for the entire BIG event.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix the jitter considered in the PDU reception in the
subevents of ISO Sync Receiver to not exceed such that the
reception is scheduled late (causing assertion).
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>