Use platform_whitelist to specify supported boards to make sure
mem_domain_apis_test sample will be built during sanitycheck.
Signed-off-by: Chunlin Han <chunlin.han@linaro.org>
Set Vendor and Product ID originally present in the firmware.
Implemented USB function is the same: CDC ACM serial port.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Vendor ID and Product ID should be assigned on build time by
respective process.
For sanity check we assign some random values which are only used for
build tests and should not be used for real products.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
The stack of rd client is exhausted while running lwm2m client w/ IPv6
and network log global enabled. Increase the stack size to 1536 when
NET_LOG_GLOBAL is enabled.
Detail described at #4424
Signed-off-by: Robert Chou <robert.ch.chou@acer.com>
".well-known/core" is mainly used with method GET for performing the
resource discovery (RFC 6690). Since we are implementing a LwM2M client
and is not implement a resource directory which allow others to do the
resource registration (POST to .well-known/core). Only GET method is
allowed for the usage. Report 4.5 (Method Not Allowed) if other methods
are requested.
Signed-off-by: Robert Chou <robert.ch.chou@acer.com>
Modify zoap_options_to_path() to return error when URI contains
character other than digits and return 4.04 NOT FOUND to caller.
PATH such as "/1a/2/3" was treated as "/1/2/3" after parsring
which is incorrect.
Signed-off-by: Robert Chou <robert.ch.chou@acer.com>
Return 4.05 Method Not Allowed when path is empty ('/') to the
caller for it's only use by bootstrap delete. This change also avoid the
empty path being treated as request targeted at 0/0/0.
Signed-off-by: Robert Chou <robert.ch.chou@acer.com>
1) Respond NOT FOUND to caller when object doesn't exist
2) Report as internal server error when OP not handled
Signed-off-by: Robert Chou <robert.ch.chou@acer.com>
Such option should be use carefully. Printing out in/out packets is
extremely verbose.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
If the pkt is corrupted and the offset would be larger than
the actual packet length, then print information about that and
drop the packet.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
It's been observed that that the relay toggling functionality is not
very useful, and that it's better left enabled always. Change the
purpose of the second button to instead modify the target address that
messages sent through the first button get directed to. By default the
destination is the group address, i.e. all nodes receive the message.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
arg6 is treated as a memory constraint. If that memory
address was expressed as an operand to 'mov' in the generated
code as an offset from the stack pointer, then the 'push'
instruction immediately before it could end up causing memory 4
bytes off from what was intended being passed in as the 6th
argument.
Add ESP register to the clobber list to fix this issue.
Fixes issues observed with k_thread_create() passing in a
NULL argument list with CONFIG_DEBUG=y.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
When k_poll is being used k_queue_cancel_wait shall mark the state as
K_POLL_STATE_NOT_READY so other threads will get properly notified with
a NULL pointer return.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
In case _handle_obj_poll_events is called with K_POLL_STATE_NOT_READY
set -EINTR as return to the poller thread.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
k_queue_get shall never return NULL when timeout is K_FOREVER which can
happen when a higher priority thread cancel/take an item before the
waiting thread.
Fixes issue #4358
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This sends out 2KB+ payload (i.e. guaranteedly more than 1 network
packet). When this sample was initially written, using such payload
quickly let to a deadlock somewhere in the network stack. However
as of now, running with such payload can sustain testing with
"ab -n10000" (10000 consecutive HTTP requests using Apache Bench),
so set is as a default, to serve as a mark point against possible
future regressions.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
This is a runtime counterpart to K_THREAD_ACCESS_GRANT().
This function takes a thread and a NULL-terminated list of kernel
objects and runs k_object_access_grant() on each of them.
This function doesn't require any special permissions and doesn't
need to become a system call.
__attribute__((sentinel)) added to warn users if they omit the
required NULL termination.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
It's possible to declare static threads that start up as K_USER,
but these threads can't do much since they start with permissions on
no kernel objects other than their own thread object.
Rather than do some run-time synchronization to have some other thread
grant the necessary permissions, we introduce macros
to conveniently assign object permissions to these threads when they
are brought up at boot by the kernel. The tables generated here
are constant and live in ROM when possible.
Example usage:
K_THREAD_DEFINE(my_thread, STACK_SIZE, my_thread_entry,
NULL, NULL, NULL, 0, K_USER, K_NO_WAIT);
K_THREAD_ACCESS_GRANT(my_thread, &my_sem, &my_mutex, &my_pipe);
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
The main purpose of recv_thread is to process incoming events from the
radio and also any buffered items waiting to be dispatched to the Host
and that are pending because of lack of Host buffers.
When an iteration of the recv_thread obtains a element from the radio it
needs to process it immediately, either sending it straight away to the
Host or appending it to the queue. This was not the case before this
patch, where the concurrency of a buffered packet with one coming from
the radio would cause the latter to be "dropped", causing missing
packets.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Applications may want to be notified when various events
happen in the LwM2M rd client. Let's implement an event
callback which sends: connect, disconnect and update events.
Signed-off-by: Michael Scott <michael.scott@linaro.org>
CoAP allows a proxy to be used when transferring data (CoAP-CoAP and/or
CoAP-HTTP) by creating request on a specific URI path and by using the
Proxy URI CoAP option. Create specific Kconfig options for the proxy
server address and port, until a parser gets implemented.
Code tested with Californium acting as CoAP proxy.
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
[michael.scott@linaro.org: rebased on net_app + lwm2m_message
refactoring + firmware update changes.]
Signed-off-by: Michael Scott <michael.scott@linaro.org>
During firmware download via block-wise transfer, we can see
packets occaionally get re-transmitted (normal logic in the
pending / retry functions). However, both of these packets
end up coming through the reply handler and we should ignore
any block-wise transfer that has a current value less than
where we expect to be.
NOTE: This fixes K64F ethernet transfers where we were getting
too many packets back in the handler.
Signed-off-by: Michael Scott <michael.scott@linaro.org>
UDP packets can be lost in heavy traffic. Normally we can handle this
with pending packet processing for packets which have not been responded
to with an ACK. However, due to the time it takes for firmware to
download via CoAP, an extra level of retries should be added.
The process works like this:
Normal pending packets will try to send 3 times fairly quickly.
If that fails, then the timeout callback is called for the firmware
download process. A retry counter is incremented and the timeout
callback perform a new packet send of the block-wise transfer
packet that is missing, until the retry counter hits a limit (3)
and then the transfer is aborted.
This allows for a longer "outage" to happen during firmware transfer
and the process can still succeed.
NOTE: This patch does not fix a current bug where the pending process
is not re-sending the packets correctly, it only makes the process
more stable with a better chance to work.
Signed-off-by: Michael Scott <michael.scott@linaro.org>
When a packet expires after the pending retries we call
lwm2m_release_message() to free up resources. This includes
cleanup of the pending structure which calls net_pkt_unref on
the pending packet. This would normally free up the packet
memory. However, earlier in the pending processing we add a ref
to the packet so that normal send processing doesn't free up
the memory. This meant we were leaking packet memory every
time we had an expiration due to timeout.
Let's do an unref prior to calling lwm2m_release_message() to
make sure the packet memory is freed correctly.
Signed-off-by: Michael Scott <michael.scott@linaro.org>
Previously, firmware support wasn't initializing the retransmit work
or the extra network packet pools. Let's fix that.
NOTE: While this fixes the setup of retransmit work, the actual
attempts to re-send packets which are pending is failing. Needs
another follow-up fix.
Signed-off-by: Michael Scott <michael.scott@linaro.org>
Create an internal function lwm2m_engine_context_init() which sets
the extra packet pools and initializes retransmit work internal to
the LwM2M engine.
This function will be used by firmware pull support which establishes
a new LwM2M context for downloading firmware.
Signed-off-by: Michael Scott <michael.scott@linaro.org>
In the case of a proxy server translating HTTP -> COAP (known in
the code as "separate reply"), we were leaking lwm2m_message structures.
This was due to pending objects being cleared out during the first ACK,
and no other way of finding a matching message when the follow up packet
was received. Let's add a second match for reply to make sure we can
find our matching message resources.
NOTE: This change renames find_msg_from_pending() to find_msg() and
makes it a static function as it's only used by the lwm2m_engine.
Signed-off-by: Michael Scott <michael.scott@linaro.org>
This is a useful message announcing that the RD client state machine
is starting for a particular connection. If the log level is set
low so that DBG messages are hidden, then this message goes away.
Signed-off-by: Michael Scott <michael.scott@linaro.org>
1. Add handling block1 option in handle_request(). The basic idea is
to declare structure block_context at compiled time and use "token"
as a key to pick up the on-going block cotext. It should be able to
support multiple blockwise transfer concurrently
2. Use write callback implemented in lwm2m_obj_firmware to deal w/ the
update state transition and than call the callback registered by the
application
3. move default_block_size to lwm2m_engine.c to share between
lwm2m_engine and lwm2m_obj_firmware_pull
Signed-off-by: Robert Chou <robert.ch.chou@acer.com>
[michael.scott@linaro.org: rebased on LwM2M net_app changes.]
Signed-off-by: Michael Scott <michael.scott@linaro.org>
OPAQUE resource type might/might not have data_ptr/data_len setup
depending on the implementation. This introduce an issue that when
OPAQUE resource is written from the server side, the ones w/ none
setup will not be able to get the data at post_write_cb()
Modify to setup data_ptr/data_len as incoming buffer and buffer size
Signed-off-by: Robert Chou <robert.ch.chou@acer.com>
1. Parse firmware pull URI
2. Add lwm2m_firmware_get/set_update_cb() for application to register
callback. This is because we want to check the update_state before
we pass to the application
3. Add lwm2m_firmware_get/set_update_result() and
lwm2m_firmware_get/set_update_stat() to manage the state transition
as well as the sanity check
Signed-off-by: Robert Chou <robert.ch.chou@acer.com>
[michael.scott@linaro.org: rebased on net_app framework and
lwm2m_message refactoring.]
Signed-off-by: Michael Scott <michael.scott@linaro.org>
With future patches we will need to parse URLs in the registration
client and firmware object. Enable it by default when LWM2M is
enabled.
Signed-off-by: Michael Scott <michael.scott@linaro.org>
There was a missing net_buf_unref() for the response to reading the
controller static addresses.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Based on the feedback, uses conventional spelling for "thread safe"
and also add notices more consistently.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>