When try to enable CONFIG_DEVICE_POWER_MANAGEMENT for a board,
the #error directive in subsys/power/device.c requires that
"MAX_PM_DEVICE" and "core_devices[]" must be defined exactly in that
file, or a compile error will come up.
For flexibility, this patch move "PM_MAX_DEVICE" to Kconfig and define
a weak version of "z_mp_core_devices[]", so any board or SOC can define
these varibles in their own module.
Signed-off-by: Meng xianglin <xianglinx.meng@intel.com>
The timeout variable in `dtls_rx()` was initialized improperly.
Coverity ID: 214219
Fixes#28161
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The default string representing Sensor Type resource in Generic IPSO
object would not fit into the predefined buffer. Increase the buffer
size and add extra BUILD_ASSERT to detect this situation.
Coverity ID: 214225
Fixes#28164
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The timeout log error message condition in wrong. When the timout
happens the "count == -1" and the condition is invalid.
This commit fixes it.
Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
is_ep_valid() function was incorrectly searching through
all used endpoints. All endpoints for class must be checked
if they match requested endpoint.
Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
Added a Kconfig option to enable scanner with unreserved
scan window when in continuous scan mode. This will permit
scanner to be always pre-empted by other roles, making it
the lowest in priority when it comes to using the radio.
Fixes#27414.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add timing functions and APIs. This is now used with some of the tests
we have for performance and metrics and will be used whereever timing
informations are needed, for example for tracing, profiling and other
operations where timing info is critical.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The sdhc_spi_write_multi function is sending the CMD25
for multiple block write operation on the SD card
instead of looping the CMD24. This is improving
the transfer speed compared to the sdhc_spi_write function
when the nb of blocks to write is significant (more than 2).
Signed-off-by: Francois Ramu <francois.ramu@st.com>
This introduces bt_gatt_attr_get_handle which can be used to resolve
handles of static attributes.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Make it actually give the original pointer to the attribute and its
resolved handle so static attributes don't need an extra lookup.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This optimizes the lookups to skip ahead when attribute pointer is not
located within service array.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This adds iso shell module which we can be used to exercise ISO related
APIs:
iso - Bluetooth ISO shell commands
Subcommands:
bind :[dir] [interval] [packing] [framing] [latency] [sdu]
[phy] [rtn]
connect :Connect ISO Channel
listen :[security level]
send :Send to ISO Channel
disconnect :Disconnect ISO Channel
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This adds supports for ISO packets so then can be transmitted and
received with hci_raw driver.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.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>
Some logging configuration are compatible with software-base Link
Layer. Currently only one configuration is supported:
RTT back-end in drop mode and no clean output
Signed-off-by: Guillaume Lager <guillaume.lager@gmail.com>
Add the command add-subscription to the shell to test the
bt_gatt_add_subscription API.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Allow the application to add subscription without resubscribing.
This is needed for persistent bonds that can go to deep sleep and
turn of the RAM or power-cycle.
In this case the application as a GATT client must have a way to add
the subscription callbacks back to the stack before the GATT server
sends notifications.
This should preferable be able to be done before even connecting
since the notifications can arrive immediately after connecting to
the peer.
The stack cannot persist this on it's own since it must remember the
function pointers for the callback functions. Storing these in
persistent storage would not be compatible with a Device Firmware
Upgrade (DFU) solution.
Fixes: #21798
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Refactor the gatt_sub_add function to be similar in structure to how
find_cf_cfg is implemented. This is so that a subscription can be added
without an active connection.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Flag name usb_dev.configured is misleading as it does not
mean the device is configured. This flag indicates whenever
endpoints for the device were enabled. For all classes
except for audio endpoints are enabled on set_configuration
request. This sets the configured flag true. For Audio this
will never happen as what enables audio endpoints is
set_interface request. Without this patch audio samples
will STALL all interface requests.
Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
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>
Remove the BT_LL_SW_SPLIT dependency for
BT_CTLR_DEBUG_PINS_CPUAPP when building CPUAPP application
that is using Zephyr BLE HCI controller on the CPUNET core.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
When the connection is terminated, make sure that any pending
data is feed to the application.
Fixes#28057
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The _gatt_ infix was determined to be unnecessary as
GATT is implied by it being a Bluetooth service.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The _gatt_ infix was determined to be unnecessary as
GATT is implied by it being a Bluetooth service.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The _gatt_ infix was determined to be unnecessary as
GATT is implied by it being a Bluetooth service.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add handling of the HCI_Hardware_Error event to log the hardware code.
This event was unmasked in set_event_mask.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Add a name to the Kconfig choice that selects the controller TX power.
This allows board `*.defconfig` files to change the default TX power
as their certifications warrant. For example:
```
choice BT_CTLR_TX_PWR
default BT_CTLR_TX_PWR_PLUS_4
endchoice
```
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Preserve the TX power set with the `BT_HCI_OP_VS_WRITE_TX_POWER_LEVEL`
command for advertising and scanning procedures. As the TX power is no
longer overwritten on procedure start, the TX powers can now be set
before starting the procedure. This eliminates the chance for the first
transmissions to use the default TX power instead of the request TX
power.
Similar changes are not made to the connection advertising powers as
changing the TX power for a connection to device A should not change
the TX power for a future connection to device B using the same
`struct lll_adv` instance.
Fixes#27921.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
ADI field is optional in AUX_SCAN_RSP so by default it's disabled, but
now we'll have an option to include it.
Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
When aux is upated, DID is changed and unlike SID it's only stored in
aux PDU. To allow quick access to new DID value, let's just optionally
return current ADI value after aux was updated. It will be useful e.g.
when updating scan response data if we want to put ADI there.
Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
This enables processing of AUX_SCAN_REQ and sending back AUX_SCAN_RSP
on non-connectabe scannable advertising instances. Similar path will
be used for AUX_CONNECT_REQ so there are few references for connectable
as well, but this is not supported as for now.
Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
This adds restrictions for setting scan response data as specified by
Core spec:
* on legacy, only complete data can be set
* on legacy, data cannot be longer than 31 octets
* on ext, if non-scannable, data can only be discarded
* if ext enabled, only complete data can be set
* if ext enabled, data cannot be discarded
Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
This allows to set scan response data using ext adv commands.
New AUX_SCAN_RSP can be created without analyzing previous PDU since
the only value that need to be copied from previous PDU is AdvA which
is placed at fixed location. TxPower is omitted since, if enabled, it
is already present in AUX_ADV_IND and does not need to be presed in
other PDUs. ADI support is to be added later.
Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
AdvA in aux is mandatory for any connectable and scannable set so make
sure it's always added.
Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
Connectable and scannable instances always have aux so we need to force
AuxPtr to be included in primary PDU and have aux allocated even if no
data are set.
Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
Connectable and scannable instances always have AuxPtr so we can return
error immediately if controller is configured with no aux.
Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
Prevent redundant collision resolves and potential incorrect and harmful
increment of lazy_current.
During collision scenarios with high CPU load, the ticker_worker may be
called a second time before the ticker_job gets to run. This will cause
ticker operations on the previosly expired node (expected), and in some
cases increment lazy_current, even though the node was not sceduled to
execute via the req/ack mechanism.
By moving the request check before collision resolve, CPU time is saved,
and lazy_current will not incorrectly be incremented if node is in
collision.
The problem may be seen as a connection suddenly not receiving packets,
or MIC error on master, because the event counter goes out of sync.
Signed-off-by: Morten Priess <mtpr@oticon.com>
Use a helper config BT_CTLR_CONN_RSSI_SUPPORT so that it is only
enabled when supported by the controller.
Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
This commit extends USB hid API callbacks by adding
'const struct device *dev' parameter. If the application
configured more than one HID device then it must specify
separate hid_ops for each device as its unable to determine
for which device the callback was called.
This patch makes it possible to have only one hid_ops within
the application and the application is aware for which device
the callback was called because of explicit device pointer.
Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>