Commit graph

117 commits

Author SHA1 Message Date
Yong Cong Sin bbe5e1e6eb build: namespace the generated headers with zephyr/
Namespaced the generated headers with `zephyr` to prevent
potential conflict with other headers.

Introduce a temporary Kconfig `LEGACY_GENERATED_INCLUDE_PATH`
that is enabled by default. This allows the developers to
continue the use of the old include paths for the time being
until it is deprecated and eventually removed. The Kconfig will
generate a build-time warning message, similar to the
`CONFIG_TIMER_RANDOM_GENERATOR`.

Updated the includes path of in-tree sources accordingly.

Most of the changes here are scripted, check the PR for more
info.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-05-28 22:03:55 +02:00
Fin Maaß 571ad19b0d mgmt: hawkbit: change the tls certificate tag
Be able to change the tls certicicate tag.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-05-06 22:50:44 +01:00
Pieter De Gendt b4e5c2e078 include: mgmt: ec_host_cmd: Remove __subsystem tag
Remove the subsystem tag from a backend API.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-05-03 14:44:41 +01:00
Fin Maaß 7cf97c61c0 mgmt: hawkbit: some doc improvements
some doc improvements in hawkbit.h.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-05-02 13:55:28 -04:00
Fin Maaß 0012e1ff76 mgmt: hawkbit: reset action id
Be able to reset the hawkBit action id.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-05-02 09:32:18 +01:00
Fin Maaß 679cf6111b mgmt: hawkbit: set server address, port and auth_token during runtime
In situations, where the address, the port and the auth token of the
hawkbit server are not known during build, it should be possible to set
it during runtime.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-04-19 16:39:31 +00:00
Fin Maaß 98d63ed286 mgmt: hawkbit: check for init
check for init before running hawkbit.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-04-19 16:39:31 +00:00
Fin Maaß 10fafa025e mgmt: hawkbit: add support for custom device identity callback
add support for custom device identity callback in hawkbit

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-04-18 11:19:29 +02:00
Fin Maaß 11e58b3aae mgmt: hawkbit: add support to define attributes
Allows the attributes to be defined in the user application
by using a callback function.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-04-17 12:02:07 -07:00
Fin Maaß e3f182549a mgmt: hawkbit: Add support for reboot after update
Add support for automatic reboot after successful update completion

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-04-05 12:20:48 +02:00
Ederson de Souza 28d08ada28 include/zephyr: Add 'version' and 'since' tag to groups
Based on information from doc/develop/api/overview.rst, add current
version for some groups representing APIs, following the following
table:

  - Experimental:   0.1.0
  - Unstable:       0.8.0
  - Stable:         1.0.0

Also based on doc/develop/api/overview.rst, add 'since' tag to the
groups.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-03-19 13:13:45 +01:00
Dawid Niedzwiecki 4d97dcf115 ec_host_cmd: introduce Host Command state
Introduce a current state of Host Command subsystem.

It makes sures that a backend has been initilized and doesn't allow
sending a response twice. There is a possibility, that a command handler
that calls ec_host_cmd_send_response function returns anyway (which is a
mistake).

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2024-03-06 14:35:34 +01:00
Fin Maaß 3c5172acac mgmt: hawkbit: Add error handling for HTTP requests
This patch adds error handling for HTTP requests in hawkbit

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-02-09 16:33:11 -06:00
Dawid Niedzwiecki d1ad180567 ec_host_cmd: improve handling IN_PROGRESS commands
Add the ec_host_cmd_send_in_progress_continue function which allows
continuing execution of a handler, while the ec_host_cmd thread is not
blocked and new commands can be handled.

That means some long command handlers can executed in the background
while the Host Command subsys is not frozen.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2024-01-31 10:34:47 -06:00
Jamie McCrae b26a4bf31c mgmt: mcumgr: grp: img_mgmt: Add optional max image size reduction
Adds an optional feature that can be used to reduce the maximum
allowed image upload file size whereby an image could be uploaded
that would be too large to swap even if it could fit the partition

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-01-30 18:01:24 +01: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
Benjamin Cabé b78bbe409f doc: mgmt/osdp: Fix doxygen comments
- Misc fixes to improperly documented structs
- Show all PD and SC API in docs
- Document enums

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-12-05 16:18:22 -06:00
Juha Heiskanen 07ae06f8fe mgmt: mcumgr: Doxygen tags update
Added a missing defgroup and ingroup for mcmumgr client
and smp client.

Signed-off-by: Juha Heiskanen <juha.heiskanen@nordicsemi.no>
2023-11-20 09:20:25 +01:00
Jamie McCrae 6c4b89cb00 mgmt: mcumgr: grp: os_mgmt: Add datetime get/set functions
Adds datetime set and get functions which allow for setting and
getting the current time to/from the rtc alias device

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-11-13 09:48:13 +01:00
Dawid Niedzwiecki 0aed42f2ee mgmt: ec_host_cmd: improve handling buffer sizes
Add the len_max rx structure member to indicate maximum number of bytes
possible to receive. It is needed to send information about our protocol
parameters to host.

Also, limit the maximum size of request/responses for backends that uses
buffers provided by the handler.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2023-10-27 13:26:00 -05:00
Jamie McCrae c67560cbbd mcumgr: grp: settings_mgmt: Handle settings return values
Handles return values from settings handlers which were missing
and would return "Unknown error" to clients instead of the read
error

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-10-12 11:54:30 +01:00
Jamie McCrae 828940b420 mcumgr: grp: fs_mgmt: Fix error on hash/checksum of empty file
Fixes the error code being returned when trying to perform a
hash/checksum on an empty file to show it is because the file is
empty, not because a paramter (which was not provided) was too
large.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-10-12 11:54:01 +01:00
Chandler Keep 27b4b9f4c8 mgmt/MCUmgr/mgmt: Support for finding registered command groups
This commit adds support for finding registered mcumgr command groups.

By default, supported command groups are local to the namespace where
they're registered. This api addition allows applications to get
reference to these supported command groups to deregister & re-register
them.

This adds scope for applications to support multiple implementations
of a command group alongside the default.

Signed-off-by: Chandler Keep <chandlersamkeep@gmail.com>
2023-09-30 18:48:06 +02:00
Dominik Ermel e48354455a mgmt/MCUmgr/grp/os: Add booloader info support
Adds command allowing to query information on bootloader.
In this case support is provided to query MCUboot information.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2023-09-28 16:27:45 +02:00
Jamie McCrae 0d5c508fc7 mgmt: mcumgr: grp: fs_mgmt: Update file upload errors
Updates possible return errors for fs mgmt file upload, to clarify
when a provided path is on a read-only filesystem or if the mount
point does not exist.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-09-21 11:54:26 +02:00
Dawid Niedzwiecki 340ffe1c48 mgmt: ec_host_cmd: fix struct init order
Order structure members according to the structure definition.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2023-09-21 09:28:59 +02:00
Juha Heiskanen 0c6a3faeb4 mgmt: mcumgr: Image management client fix
Fix broken MCUmgr image group client.

Signed-off-by: Juha Heiskanen <juha.heiskanen@nordicsemi.no>
2023-09-19 15:21:08 +01:00
Kuno Heltborg 2d02cae964 MGMT: Add user data to mgmt_handler
RFC: #60616

Signed-off-by: Kuno Heltborg <kunoh@live.dk>
2023-09-19 15:20:58 +01:00
Jamie McCrae a15752c79c mgmt: mcumgr: Split mgmt defines to new file
This splits defines to a separate file, which are commonly needed
by out-of-tree projects whereby the full MCUmgr include cannot be
used due to undefined types being used.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-09-06 13:03:42 +02:00
Casper Jørgensen 2ad0c90e87 mgmt: mcumgr: smp_dummy: Add missing conditional end bracket
Compiling smp_dummy.h for C++ is currently
not possible due to a missing end curly bracket.

This commit add the missing end bracket on the same
condition as the start bracket is included.

Signed-off-by: Casper Jørgensen <casperej@gmail.com>
2023-09-01 17:44:49 +02:00
Dominik Ermel 5739f2c6da mgmt/MCUmgr/grp/img: Switch to using img_mgmt_get_next_boot_slot
The commit modifies image list command operations to use
img_mgmt_get_next_boot_slot instead of directly relying of
MCUboot flags.
The function is now used, also, by img_mgmt_slot_in_use to
figure out whether queried slot is in use.
The commit introduces two new Kconfig options
 MCUMGR_GRP_IMG_ALLOW_CONFIRM_NON_ACTIVE_IMAGE_SECONDARY
 MCUMGR_GRP_IMG_ALLOW_CONFIRM_NON_ACTIVE_IMAGE_ANY
that allow users to enable confirming non-active images slots.
The MCUMGR_GRP_IMG_ALLOW_CONFIRM_NON_ACTIVE_IMAGE_SECONDARY is y
by default to keep original behavior of logic that accidentally
allowed confirming secondary slot.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2023-08-31 10:19:15 +02:00
Dawid Niedzwiecki 3ec8615e25 mgmt: ec_host_cmd: add missing declaration
Add missing declaration of a function to get the SPI backend.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2023-08-28 10:13:02 +02:00
Jamie McCrae 55527d8733 mgmt: mcumgr: Add settings management
Adds a settings management group to MCUmgr which allows for
manipulation of the zephyr settings from a remote device.
Includes callback hooks to secure access from an application.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-08-25 10:54:06 +01: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
Jamie McCrae 4b9dddcd3a mgmt: mcumgr: grp: os_mgmt: Add force parameter to reset command
Adds the force parameter to the reset command which is now
provided to the callback hook (if enabled).

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-08-04 12:17:07 +02:00
Jamie McCrae 588f6acbd5 mgmt: mcumgr: grp: img_mgmt: Fix not checking write bounds
Fixes an issue whereby the data packets were not checked to ensure
that the client has not attempted to write more data than the size
that was provided in the original upload packet.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-07-31 10:43:54 +02:00
Jamie McCrae 9422fc6e20 mgmt: mcumgr: grp: img_mgmt: Fix not checking image upload size
Fixes an issue whereby upload image size would not be checked in
the first packet of an upload, which would allow an image to be
uploaded until it reached the point of it being too large to
fit anymore.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-07-31 10:43:54 +02:00
Juha Heiskanen d77a657526 mgmt: smp: MCUmgr Client support
MCUmgr client basic implementation for support Image and OS grpup
commands.

Image Group:
* Image state read/write
* Image Upload secondary slot
* Image Erase secondary slot

OS group:
* Reset
* Echo service, disabled by default

Opeartion's are blocked call and cant't call inside worker queue.
IMG and OS need to be SMP client object for transport.

Signed-off-by: Juha Heiskanen <juha.heiskanen@nordicsemi.no>
2023-07-27 14:35:43 +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 7ca7f5a39c mgmt: mcumgr: Use MCUboot bootutil file instead of outdated copy
Uses the MCUboot bootutil image.h file directly instead of an
outdated copy which resides in the zephyr tree.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-07-26 14:32:20 +02:00
Jamie McCrae ee5c9b2629 mgmt: mcumgr: grp: img_mgmt: Add image data written callback
Adds an optional callback upon image data being written, can be
used for syncing or timeout purposes.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-07-20 14:55:46 +00:00
Jamie McCrae 6c541e1af0 mgmt: mcumgr: Add event ID index callback function
Adds a function which gets the callback ID index of a given
event ID.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-07-20 14:55:46 +00: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
Dawid Niedzwiecki c590c5c1ee mgmt: ec_host_cmd: add suppressing commands
Add a feature to suppress commands. The suppressed commands are not
logged on the command reception.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2023-07-14 09:38:20 +02:00
Dawid Niedzwiecki b04692b747 mgmt: ec_host_cmd: add user callback for a new command
Add a user possibility to set a callback for receiving a new function.
It allows instant performing some actions, that need to be done before
context switch.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2023-07-12 09:26:42 +02:00
Dawid Niedzwiecki b6a3254d8b mgmt: ec_host_cmd: verify a command before passing it to handler
Verify validity of a received command before passing it to the general
handler.

It allows performing some actions, right after receiving the command.
The context switch is not needed. Such feature may be needed for
overloaded system, where instant reboot is required.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2023-07-12 09:26:42 +02:00
Dawid Niedzwiecki 1b6d6fb135 mgmt: ec_host_cmd: add function to signal a new command
Add a function to signal a new host command by a backend.

Use a function instead of giving semaphore, because it allows more
actions on rx event, common for all backends.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2023-07-12 09:26:42 +02:00