Move ec_host_cmd.h out of the top level include/ dir into
include/mgmt/ec_host_cmd.h and deprecated the old location.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Fixing problem where k_fifo functions have been used to get/put
data from/info net buf, where documentation has been strictly
forbidding so.
Found, reported and solution suggested by jrhees-cae.
Fixes: #32579
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
hwinfo_get_define_id returns and ssize_t with the size og the copied
id in case of success or negative value otherwise.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
hwinfo_get_define_id returns and ssize_t. Positive value with the
size of the copied id in success or a negative value in case
of error.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
A previous check and return for (maxlen <= 0) makes manlen at least 1 so
checks for (maxlen < 1) would never evaluate to true. Remove these
checks and merge those cases into one.
CID: 215392
Fixes: #33092
Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
This patch replaces magic numbers with COAP_TOKEN_MAX_LEN value and
removes unnecessary castings of token buffer type.
Signed-off-by: Hubert Miś <hubert.mis@nordicsemi.no>
RFC 7252 (CoAP) specifies value of the Version (Ver) field in the
protocol header to value 1. This patch defines value of the Version
field to make packet initialization easier. All samples and tests
are updated to use the new COAP_VERSION_1 field when initializing
a CoAP packet.
Signed-off-by: Hubert Miś <hubert.mis@nordicsemi.no>
CoAP protocol defines registry of Content-Format option values.
This patch adds this enumeration to coap header file to make it
available to all applications using CoAP protocol. It modifies
code using CoAP service to use new enumeration.
Signed-off-by: Hubert Miś <hubert.mis@nordicsemi.no>
The commit adds Kconfig option:
CONFIG_IMG_MGMT_REJECT_DIRECT_XIP_MISMATCHED_SLOT
that enables verification of base address Direct-XIP binary, upon
upload, and rejects binaries that would not be able to start from
available address.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Remove NET_CONFIG_SETTINGS Kconfig option. The net settings should
be enabled from now at project config or at any overlay. This is
necessary to allow better control when application should start.
Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
Current logs only prints default logs level. Add LOG_LEVEL at updatehub
to switch to another variation based on CONFIG_UPDATEHUB_LOG_LEVEL.
Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
Put everything inside an if, we should not see anything related to
hawkbit in generated .config if it is not enabled.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Put everything inside an if, we should not see anything related to
updatehub in generated .config if it is not enabled.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The commit removes a leftover configuration of the log management that
has never worked and has been removed with the commit
0bb466c34e4fe863733a929baa8f51981263ce3d to apache/mynewt-mcumgr.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
This configuration is be required to enable the shell management
command handler supported by the core mcumgr library
Signed-off-by: Brian Bradley <brian.bradley.p@gmail.com>
When building the osdsp control_panel sample we get the following
compile error:
subsys/mgmt/osdp/src/osdp_cp.c:993:10: error: implicit declaration of
function 'osdp_cp_send_command_keyset'
Fix by adding ifdef protection around the call to
osdp_cp_send_command_keyset
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
When waiting for data from CP, the data timeout check must happen before
no-data check. If not, a partial packet may endlessly hold PD in
"wait-for-data" state, while the PD keeps reporting status as online
till another packet is received.
Fix this my moving no-data check below the timeout check.
Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
All OSDP packets must start with a mark byte (0xFF) followed by a Start
of Message byte (0x53). Skip all bytes received until such a sequence is
seen to to avoid waking up the refresh thread needlessly.
Also, refactor osdp_uart_isr() to reduce number of local variables.
Fixes: #28168 Coverity-ID: 214218
Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
Minimize number of exported methods by unifying all osdp_cp_send_cmd_*()
as osdp_cp_send_command().
Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
OSDP secure channel require a truly random number generator
source. Make this dependency explicit.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This patch adds Secure Channel capabilities to osdp Control Panel and
Peripheral Device modes.
Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
With only single RX buffer there is a high chance that such buffer will
not be processed before new bytes come in over UART. This is why it is
good to have at least two buffers, one which can be processed by SMP
layer, while another is being filled with new incoming bytes.
Add Kconfig option which allows to configure multiple buffers filled
with received UART SMP fragments. Use default value of 2, so we can
safely process already received frame in thread, while new fragment
comes in concurrently.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
So far there was a simple char array used as buffer, with additional
variable representing number of bytes already written into it. After
full frame was written, a boolean flag was simply set to notify thread
about being ready to be processed. There was however no mechanism
implemented to prevent new incoming bytes from overwriting such buffer
before (or during) being processed.
Use net_buf to store temporary frame. Define dedicated net_buf_pool,
from which such buffer will be allocated and freed after being
processed. This will prevent from reusing the same buffer before having
it fully processed (and returning once again to available buffer pool)
in shell thread.
Define also fifo that will store buffers that are ready to be
processed. This will be the mechanism for notifying thread about new
UART SMP fragments.
net_buf pool and k_fifo are used on purpose, keeping in mind their
additional overhead (mostly in RAM/ROM usage). This makes the code ready
for increasing number of buffers if needed. In this commit however we
stick with only 1 buffer, to keep minimal changes in processing flow.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
Replace all calls to the assert macro that comes from libc by calls to
__ASSERT_NO_MSG(). This is usefull as the former might be different
depending on the libc used and the later can be customized to reduce
flash footprint.
Signed-off-by: Xavier Chapron <xavier.chapron@stimio.fr>
osdp_build_ctx() was returning fixed NULL and the subsequent code did
not check if ctx was NULL due to osdp_build_ctx() failures. Fix both
these issues.
Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
Coverity spots that null pointer is passing to flash_img_buffered_write.
This patch fixes the problem.
Signed-off-by: NavinSankar Velliangiri <navin@linumiz.com>
Coverity spots that memory allocated for addr was leaking, but the
code was also leaking the socket file descriptor in the error path.
This patch fixes both problems.
Fixes#28172
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
CP/PD mode selection is the most frequently looked-for/changed key in
Kconfig. Making that as the first entry for ease of use.
Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
OSDP subsys was doing a `select SERIAL` in its Kconfig. But this has
other unintended side effects. Change this to
`imply SERIAL_SUPPORT_INTERRUPT`.
Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
Add a generic host command handler framework that allows users to
declare new host command handlers with the HOST_COMMAND_HANDLER macro
at build time. The framework will handle incoming messages from the
host command peripheral device and forwards the incoming data to the
appropriate host command handler, which is looked up by id.
The framework will also send the response from the handler back to the
host command peripheral device. The device handles sending the data on
the physical bus.
This type of host command communication is typically done on an embedded
controller for a notebook or computer. The host would be the main
application processor (aka AP, CPU, SoC).
Signed-off-by: Jett Rink <jettrink@google.com>
Currently updatehub trust on MCUboot to test a new image. The process
is executed on next boot after a validate the downloaded image. To
have a more reliable system, is recommended run the SHA-256 algorithm
to attest that firmware was properly stored on the flash memory. This
implements the use of flash_img_check to achieve that, and as a
consequence, add a new level of trust that avoids an useless reboot
on the system.
Updatehub uses two SHA-256 verification. One is used to check the
data stream at download. The second one, realise the verification
reading from flash. Users have the possibility to chose only one
option or keep both verifications. However, it is adviced keep
always both verifications enabled to get consistent reports on
back end.
Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
Currently SHA-256 uses a temporary hash digest to calc final sha sum.
This moves temporary variable from local scope to updatehub context.
The motivation is to use the hash digest on future flash validation.
Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
Some of the names used in `struct osdp_cmd` where directly as in the
specification. Initially it appealed to keep them like that but with
time, a little more consistent naming of members helps if you haven't
read the specification document very recently.
Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
Add a OSDP CP mode sample that sends out a periocic command to a
connected PD. It also demosnstrates key press and card read callback
registration.
Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
Following the PD mode implementation (9a91b4ad), this patch adds support
for CP mode of operation in OSDP.
Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
Some PD init sequence and other methods are useful in CP mode as well.
This patch refactors those methods to osdp_*(), moves them to common
source files and and exposes them from osdp_common.h.
Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
The smp_shell_rx_byte has been renamed to smp_shell_rx_bytes and now
accepts data buffer pointer and its size as parameters. Return value
has been changed to size_t and represents number of bytes processed from
the given buffer.
The change has been done to more efficiently serve most common scenario
when the function is called in loop to process buffer, byte by byte.
Previously such operation required passing each byte separately,
with the change the function will work directly on source buffer
reducing number of calls and byte copy operations.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
SERIAL_HAS_DRIVER and UART_INTERRUPT_DRIVEN should be selected by the
driver. If something needs is should dependson these options.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>