Before the fix for #77150 was merged, with LOG_BACKEND_SHOW_COLOR=n and
CONFIG_SHELL_VT100_COLORS=y the shell would still display colors by
enabling the flag in the shell_log_backend.c.
Now, LOG_BACKEND_SHOW_COLOR has to be enabled to allow shell logging
color, but that writes ANSI escape sequences to the log files.
Explicitly disable ANSI color output for the filesystem logging backend.
Signed-off-by: Eric Holmberg <eric.holmberg@northriversystems.co.nz>
If socket call fails when mdns_responder creates listeners, then
print the return value to make it easier to figure out what is
wrong. Typically one needs to increase the size of
CONFIG_ZVFS_OPEN_MAX if errno is ENFILE.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The simple backend returns the size of the credential,
even if it is too big.
The secure backend should do the same,
our libraries depend on this behaviour.
Signed-off-by: Maximilian Deubel <maximilian.deubel@nordicsemi.no>
The help text for connect says
[-b, --band] 0: any band (2:2.4GHz, 5:5GHz, 6:6GHz]
but it disallows setting band to 0. Change this and allow
band 0 option when doing normal connect. Disallow setting
the band 0 when enabling AP mode.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The negative status code is actually the errno which we might
get returned from lower levels. For example if user sets -t
(timeout) option, the -ETIMEDOUT might be returned. In this case
map the errno value to connection timeout status value.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
If "wifi connect" fails, tell user why in textual format.
This helps debugging connectivity issues.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
As MQTT 5.0 allows to specify the disconnect reason in the Disconnect
packet, use this new feature to improve error notification to the
broker, according to the error guidelines in the MQTT 5.0 spec.
For most cases, a generic arbitrary mapping between errno values and
reason codes is used, however the parser can specify the disconnect
reason code manually to better handle certain corner cases (like invalid
topic alias used).
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add support for handling topic aliases received from the broker.
The MQTT client implementation will store received topic for further use
in case consecutive PUBLISH received from the broker contains no topic
but alias only.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add support for a new AUTH message introduced in MQTT 5.0.
This is a new mechanism specified by MQTT 5.0, which allows clients and
brokers for enhanced authentication in between CONNECT and CONNACK
exchange. An additional MQTT event (MQTT_EVT_AUTH) was specified which
is triggered when the AUTH packet arrives from the broker.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add support for DICONNECT message specified in MQTT 5.0.
As with MQTT 5.0, the disconnect can now also be initiated by the
broker, it was needed to add decoder support for the message.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add support for PUBACK, PUBREC, PUBREL and PUBCOMP specified in MQTT
5.0. As all of these acknowledgment packets have similar format,
introduced a common encoder/decoder to handle ACK packets.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add support for PUBLISH message specified in MQTT 5.0. The message
encoder and decoder were updated to support MQTT properties.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add support for CONNACK message specified in MQTT 5.0, along with
property decoders required to decode MQTT properties. Decoded properties
are provided to the application within mqtt_connack_param structure,
accompanying the CONNACK event.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add support for CONNECT message specified in MQTT 5.0, along with
property encoders required to encode MQTT properties which is a new
concept in MQTT 5.0. Connect and will properties can be specified by the
application in the mqtt_client structure before connecting.
Introduce a helper function which allows to verify whether MQTT 5.0 is
used or not, so that it's still possible to use MQTT 3.1 even if MQTT
5.0 support is enabled in Kconfig.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The macro did not take into account the 2-byte binary data length
encoded before the actual binary data.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
It should be possible to select maximum supported MQTT version, so that
for example MQTT 5.0 features can be compiled-out in case they're not
needed.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Previously, PB-GATT unprovisioned advs would continue being sent if a
device is provisioned or in the process of being provisioned (an active
provisioning link) over PB-ADV.
This commit introduces the `link_cancel` callback for the `prov_bearer`
struct. When a provisioning link is established over a prov bearer, all
other (active) prov bearers will be suspended through this callback, and
re-enabled when the link is closed. An exception is made for PB-REMOTE,
which can utilize the other bearers.
The call to `bt_mesh_pb_gatt_srv_disable` in settings.c is removed. This
is called in `mesh_commit`, and is not needed as this is only used
during boot, at which point the Mesh provisioning service has not yet
been enabled/registered, meaning the function does nothing.
Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
Fix ull_hdr_get_cb() for advanced scheduling to return
ticks_slot for Peripheral role.
Relates to commit d6c3e04eb8 ("Bluetooth: Controller:
Central maximum data PDU size time spacing").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
For many devices iSerialNumber is not required. The only device class
currently supported in Zephyr that requires iSerialNumber is MSC. If the
serial number is not available then iSerialNumber must be 0. Failure to
read the string descriptor for non-zero iSerialNumber fails USB Command
Verifier Chapter 9 tests.
When USBD_DESC_SERIAL_NUMBER_DEFINE() was used without CONFIG_HWINFO
then it did lead to runtime failure when requesting the string (thus
failing certification).
Fail USBD_DESC_SERIAL_NUMBER_DEFINE() at build-time if CONFIG_HWINFO is
not set to prevent the surprise at runtime. Only define serial number
descriptors if CONFIG_HWINFO is enabled.
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
added function to calculate antenna path
based on the antenna permutation index and
total number of antenna paths
Signed-off-by: Ivan Iushkov <ivan.iushkov@nordicsemi.no>
Kconfig value LWM2M_ENGINE_MESSAGE_HEADER_SIZE added
an extra headroom for CoAP packet sizes so that
if CoAP Block-Wise transfer block-size is configured
to be same as LWM2M_COAP_MAX_MSG_SIZE, the full
payload block would usually fit to the datagram.
This causes too much confusion to be usable.
CoAP headers and options vary on sizes, and there is
no runtime limitations that we should check the
header size against.
Only real limitation is the CoAP packet size, which
must fit into the UDP datagram with typical DTLS headers.
Only limitation for CoAP block-size then is that
it must fit into the CoAP message with all the headers
and options. But as the option sizes, like path, vary,
it must be checked runtime.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Convert the socket poll logic to use a more lightweight eventfd file
descriptor instead of a socket pair.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Disable/enable endpoints even if the new alternate is the same as the
current one, forcing the endpoint to reset to defaults.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Do not report canceled transfers as an error and continue the transfers
regardless of the previous transfer status.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Move functions `bt_sco_cleanup()`, `bt_conn_create_br()`,
`bt_hci_connect_br_cancel()`, and `bt_conn_get_dst_br()` from `conn.c`
to `conn_br.c`.
Change the function `bt_hci_connect_br_cancel()` to internal public
function.
Add a header file `conn_br_internal.h`. And declare the function
`bt_hci_connect_br_cancel()` in the header file.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Clarifies the use of identity in `bluetooth.h` by specifying whether the
documentation refers to the identity address, i. e. the actual address
`bt_addr_le_t`, or the identity handle, i. e. an index corresponding to
a specific identity address.
Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
if CONFIG_PM=y, board will enter low power,
which will cause problem for debugger.
So for ztest cases, we need enable this to avoid problem.
This used to apply to soc/platform level, now remove them.
Signed-off-by: Hake Huang <hake.huang@nxp.com>
Several members of the ull_hdr can be removed, saving 12 bytes
from all ULL instances used (and a bit of code as well)
ticks_active_to_start is always 0 and can be removed completely
ticks_prepare_to_start is always set to
HAL_TICKER_US_TO_TICKS(EVENT_OVERHEAD_XTAL_US), so replace usage
of it by this constant
ticks_preempt_to_start is always set to
HAL_TICKER_US_TO_TICKS(EVENT_OVERHEAD_PREEMPT_MIN_US), so replace
usage of it by this constant
In addition, remove logic handling usage of XON_BITMASK since it
was only used by the long removed legacy LL
Signed-off-by: Troels Nilsson <trnn@demant.com>
The lost_payloads calculation in ull_conn_iso_start() could easily
end up negative for CIS with FT > 1; Add a check to avoid this
Signed-off-by: Troels Nilsson <trnn@demant.com>
If we end up writing zero bytes to cmux output, we can return
zero instead of -ENOMEM as it would break various modules when
using small buffers. For example modem_chat.c does not tolerate
-ENOMEM but handles zero OK.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Allow configuring MTU for CMUX.
Some AT manual and specification define this as a
frame size. Linux ldattach default to 127 bytes,
3GPP TS 27.010 defaults to 31.
We should limit our CMUX frames to a size that
remote end is capable of handling.
Linux silently drops oversized frames.
Also, remove MODEM_CELLULAR_CMUX_MAX_FRAME_SIZE as
this was only limiting a buffer sizes, and resulted
CMUX frames to be capped to same value.
Use MODEM_CMUX_WORK_BUFFER_SIZE and MODEM_CMUX_MTU instead.
Also rename CONFIG_MODEM_CELLULAR_CHAT_BUFFER_SIZES to
CONFIG_MODEM_CELLULAR_CHAT_BUFFER_SIZE as it is now
only used as a Chat module. DLCI pipes use
CONFIG_MODEM_CMUX_WORK_BUFFER_SIZE.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Use `UINT_TO_POINTER` to convert a number to pointer.
Use `POINTER_TO_UINT` to get a number from a pointer.
Fixes#87527.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
When the GATT server is enabled the proxy advertiser
server need to be stopped. This solved a bug where the
Mesh Proxy Service is not restared.
This fix is done to fix several failing PTS test that
was failing when CONFIG_BT_MESH_ADV_EXT_GATT_SEPARATE
was enabled. Calling the stop_proxy_adv was left out
in a prevouis commit when doing code cleanup.
Signed-off-by: Ingar Kulbrandstad <ingar.kulbrandstad@nordicsemi.no>
The Generic Provisioning protocol requires that a transaction must be
acknowledged before the next Generic Provisioning PDU is processed
(section 5.3.3, MshPRT_v1.1).
In the current PB-ADV implementation, if there is an ongoing transaction
(link.tx.adv points to a valid advertisement), any received Generic
Provisioning Start and Continuation PDUs are ignored.
This creates a scenario where a remote device misses the Transaction
Acknowledgment PDU and retransmits the last PDUs, but they are ignored
by the local device because the local device has already started sending
the next Provisioning PDU.
In particular, in the observed failure, the Provisioner missed the
Generic Transaction Acknowledgment PDU during the transmission of the
Provisioning Data PDU.
This commit modifies the processing logic for Generic Provisioning Start
and Continuation PDUs by checking if the received PDU has already been
received. If so, it attempts to re-send the Generic Transaction
Acknowledgment PDU.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Add support for the IP_MULTICAST_LOOP socket option to control
multicast packet loopback.
Signed-off-by: AbdElRahman Khalifa <abdelrahman.5alifa@gmail.com>
The options for BT_CTLR_CENTRAL_ISO and
BT_CTLR_PERIPHERAL_ISO did not have the proper defaults not
dependencies when BT_LL_SW_SPLIT=y
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Implement Set/Clear Feature endpoint halt request and
fix the corresponding commands in the shell.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
The device command is broken due to the overhaul of how USB devices are
handled in the host stack. Add a device address argument to all device
commands and obtain a pointer to the USB device during command
execution.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Make reading and writing string values more flexible:
1. Eliminate the intermediate buffer when saving a string
setting. This needlessly limited the maximum string
length that could be saved using the shell command.
2. Do not add nor assume that a string saved in the settings
includes the null-terminator. The settings subsystem uses
metadata for encoding the value length, so there it is
redundant to also store the null-terminator in flash.
By the way, also make sure the command handlers only return
-EINVAL and -ENOEXEC error codes as documented in the
handler type description.
Signed-off-by: Damian Krolik <damian.krolik@nordicsemi.no>
When loading an extension, read-only sections that do not have
relocations and whose data is accessible from the ELF buffer can be
directly mapped as-is in the extension memory. This avoids the need to
allocate and copy unmodified data from the ELF buffer to the LLEXT heap.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
This patch moves the alignment checks for MPU and MMU regions to the
beginning of the llext_copy_region() function. This is done to ensure
that the correct region alignment and size are used even in the case
where the region is reused from the ELF file buffer, avoiding MMU/MPU
configuration issues.
This also relaxes the same checks for regions that are accessed by the
kernel only (e.g. symbol and string tables), which do not need special
MMU/MPU treatment. This exposed an inconsistency in the MMU code, which
was setting the permission on the correct regions, but later restoring
the default permissions on every region, including the now-unaligned
ones.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
This patch introduces an 'enum llext_storage_type' that defines the
storage type of the ELF data that will be loaded:
- LLEXT_STORAGE_TEMPORARY: ELF data is only available during
llext_load(); even when the loader supports directly accessing the
memory via llext_peek(), the buffer contents will be discarded
afterwards.
LLEXT will allocate copies of all required data into its heap.
- LLEXT_STORAGE_PERSISTENT: ELF data is stored in a *read-only* buffer
that is guaranteed to be always accessible for as long as the
extension is loaded.
LLEXT may directly reuse constant data from the buffer, but may still
allocate copies if relocations need to be applied.
- LLEXT_STORAGE_WRITABLE: ELF data is stored in a *writable* memory
buffer that is guaranteed to be always accessible for as long as the
extension is loaded.
LLEXT may freely modify and reuse data in the buffer; so, after the
extension is unloaded, the contents should be re-initialized before a
subsequent llext_load() call.
To keep full compatibility with existing code, the storage type of
LLEXT_BUF_LOADER is determined by the CONFIG_LLEXT_STORAGE_WRITABLE Kconfig
option between LLEXT_STORAGE_PERSISTENT and LLEXT_STORAGE_WRITABLE.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
Adding this information allows easy cross-reference of the effects of
memory optimization changes between subsequent commits.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
Following warning is printed if using strncpy(), so use memcpy()
instead. Note that this is false positive as there is no error here but
in order to avoid the warning, change the copy function.
subsys/net/lib/dns/mdns_responder.c:1371:25: warning:
'strncpy' output may be truncated copying 7 bytes from a string
of length 8 [-Wstringop-truncation]
1468 | strncpy(if_req.ifr_name, name, sizeof(if_req.ifr_name) - 1);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
subsys/net/lib/dns/mdns_responder.c:1468:25: warning:
'strncpy' output may be truncated copying 7 bytes from a string
of length 8 [-Wstringop-truncation]
1468 | strncpy(if_req.ifr_name, name, sizeof(if_req.ifr_name) - 1);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>