Commit graph

21541 commits

Author SHA1 Message Date
Dominik Ermel
4a12570ef8 mgmt/mcumgr/lib: Allow image management list broken version str
The commit adds change to image management list where "<???>"
will be returned as version string in case when version to string
conversion fails.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-04-19 11:34:40 +02:00
Dominik Ermel
692a4a7e63 mgmt/mcumgr/lib: Replace ull_to_s with snprintf in img_mgmt_ver_str
The ull_to_s, which is used to covert ints to string, has been
replaced with snprintf.
Above also fixes a bug where ull_to_s has been given INT_MAX as allowed
output string, while it should be given maiximum allowed buffer size.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-04-19 11:34:40 +02:00
Dominik Ermel
ca60b75613 mgmt/mcumgr/lib: Remove mgmt_streamer_reset_buf
Commit removes mgmt_streamer_reset_buf from mcumgr lib,
and supporting Zephyr function zephyr_smp_reset_buf.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-04-19 11:32:56 +02:00
Flavio Ceolin
0b13b44a66 pm: device: Dynamically add a device to a power domain
Add API to add devices to a power domain in runtime. The number of
devices that can be added is defined in build time.

The script gen_handles.py will check the number defined in
`CONFIG_PM_DEVICE_POWER_DOMAIN_DYNAMIC` to resize the handles vector,
adding empty slots in the supported sector to be used later.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-04-18 17:25:01 -07:00
Rihards Skuja
d5b83a8c90 logging: disable Linux-style timestamp formatting by default
Fix a typo in #43934.

Signed-off-by: Rihards Skuja <rhssk@posteo.eu>
2022-04-15 10:33:15 -07:00
Szymon Czapracki
827890c075 Bluetooth: audio: Add initial Hearing Access Service shell
This adds initial shell support for HAS.

Signed-off-by: Szymon Czapracki <szymon.czapracki@codecoup.pl>
2022-04-15 10:32:54 -07:00
Mariusz Skamra
4ac9eba3d5 Bluetooth: has: Add initial support for presets
This adds initial support for presets that includes API functions
to register/unregister presets and Read Preset Request control point
handler.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2022-04-15 10:32:54 -07:00
Piotr Golyzniak
00a4a94076 logging: remove obj character
Remove OBJECT REPLACEMENT CHARACTER U+FFFC from warning log messages.

Signed-off-by: Piotr Golyzniak <piotr.golyzniak@nordicsemi.no>
2022-04-15 09:24:32 -04:00
Tom Burdick
02503c37c3 logging: backend_adsp: lock the output
Adds a lock around the output to prevent corruption, and sets the buffer
size of the output to size of the output buffer. This fixes the
corrupted log output as process() may be called from multiple contexts
from different CPUs. A background log processing thread may race against
the panic ISR log context also calling process() on an SMP system.

Additionally sets the buffer size to 80 such that the cavs trace_out.c
functionality and lock are useful for more than one character at a time
greatly reducing the chances of garbled output in a printk and log race
but does not entirely prevent it. CONFIG_LOG_PRINTK=y should be used
to avoid all races.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-04-13 17:41:27 -04:00
Jamie McCrae
d67a364ace mgmt: mcumgr: lib: os: Add reset callback
This allows an application to inspect a mcumgr os reset command and
either allow it or deny it with a result code.

Signed-off-by: Jamie McCrae <jamie.mccrae@lairdconnect.com>
2022-04-13 14:05:57 -07:00
Marin Jurjević
0ab6bc6626 net: lwm2m: update client tx timestamp before sending message
Update client tx timestamp right after message is added to list
of outgoing messages. Delay between when message is generated and
sent is negligible. This will prevents bugs that appear when using
queue mode, where internal engine logic depends on timestamp being
updated when message is generated.

Signed-off-by: Marin Jurjević <marin.jurjevic@hotmail.com>
2022-04-13 13:59:58 -07:00
Krzysztof Chruscinski
33923014b9 logging: Kconfig cleanup of frontened related options
Cleanup in kconfig options in preparation for adding a
frontend that will use dictionary mode.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-04-13 13:45:36 -07:00
Krzysztof Chruscinski
8f919e41fa logging: Add UART dictionary frontend
Add frontend which dumps log messages in binary dictionary
mode.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-04-13 13:45:36 -07:00
Krzysztof Chruscinski
8b0d429bfd logging: Add timestamp getter function part of internal API
Expose timestamp getter so it can be used, e.g. in the frontend.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-04-13 13:45:36 -07:00
Piotr Pryga
b53657a058 Bluetooth: Controller: hci: Wrong opcode when handling CTE req failed
HCI_LE_CTE_Request_Failed may be generated in case received LL_CTE_RSP
PDU didn't contain CTE or if peer rejected the request. HCI function
encode_data_ctrl responsible for dispatching received control PDUs
should not expect a PDU with PDU_DATA_LLCTRL_TYPE_CTE_REQ opcode.
It should never happen. The correct opcode here is PDU_DATA_LLCTRL_TYPE-
_CTE_RSP.

Result of this issue is an assert when LL_CTE_RSP PDU is received
but it does not include CTE.

The commit fixes the problem.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2022-04-13 13:40:59 -07:00
Herman Berget
97d64cf104 Bluetooth: Host: Fix assert in L2CAP ECRED connection response
In the case that the peer responds with fewer dcid values than the
number of scid values in the connection request, we would assert or read
past the end of the buffer.

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2022-04-13 13:40:00 -07:00
Szymon Janc
31b148ab64 Bluetooth: host: Fix crash in bt_l2cap_chan_recv_complete
It is possible that LE CoC channel is in disconnecting state (eg due
to peer sending too many packets) but application is not yet aware
of this (ie disconnected callback was not called) and thus may call
bt_l2cap_chan_recv_complete() to return credits. In this case it
leads to assert in l2cap_chan_send_credits.

It looks like PTS 8.2.1 is able to trigger this scenario when
executing L2CAP/ECFC/BI-02-C test.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2022-04-13 13:29:12 -07:00
Veijo Pesonen
1105017ce0 net: lwm2m: Makes OMA TLV content fmt conditional
With LwM2M v1.1 usage of the OMA TLV content format is discouraged.

Signed-off-by: Veijo Pesonen <veijo.pesonen@nordicsemi.no>
2022-04-13 13:28:34 -07:00
Dominik Ermel
4e03e34138 mgmt/mcumgr/lib: Add missing inclusion of toolchain.h
The zcbor_bulk_priv.h uses STRINGIFY for some of definitions
and, due to lack of inclusion of the toolchain.h, that was causing
compilation errors when NEWLIB would be selected.

Fixes #44811.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-04-13 13:28:16 -07:00
Anas Nashif
1537ee7a0b ztest: if runid is set, propagate it
define test run id and make it available to ztest. This will be used to
verify we are evaluating the same test we have just built and flashed
and that we are not looking at some old output.

Existing code in ztest will use this, and twister will define the run
id.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-04-12 08:54:41 -07:00
Anas Nashif
68670d71b8 tracing: kconfig: move RAM_TRACING_BUFFER_SIZE out of choice
This kconfig is not a choice, it is an option needed by one of the
choices, so move it out.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-04-12 11:39:11 -04:00
Anas Nashif
af2d83e66f tracing: add missing macros needed for k_thread_foreach
Add those dummy tracing functions to get the test to build when using
k_thread_foreach.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-04-12 11:39:11 -04:00
Szymon Janc
1f27849457 Bluetooth: controller: Fix build with new LLCP enabled
PR44014 introduced new pause logic for procedures but PR44297
was merged without being update to use it.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2022-04-12 12:57:44 +02:00
Jamie McCrae
756a8f7a9b mgmt: mcumgr: fs: Add hash/checksum (with CRC32/SHA256) handler
This adds a hash/checksum mcumgr handler to the file management commands
which can be used to get a hask or checksum of a file, and includes
handler implementations for IEEE CRC32 and SHA256.

Signed-off-by: Jamie McCrae <jamie.mccrae@lairdconnect.com>
2022-04-12 12:05:30 +02:00
Jamie McCrae
105f8b65e9 mgmt: mcumgr: fs: Add file status handler
This adds a command handler to the file management mcumgr system to get
the status of a file without needing to return file data (currently
reporting the file size).

Signed-off-by: Jamie McCrae <jamie.mccrae@lairdconnect.com>
2022-04-12 12:05:30 +02:00
Dominik Ermel
1b92fba8e7 mgmt/mcumgr/lib: endian.h is no longer needed.
Removed.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-04-12 11:42:28 +02:00
Dominik Ermel
e7205683bd mgmt/mcumgr/lib: Replace htons/ntohs with Zephyr functions
The commit replaces htons and ntohs calls, with sys_be16_to_cpu
and sys_to_cpu_be16.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-04-12 11:42:28 +02:00
Szymon Czapracki
af2e781f5a Bluetooth: Immediate Alert Service
This commits adds IAS for zephyr bluetooth.

Signed-off-by: Szymon Czapracki <szymon.czapracki@codecoup.pl>
2022-04-12 09:59:34 +02:00
Erik Brockhoff
f056eb516d Bluetooth: controller: Implementing LL param checks for refactored CPR
Now refactored Connection Parameter Request procedure supports
parameter checking, and implements reject_ext_ind on invalid parameters

Updates to TODO description for remaining work

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2022-04-12 09:57:43 +02:00
Veijo Pesonen
d1751cafd3 net: lwm2m: adds LwM2M specific shell command
First available subcommand is for doing a send operation. Send operation
is supported by the LwM2M version 1.1.

Signed-off-by: Veijo Pesonen <veijo.pesonen@nordicsemi.no>
2022-04-12 09:57:20 +02:00
Piotr Pryga
ab17f6d9f7 Bluetooth: Controller: Fix missing event counter sub by one
The event counter value for connection and periodic advertising
events is updated to next value during event preparation (in one
of prepare_cb functions in LLL).
IQ report is prepared after event preparation, so value of event
counter is ahead of the current event value by one, hence it has
to be subtracted.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2022-04-12 09:54:07 +02:00
Piotr Pryga
7dd3d8ff87 Bluetooth: Controller: df: Fix wrong value of event counter in iq report
HCI_LE_Connectionless_IQ_Report and HCI_LE_Connection_IQ_Report
events has fields that store event counter values: Periodic_Event_-
Counter and Event_Counter, respectively.
Values assigned to this HCI events are taken directly from
lower link layer objects. In case of too slow processing of
HCI events values provided by LLL contexts could be changed before
HCI sends events to Host. That can happen e.g. in case of short
periodic advertising interval and slow UART baudrate.
In such situation event counter values will be corrupted.

To prevent that situation, event counter values connected with
IQ sample reports, has to be stored in node_rx_iq_report when
a report instance is filled in LLL.

This commit introduces required changes.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2022-04-12 09:54:07 +02:00
Carles Cufi
070c93f0d7 Bluetooth: host: Invert the logic to re-trigger the RX work queue
In order for the code to be more understandable, invert the logic to
decide when to re-trigger the RX work queue and document the approach.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-04-12 09:53:33 +02:00
Carles Cufi
ca54a4201c Bluetooth: host: Use a linked list instead of a FIFO as the RX queue
There is no need to use a k_fifo object to queue the items that are
passed to bt_recv() now that we are using a work queue instead of a
thread, since there is no need for blocking on the actual queue, instead
relying on the fact that work is triggered to know that an item is ready
for processing.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-04-12 09:53:33 +02:00
Dominik Ermel
8aa7791c53 mgmt/mcumgr/lib: Improve smp_process_request_packet documentation
The commit clarifies smp_process_request_packet behaviour.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-04-11 12:13:33 +02:00
Dominik Ermel
069fed9ca9 fs: Kconifg: use rsource instead of source for local Kconfigs
Change from absolute path to relative path for sourcing sub-Kconfigs.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-04-11 12:12:20 +02:00
Dominik Ermel
aff57a0a42 mgmt/mcumgr/lib: Cleanup of img_mgmt_priv.h
Fixed define and removed unneded definitions.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-04-11 12:12:03 +02:00
Dominik Ermel
bc276b1a68 mgmt/mcumgr/lib: Correct zephyr_grp log module name
The zephyr_grp log module name was incorrectly named
MGMT_SETTINGS and module registration has been using module name
mgmt_zephyr_basic, which is also incorrect.
Both have been changed to mcumgr_zephyr_grp.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-04-11 12:11:27 +02:00
Dominik Ermel
f79698a37c mgmt/mcumgr/lib: Separate Kconfig for zephyr specific commands
Kconfig options for Zephyr specific group have been moved
to zpehyr_grp/Kconfig.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-04-11 12:11:27 +02:00
Dominik Ermel
a1449521aa mgmt/mcumgr: Kconfig: Gather transport options under own menus
The commit adds transport dedicated menu and gathers all transport
options under that menu; each transport gets its own menu, witch
gathers options specific for that transport

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-04-11 12:10:39 +02:00
Dominik Ermel
b6db591a17 mgmt/mcumgr/lib: Add MCUMGR Parameters command to OS group
Adds new command that allows to retrieve MCUMGR parameters.
Currently the command returns MCUMGR buffer size and count.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-04-11 12:10:20 +02:00
Lingao Meng
37e561f42e Bluetooth: Host: Add choice select whether BT RX
Change CONFIG_BT_RECV_IS_RX_THREAD into a
choice:CONFIG_BT_RECV_CONTEXT with the following options
(names can be discussed further of course):

    CONFIG_BT_RECV_BLOCKING
    CONFIG_BT_RECV_WORKQ_BT
    CONFIG_BT_RECV_WORKQ_SYS

This way users would be able to choose what to run most of
the BLE stack on, they wouldn't be forced to a single model.

We would default to CONFIG_BT_RECV_BLOCKING so that we wouldn't
need to change the system workqueue stack size by default, instead
asking users to do so if they select the CONFIG_BT_RECV_WORKQ_SYS option

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2022-04-11 10:58:09 +02:00
Mohan Kumar Kumar
f105ea6ef5 net: add sndbuf socket option
Introduce set/get SO_SNDBUF option using the setsockopt
function. In addition, for TCP, check the sndbuf value
before queuing data.

Signed-off-by: Mohan Kumar Kumar <mohankm@fb.com>
2022-04-11 10:23:31 +02:00
Mariusz Skamra
e9b40ebc69 Bluetooth: has: Satisfy profile security requirement
This enables Secure Connections pairing (actually disables legacy)
to satisfy security requirements of the Hearing Access Profile.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2022-04-11 10:23:13 +02:00
Pavel Vasilyev
0f3e473f06 Bluetooth: Mesh: Remove argc check in mesh shell commands
The shell submodule already checks number of arguments.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2022-04-11 10:16:28 +02:00
Pavel Vasilyev
ae2841877b Bluetooth: Mesh: Use shell_print_ctx macro to print from callbacks
Use shell_print_ctx macro when printing to shall from callbacks.
ctx_shell may not be initialized when callback is called.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2022-04-11 10:16:28 +02:00
Marcin Niestroj
5d07c53118 net: sockets: do not unconstify 'optval' in setsockopt()
'optval' in setsockopt(..., SO_BINDTODEVICE, ...) was casted explicitly
from 'const void *' to 'struct ifreq *'. Rely on C implicit casting from
'const void *' to 'const struct ifreq *' and simply update variable
type. This prevents unwanted modification of ifreq value in the future.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-04-08 15:51:38 -07:00
Eduardo Montoya
7ab43a7cc9 net: openthread: update otPlatSettingsInit
API has been modified.

Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
2022-04-08 15:50:53 -07:00
Marcin Niestroj
cf75f01a71 net: sockets: introduce NET_SOCKETS_OFFLOAD_PRIORITY option
This option will be used as default socket priority by offloaded socket
drivers.

Describe how to prioritize native TLS over offloaded TLS (and vice
versa) using sockets priorities.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2022-04-08 15:50:11 -07:00
Yuval Peress
648bb9ebdf ztest: fix before function ordering
Make sure that the test rules' `before` function runs before the
suite's. This allows the suite to override any defaults set by the
rule.

Signed-off-by: Yuval Peress <peress@google.com>
2022-04-08 15:49:57 -07:00