When using LLVM/Clang, it complains about memcpy() being
casted to (void *):
warning: expression result unused; should this cast be to 'void'? [-Wunused-value]
So change those to (void) instead as the return of memcpy()
is not used anyway.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Algorithm for freeing strdup buffers was only checking if argument
matches address within strdup buffer pool and was attempting freeing
even if format specifier was different than string.
Added fix where also format specifier is checked.
Extended logger test to verify correctness of function which searches
for string format specifiers within a string.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Due to flipped logic is_irq_locked function was returning true then
interrupts were unlocked. Because of that CONFIG_LOG_BLOCK_IN_THREAD
feature was not working correctly and wasn't locking thread context
when log message buffer pool was empty.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
By this commit user gets possibility to register USB
device satutus callback. This callback represents device state
and is added so user could know what happend to USB device.
Callback is registered by providing it to usb_enable()
USB api is extended by this callback handler.
Samples using using USB are by default provide no callback
and the usb_enable() is called with NULL parameter.
Status callback registered by hid class is deleted as now
USB device has global callback for all classes within device.
Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
The purpose of this commit is to prevent user from
calling usb_enable() twice from different contexes.
If for example user configures composite device with hid
and USB uart console (CONFIG_USB_UART_CONSOLE=y)
then introduced mutex will prevent from calling
usb_enable twice and thus lead to undefined behaviour of
usb driver controller.
usb_enable shall always be called once as it refers to usb driver
and for now only one USB driver instance is supported in Zephyr.
This mechanism ensures that.
Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
The test_and_set_bit() should be checking if the flag was *not*
already set, since that's the scenario where we want to call the
status callback.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
The ch pointer is the result of a CONTAINER_OF() operation, so
checking it for NULL is pointless. Additionally, there's no place that
calls this function with chan set to NULL.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Make the channel ops struct const since there really isn't anything
there that needs to change at runtime. The only exception is the L2CAP
shell which was playing with the recv callback, however that can be
fixed by introducing a simple bool variable.
With tests/bluetooth/shell this reduces RAM consumption by 112 bytes
while adding only 16 bytes to flash consumption.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Maintain a simple count of how many PINGREQ have been sent for the
current connection that have not had a corresponding PINGRESP. Nothing
is done with this information internal to the MQTT driver, but it is
exposed to the application layer to monitor as desired.
Signed-off-by: Justin Brzozoski <justin.brzozoski@signal-fire.com>
Ensure that RTT and xtensa_sim backends are using single byte
log_output buffer.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
When in immediate mode ensure that buffering is not used in log output.
Every byte is pushed to the transport.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Remove the 4us advanced radio reception, the implementation
passes all timing conformance tests without this.
This change should reduce some radio power consumption by
avoiding redundant reception duration.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Previously, there were two issues when attempting to use LOG_HEXDUMP_*
from C++:
First, gcc and clang in C mode both allow implicit pointer conversion
by default, but require -fpermissive, which no one should ever use, in
C++ mode. Furthermore, -Wpointer-sign, the warning emitted in C for
convertion between pointers to types of different signedness (e.g. char*
vs u8_t*) is explicitly disabled in Zephyr. Switch the various hexdump
functions to void*, which is guaranteed to work in both languages.
Second, the soon-to-be-standardized C++20 version of designated
initializers requires that the designators appear in the same order as
they are declared in the type being initialized.
Signed-off-by: Josh Gao <josh@jmgao.dev>
If the test exits from some APIs like ztest_test_pass(),
ztest_test_skip(), or a test crashes out, the teardown
function is never run.
Fixes: #16329
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
The commit 8892406c1d ("kernel/sys_clock.h: Deprecate and convert
uses of old conversions") changed code to not use deprecated macro.
Unfortunately there was some changes done to RX TC stats update that
were missing from that commit. This commit fixes the issue and removes
the last user of the deprecated SYS_CLOCK_HW_CYCLES_TO_NS64() macro.
This is follow up to commit 5bbdf56769 ("net: stats: Fix RX time
statistics update") which failed to remove all users of the deprecated
macro.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Based on work by Michael Scott.
Add a new Kconfig knob, CONFIG_LWM2M_IPSO_TIMESTAMP_EXTENSIONS. This
defaults to n. When enabled, various IPSO objects will by default have
the timestamp resource (5518) added to their representations. This can
be turned off on a per-object basis.
The idea of adding timestamp resources was originally suggested by
Hannes Tschofenig on this OMA page:
https://github.com/OpenMobileAlliance/OMA_LwM2M_for_Developers/issues/429
Signed-off-by: Michael Scott <mike@foundries.io>
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
The commit 8892406c1d ("kernel/sys_clock.h: Deprecate and convert
uses of old conversions") changed code to not use deprecated macro.
Unfortunately there was some changes done to RX stats update that were
missing from that commit. This commit fixes the issue and removes use
of the deprecated SYS_CLOCK_HW_CYCLES_TO_NS64() macro.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Follwing the convention in Zephyr, all CMake configuration related to
a module, should be placed within the module repostiory.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Low frequency and high frequency clocks had separate devices
while they are actually handled by single peripheral with single
interrupt. The split was done probably because opaque subsys
argument in the API was used for other purposes and there was
no way to pass the information which clock should be controlled.
Implementation changes some time ago and subsys parameter was
no longer used. It now can be used to indicate which clock should
be controlled.
Change become necessary when nrf5340 is taken into account where
there are more clocks and current approach would lead to create
multiple devices - mess.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Fix LENGTH_RSP and PING_RSP to be send after Encryption
Setup under the cases where LENGTH_REQ or PING_REQ cross-
over with ENC_REQ in the same connection event.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Overlapping Feature Exchange requested by host with
Encryption Setup requested by the application caused the
controller to corrupt its Tx queue leading to Tx Ctrl PDU
buffers from leaking from the system.
Relates to #21299.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit targets solving issue #17731 over the Nordic LL LEGACY
arch of the BLE stack in Zephyr. This functionality is exposed
to the user as HCI Zephyr Command extensions
- BT_HCI_OP_VS_WRITE_TX_POWER_LEVEL
- BT_HCI_OP_VS_READ_TX_POWER_LEVEL
which enable Tx power read/write operations within BLE radio events
on a per role/connection basis.
The functionality is enabled upon the Kconfig advanced configuration
triggered by
- BT_CTLR_TX_PWR_DYNAMIC_CONTROL
depending on the enablement of Zephyr HCI vendor-specific command
extensions.
Signed-off-by: Andrei Stoica <stoica.razvan.andrei@gmail.com>
This commit targets solving issue #17731 over the LL_SW_SPLIT
arch of the BLE stack in Zephyr. This functionality is exposed
to the user as HCI Zephyr Command extensions
- BT_HCI_OP_VS_WRITE_TX_POWER_LEVEL
- BT_HCI_OP_VS_READ_TX_POWER_LEVEL
which enable Tx power read/write operations within BLE radio events
on a per role/connection basis.
The functionality is enabled upon the Kconfig advanced configuration
triggered by
- BT_CTLR_TX_PWR_DYNAMIC_CONTROL
depending on the enablement of Zephyr HCI vendor-specific command
extensions.
Necessary low-level radio HAL functionality and power definitions
are also supplied to address the high-level functionality of
controlling the Tx power.
Signed-off-by: Andrei Stoica <stoica.razvan.andrei@gmail.com>
Fix LENGTH_RSP and PING_RSP to be send after Encryption
Setup under the cases where LENGTH_REQ or PING_REQ cross-
over with ENC_REQ in the same connection event.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Overlapping Feature Exchange requested by host with
Encryption Setup requested by the application caused the
controller to corrupt its Tx queue leading to Tx Ctrl PDU
buffers from leaking from the system.
Fixes#21299.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Backend initialization code has been moved from common settings_init.c
to proper backend source files. Missing static specifiers have been
added.
Minor cleanup has been done to source files: exported functions have
been moved to the end of source files and definitions of static
variables, that are used by only a single function, have been moved from
global scope into functions that use them.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Timestamp and RecordRoute options are supported
in only ICMPv4 EchoRequest call as per
RFC 1122 3.2.2.6.
Fixes#14668
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
IPv4 header options length will be stored in ipv4_opts_len
in net_pkt structure. Now IPv4 header length will be in
net_pkt ip_hdr_len + ipv4_opts_len. So modified relevant
places of ip header length calculation for IPv4.
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
OpenThread recently introduced CMake build system into its repostiory
so we no longer need autotools to build OpenThread libraries and can
integrate them natively.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The TCP code expects that we know when the socket has called accept()
in order to continue connection attempt.
Fixes#21335
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
constexpr and noexcept were introduced as specifiers in C++11. Avoid
referencing them when compiling for earlier versions of the language.
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
In the count_s() function, with -Wchar-subscripts, GCC warns
about array subscript having type ‘char’ with the isalpha()
call. Since isalpha() takes an int, so do a type-cast there
to get rid of the warning.
This happens on XCC which is based on GCC 4.2.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Fix leak of the node_rx buffer when processing the LL version ind as a
priority event. This leak meant being able to establish new connections
was no longer possible, because there weren't enough events to process
the all the events during connection establishment. And instead the LL
ignored the connection request sent by the peer.
Removed the inline extern declaration of a function which had a proper
header included.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This documents the special cases where -EAGAIN is returned which leads
the buffer to be queued.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Now that bt_l2cap_send_cb can fail the buffer state needs to be save
and restored otherwise the data stored on it would be lost.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This introduces BT_L2CAP_STATUS_SHUTDOWN which is used to indicate when
a channel has been shutdown.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Packets shall never fail to be sent now that they are queued, so if an
error occured there is no point in keep the channel connected.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This offloads the processing of tx_queue to a work so the callbacks
calling resume don't start sending packets directly which can cause
stack overflow.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Drop packets received while disconnecting since they would most likely
be flushed once peer respond there is no gain in keeping them on a
queue.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>