Fix not setting NRPA before starting scanner.
Occurs with BT_PRIVACY=n and BT_EXT_ADV=y
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Re-structures the `bt_conn_recv()` to support more generic appending of
new ACL data. This also handles the possibility of receiving 0-length
ACL_START and ACL_CONT fragments, whilst maintaining existing
error-checking functionality.
Signed-off-by: Thomas Stenersen <thomas.stenersen@nordicsemi.no>
Fixes issue #26900.
A controller may fragment an L2CAP SDUs in any way it sees fit,
including fragmenting the L2CAP header. Likewise, the receiving
controller may send the fragmented header as ACL data to the host.
The Zephyr host assumed that a `BT_ACL_START` was at least 2 bytes long,
and consequently read the two-byte length field from the buffer without
length checks.
This commit allows the `BT_ACL_START` to be less than two bytes,
updating the `conn->rx_len` onces the `BT_ACL_CONT` with the remaining
part of the length field has been received.
Signed-off-by: Thomas Stenersen <thomas.stenersen@nordicsemi.no>
Fix Kconfig dependencies for enabling the controller PHY options
for LE 2M Phy and LE Coded Phy. These options should be selectable
without connections enabled when extended advertising has been enabled.
The issue affects out-of-tree controllers that wish to use the
BT_CTLR_PHY_CODED and BT_CTLR_PHY_2M options.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Select the controller feature support for data length and LE 2M PHY
based on the SoC hardware capabilities instead of relying on SoC
family.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
When attempting to bind a channel if it fails the code will attempt to
cleanup calling bt_iso_cleanup which expects connections of
BT_CONN_TYPE_ISO.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
ISO connection does not initialize its tx_complete_work nor it uses for
anything so calling into tx_notify will likely cause a crash.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Now that CONFIG_BT_CTLR_RX_PRIO_STACK_SIZE defines a stack size, allow
for it to be configurable from a .conf file just like the rest of the
threads in Bluetooth.
Fixes#27768.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Replaces the current zero length array for provisioner data with
ifdefs, to silence new gcc 10 warnings about array element access.
Fixes#28371.
Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
the adv instance should be delete correctly if advertise fail,
Otherwise the instance will unable to allocate if start the legacy again
Signed-off-by: chao an <anchao@xiaomi.com>
Fixes a memory leak when a virtual address subscription is added for a
model that either has this VA already, or the model has no more space
for subscription addresses.
Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
Add back call to LE Write Suggested Default Data Length
command so that new connections, receiving Data Length
Update procedure before local device can auto initiate, can
respond with the suggested default data length Tx octets
and Tx time.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
When controller is built with extended advertising support but without
LL Privacy build fails due to issue with code that sets TxAdd in aux
PDU:
.../ll_sw/ull_adv_aux.c: In function 'ull_adv_aux_hdr_set_clear':
.../ll_sw/ull_adv_aux.c:502:25: error: 'struct ll_adv_set' has no
member named 'own_addr_type'
502 | sec_pdu->tx_addr = adv->own_addr_type & 0x1;
|
We need own_addr_type value if an advertising set with aux but without
AD is created since we cannot get TxAdd value from other PDU.
ull_adv_aux_hdr_set_clear() can now be called with a flag to explicitly
set AdvA field and pass own_addr_type in 'value' parameter. This allows
to set proper TxAdd when creating new advertising set.
On aux updates, we use TxAdd from other PDU:
- if primary PDU has AdvA, we use TxAdd from that PDU
- if previous secundary PDU has AdvA, we use TxAdd from that PDU
In other case we just return an unpsecified error since this should not
happen in any valid scenario.
Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
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>
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>
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>
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>
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>