The SD Card Physical Layer specification states in Table 7-1
(in section 7.3.1.1) that the LSB of the 48 bit command must
be set to 1 to act as an 'end bit'.
Fixes#33479
Signed-off-by: Rich Barlow <rich@bennellick.com>
Kconfig option USB_HID_PROTOCOL_CODE does not allow to set
boot interface protocol code for specific HID device but
only to set the same value for all device.
Add new API function to allow the application to set
Protocol Code per device. Deprecate USB_HID_PROTOCOL_CODE option.
Fixes: #32778
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Fix control Tx buffer leak into data Tx pool that happens
after a cross-over control procedure response was paused due
to currently active encryption setup procedure, and a new
control Tx PDU in addition to the paused one is enqueued
thereafter.
When the control tx PDUs is resumed but not yet enqueued
towards the radio, if there is a new control Tx PDU enqueued
then the paused control Tx PDU is not set as the head of the
control PDUs in the Tx queue. This caused the paused control
Tx PDU to be associated with data Tx pool, hence causing the
incorrect release into data Tx pool.
Relates to the commit bff76b4cce ("Bluetooth: controller:
split: Fix control tx queue handling") and to the
commit 6991d09977 ("Bluetooth: controller: Fix control tx
queue handling").
Fixes#32898.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Remove the redundant connection initiated check as the event
is closed on connection initiated and it is sufficient to
check in the prepare_cb function to abort any events in the
pipeline after the connection has been initiated.
Relates to commit 5ce5dc055e ("Bluetooth: controller:
Avoid race between ULL and LLL when initiating conn") and
commit 18f5fb99c1 ("Bluetooth: controller: Remove use of
lll_stop").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Building this file with CONFIG_COVERAGE=y and CONFIG_SHELL_LOG_BACKEND=n
fails on the llvm-clang compiler. Swapping the IS_ENABLED and
log_backend allows the compiler to optimize out the if block even with
coverage enabled.
Signed-off-by: Jeremy Bettis <jbettis@chromium.org>
Use the channel identifier calculation function in the
central and peripheral implementation.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Added function to calculate channel identifier value
required for Channel Selection Algorithm #2.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
The payload of the Register/Register Update message is also formatted as
application/link-format. Therefore it's reasonable to reuse the new
content writer instead of filling the payload manually.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit adds a new content writer, application/link-format, which
can be used during the Discovery procedure, to fill the content of the
response payload.
Introducing this new content writer, which encapsulates some of the
details like attribute handling which is different for bootstrap/regular
discovery, allows to unify the discovery handler in the lwm2m_engine,
thus it's no longer needed to have spearate handler functions for
bootstrap/regular discovery.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
`.well-known/core` resource is described by the CoAP RFC as an optional
method of resource discovery. The LwM2M specification though makes no
mentionon about this mechanism and provides an alternative method of
resource discovery instead (Device Management Discover, sec 5.4.2, and
Bootstrap Discovery, sec 5.2.7.3).
Since LwM2M does not require to implement `.well-known/core` resource
and it complicates the existing Discovery mechanism (and likely cause a
security concern) remove its handling from the LwM2M implementation.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Introduce LwM2M engine helper functions that allows to work with LwM2M
attributes outside of lwm2m_engine.c.
This is a groundwork for application/lwm2m-format content writer.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
There's no need to duplicate the linker section for each architecture.
Instead, move the section declaration to common-rom.ld.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
The exported structures that were originally introduced for OpenOCD have
since then been reused for other debugger plugins, including PyOCD and
Segger J-Link.
Rename the Kconfig option and the implementation from openocd to debug
thread info, so that it reflects the fact that this is no longer
specifically tied to OpenOCD.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
A bunch of commands were missing from the bitmap in the Read Local
Supported Commands response. Add them accordingly.
Fixes#33324.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Ignore connection indications from peers that are already
connected. This is to bring the behavior of the controller in
accordance with [5.2, Vol 6, Part B, 4.5 Connection state]:
"If an advertiser receives a connection request from an initiator it
is already connected to, it shall ignore that request."
Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
Rename the peer's address in the advertising set struct from `id_addr`
to `peer_addr` to clarify what the address refers to.
Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
When recvfrom() was called with src_addr != NULL, then source address
was fetched from beginning of net_pkt. This works with native IP stack
obviously. However with offloaded IP stack there is no IP header, so
trying to parse missing IP header results in undefined behavior.
Check if network interface has offloaded IP stack. If positive, then
figure out if there is assigned remote address to network context on
which packet was received. Return this remote address, which SHOULD be
the source address of received packet. Otherwise, return an error.
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
Fix regression is central only builds when CONFIG_BT_PRIVACY and/or
CONFIG_BT_EXT_ADV is enabled, or the functions bt_id_reset or
bt_id_delete is called from application.
This resulted in build error for undefined functions
bt_le_ext_adv_foreach and bt_le_adv_lookup_legacy since the definition
for these functions are now only compiled in when CONFIG_BT_BROADCASTER
has been enabled.
Regression from:
53cea4719d
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Fix CONFIG_BT_HCI_ACL_DATA_SIZE default value set to 0 when data length
feature in the controller is not enabled. In this case the default value
will be set to 0 which is outside of the range specified for the option.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Move access to volatile variable out of assertion to avoid warnings
about side effect in assertion.
Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
Add hci_driver.h to include files in id.c to ensure that prototype for
bt_read_static_addr is visible. This fixes builds that define
CONFIG_BT_CTLR but not CONFIG_BT_HCI_VS_EXT.
Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
HID core implementation has support for Get/Set Idle requests and
on idle report processing. Basically it has little use.
Also, it has no users in the tree except samples/subsys/usb/hid,
which does not have it turned on.
There are several issues with the idle report implementation:
- Core calls hid_ops.on_idle callback with Report ID 0,
but this ID is reserved and should not be used.
Report descriptors do not use Report ID index zero.
- Calling hid_ops.on_idle with Report ID 0 cann only
be turned off by calling SetIdle(Duration = 0, Report ID = 0),
but not by SetIdle with Report ID not equal zero.
- GetIdle with Report Id not equal zero returns wrong
value after SetIdle(Duration = n, Report ID = 0)
- It may happen that hid_ops.on_idle is called for
different Report ID during one and the same SoF event.
But there can be only one hid_int_ep_write() during a frame.
This patch fixes listed issues and revises Get/Set Idle request,
and hid_sof_handler() implementation.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Moved the call to obj_id_to_index such that we can check for valid
ID before getting the index.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Adds a ots_obj_manager function that returns true if the object is
in the object manager, or false otherwise.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The directory listing object is an internal object which
content is the aggregation of all the metadata of all objects
(including the directory listing object itself). The client
can read this value to get a list of all objects with names,
lengths, and other metadata.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The order of Destination CIDs shall correspond the order of Source CIDs
including its amount so errors that don't result in all connection being
refused shall not break the order of CIDs.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
For errors that means all connections have been refused there is no need
to add dcids since none will be valid.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
When receiving L2CAP_CREDIT_BASED_CONNECTION_REQ the remote may request
more channels than allowed so this checks if amount of channel surpasses
the maximum channels (5) and return an error.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Adds a Proxy callback structure with a callback for Node ID enable and
disable. This API follows the Friend and LPN API pattern in mesh/main.h,
and can be expanded with more callbacks later.
Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
Fix an assertion when disabling Extended Advertising with
auxiliary PDUs. Stop the auxiliary PDU scheduling after the
primary PDU scheduling is stopped first. This will avoid the
assertion caused due to a search for a stopped auxiliary PDU
offset by the primary PDU scheduling that is being stopped.
Fixes#32866.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
When using `OPENTHREAD_ECDSA` deterministic variant has to be
enabled after some OpenThread changes. Also generic public key
functions are required.
Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
Add locking when accessing interface list and the DHCPv4 config
struct that is found in net_if.
Fixes#33348
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
We need to do a few things differently if we are to support
a virtual memory map, i.e. CONFIG_MMU where CONFIG_KERNEL_VM_BASE
is not the same as CONFIG_SRAM_BASE_ADDRESS.
- All sections must be specified with a VMA and LMA, where
VMA is the virtual address and LMA is the physical memory
location.
- All sections must be specified with ALIGN_WITH_INPUT to
keep VMAs and LMAs synchronized
To do this, the existing linker macros need some adjustment:
- GROUP_LINK_IN undefined when CONFIG_KERNEL_VM_BASE is not
the same as CONFIG_SRAM_BASE_ADDRESS.
- New macro GROUP_ROM_LINK_IN for text/rodata sections
- New macro GROUP_NOLOAD_LINK_IN for bss/noinit sections
- Implicit ALIGN_WITH_INPUT for all sections
GROUP_FOLLOWS_AT is unused anywhere in the kernel for years
now and has been removed.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Replace a development assertion in the implementation of
Connection Parameter Request Procedure with an internal
comment and handle transaction violation be ignoring the
PDU.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix the leak of node rx buffer used to generate the
connection complete and CSA#2 event introduced in the
commit 4a5f263e5a ("Bluetooth: controller: split: Validate
chan map and hop value") and the
commit 94d5f0854e ("Bluetooth: controller: fixing error
re. all zero chmap in conn-ind").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Switch to the new API for delayed work related to DNS queries.
In the previous solution it was assumed that the work item could be
immediately cancelled at the point the query slot was released. This
is not true. We need a secondary condition to record the fact that
the query was completed while the work item was still pending, and an
additional check to detect when the work item completed and the slot
reclaimed.
Also annotate functions to indicate when they require the lock on
query content to be held, add some helpers that abstract core
operations like invoking a callback or releasing a query slot, and fix
some more cases where query slot content was accessed outside of the
new lock infrastructure.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Instead of silently closing the link we should send a Link Close message
three times before resetting provisioning state.
From Mesh Profile Specification v1.0.1.:
```
5.3.1.4.3 Link Close message
The Link Close message is used to close a link.
```
```
5.3.2 Link Establishment procedure
The device shall start the link timer, set to 60 seconds, when the link
is open. When the link timer expires, then the device shall close the
link.
```
```
5.3.3 Generic Provisioning behavior
If the sender does not receive a Transaction Acknowledgment message
within 30 seconds after sending the first message in a transaction,
the sender shall cancel the transaction, cancel the provisioning
process and close the link.
```
From Mesh Profile Test Specification p6:
```
MESH/PVNR/PBADV/BV-01-C
Test Procedure:
[...]
6. The IUT is induced to send a Link Close message with the Reason field
set to 0x02 to terminate the link. The message is sent at least three
times to ensure the message is received by the Lower Tester.
```
Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
Refactor out the BR/EDR handling from hci_core.c to its own source file
in br.c.
BR/EDR consists of inquiry and discovery roles in addition to
initialization. SSP is still kept separate.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Align the SSP HCI event handlers with the rest of the functions in using
the bt_ prefix. In order to avoid name conflict with the HCI struct
definitions the infix _evt_ has been dropped.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Fix compilation error with BR/EDR is enabled but the feature
CONFIG_BT_KEYS_OVERWRITE_OLDEST is disabled.
This caused compilation error because the field aging_counter is not
defined in the keys struct.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>