Commit Graph

23 Commits

Author SHA1 Message Date
Henrik Brix Andersen 159f7dbbb1 lib: net_buf: rename header file from zephyr/net/buf.h to zephyr/net_buf.h
Move the network buffer header file from zephyr/net/buf.h to
zephyr/net_buf.h as the implementation now lives outside of the networking
subsystem.

Add (deprecated) zephyr/net/buf.h header to maintain compatibility with old
file path.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2024-09-07 11:19:05 -05:00
Jamie McCrae 0d6532d27c mgmt: mcumgr: smp: Initialise variable
Seemingly newer versions of gcc wrongly detect a variable is used
when it is not set, this is not the case the compiler is wrong,
add a default set to null to prevent the fake warning appearing
as an error in CI

Signed-off-by: Jamie McCrae <spam@helper3000.net>
2024-07-11 12:39:33 +02:00
Øyvind Rønningstad 527af809f8 mgmt: Adapt to API changes in zcbor 0.8.0
zcbor_new_state and zcbor_tstr_put_term

Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
2024-01-25 15:09:16 +00:00
Jamie McCrae a48a594f13 mgmt: mcumgr: callback: Add op to receive callback
Adds the operation supplied by the client to the MCUmgr command
received callback

Signed-off-by: Jamie McCrae <spam@helper3000.net>
2023-12-15 11:48:59 +00:00
Kuno Heltborg 220a57b0b1 mgmt: mcumgr: improve custom payload types
Use a flag in `c:struct:mgmt_handler` to skip the cbor start and end byte,
and instead use pure custom user defined payload.

Signed-off-by: Kuno Heltborg <kunoh@live.dk>
2023-12-11 18:31:23 +01:00
Fabio Baltieri d1504ff66f mcumgr: fix few mismatched CONTAINER_OF
Fix a missing first element reference in a CONTAINER_OF.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-30 10:22:00 +02:00
Jamie McCrae 5c88d45544 treewide: mgmt: mcumgr: Change "ret" to "err" for SMP version 2
This is a stable API treewide change changing the newly introduced
"ret" response to "err" as it was overlooked that the shell_mgmt
group already used "ret" to return the exit code of the command
and this created a collision. Since SMP version 2 was only recently
introduced, there should not be any public implementations of it
as of yet, but the original function has been kept and marked as
deprecated.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-08-21 10:18:50 +02:00
Jamie McCrae 0001d01bfe mgmt: mcumgr: Allow additional cbor states for encoding
Allows selecting more than the default number of encoding states.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-08-21 10:12:06 +02:00
Juha Heiskanen 5797e4241e mgmt: smp: SMP Client enabler
SMP client support for generate request and handling
response message.

Updated SMP transport for send request.

Added API for register SMP transport.

Signed-off-by: Juha Heiskanen <juha.heiskanen@nordicsemi.no>
2023-07-27 14:35:43 +02:00
Jamie McCrae ecfbabd213 mgmt: mcumgr: Make SMP version 2 to legacy error lookup extensible
Replaces the manual lookup function with a lookup function which
is provided when registering MCUmgr handlers which can be used to
find the function to translate error codes, allowing out of tree
MCUmgr handlers to provide error translation handlers.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-07-20 10:35:14 +00:00
Jamie McCrae c9a4764c10 mgmt: mcumgt: smp: Fix not checking returned status
Fixes not checking if a zcbor operation was successful.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-07-10 12:04:40 +02:00
Jamie McCrae 6877ad413f mgmt: mcumgr: smp: Allow preventing command execution via hook
Adds status checking to the command status hook which allows an
application to inspect a request and, optionally, reject it.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-06-21 13:24:12 +02:00
Jamie McCrae c052a9f4eb mgmt: mcumgr: Disable legacy Kconfigs if legacy mode is disabled
It does not make sense to control configuration of legacy
options if legacy mode is diabled.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-05-26 15:05:29 +02:00
Jamie McCrae aff663dd2f mgmt: mcumgr: smp: Expand ver to version and limit version
Expands a bitfield name from nh_ver to nh_version so it is more
obvious what it is. Also changes the version that goes into the
response to indicate what the maximum supported version of the
protocol is for a device

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-05-26 15:05:29 +02:00
Jamie McCrae a476eeb8ec mgmt: mcumgr: grp: os_mgmt: Use new error for invalid format
Uses the new error system to report an error if the user provides
an invalid format for the OS info command.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-05-18 13:31:19 +02:00
Jamie McCrae f59b857f6a mgmt: mcumgr: smp: Convert functions to function pointer array
Converts the list of functions for registering an MCUmgr SMP
transport from function arguments to a single list which contains
the function pointers.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-05-15 10:23:35 +02:00
Jamie McCrae 6f5b974949 mgmt: mcumgr: Add command result codes (ret)
Adds a new map to responses that command handlers can use to
return result codes of functions themselves, unrelated to SMP
error codes. This is achieved by adding an optional "ret" map
which contains a 16-bit "group" and 16-bit "rc" error code,
this map will not be included if the "ret rc" is 0 (which
implies success).

In order to allow this, a new version of the protocol has been
which can be indicated for use by setting a bit in the header.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-05-15 09:27:16 +02:00
Dominik Ermel 671625cd0c mgmt/mcumgr: Add Kconfig option naming notes
The commit adds Kconfig option naming notes to Kconfig
files of MCUmgr subsystem.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-12-22 12:36:34 +01:00
Dominik Ermel c7378d0d84 mgmt/mcumgr: Move Kconfig options to proper Kconfig files
After Kconfig options got renamed, some of the no longer fit
to files they have been defined in.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-12-22 12:36:34 +01:00
Dominik Ermel db34adf9c3 mgmt/mcumgr: Standardise MCUmgr Kconfig names
Standardise Kconfig options for MCUmgr.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-12-22 12:36:34 +01:00
Jamie McCrae 95697b5fcf mgmt: mcumgr: Replace non-zephyr cmake functions with zephyr versions
This fixes an issue whilst investigating using iterable sections,
which cannot be used when the non-zephyr prefixed functions are
used. It also resolves a possible critical bug intoduced with the
MCUmgr rework whereby functions or elements seem to have silently
dropped.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2022-12-19 13:02:32 +01:00
Jamie McCrae 9831b320f2 mgmt: mcumgr: Fix missed variable rename
Fixes accesses a renamed variable when a specific Kconfig is
active that would cause a compile error.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2022-11-23 12:24:59 +01:00
Dominik Ermel 4328f165a8 mgmt/mcumgr: Reworking source code tree and API interface
The commit reworks mgmt/mcumgr subsystem source code to remove
lib subdirectory and make it a little bit more flat.
It also moves all API interface files, which are supposed to be
visible by applications using MCUMgr, to interface sub-directories,
and exposes them with full paths; for example to include general
MCUMgr support, group registration and so on, user would now include:
 <mgmt/mcumgr/mgmt/mgmt.h>
to additionally have control on File System group management
registration user would need:
 <mgmt/mcumgr/mgmt/grp/fs_mgmt.h>

All internal headers have been removed from interface.

CMAkeLists.txt get significant rework and various MCUMgr subsystems
have been divided into separate sub-libraries.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-11-17 15:31:17 +01:00