We can (and do) open multiple channels with a single L2CAP command. If the
remote doesn't support dynamic channels at all, then it sends back a
REJECT_RSP.
We only destroyed the first channel that matched the command PDU
identifier. Fix that and remove all channels that match.
Also add a test that verifies the patch.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Instead of having the boards override the default
in their Kconfig.defconfig
let's just default to IMMEDIATE logging mode in the main
definition if we are building for a ARCH POSIX board.
This avoid issues w dependencies being lost if not duplicated
correctly.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Commit fixes bug if dfu server failed to deliver
apply response it gets stuck in applying phase.
In this phase it skips all further client attempts
to apply image again.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
Backend index must also be incremented, when backend is not an autostart
backend. Otherwise, the resulting bit field can not be used to address
a backend by index; autostart field would have to be taken into account.
Signed-off-by: Torsten Robitzki <Torsten@Robitzki.de>
Ignore failure to Broadcast ISO remove data path when
terminating a BIG without a data path being setup.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
When multiple advertisers overlap over time, the random
delay being applied need many ticker operation context.
This causes the ticker_update interface to return error
causing assertion in the Controller.
This is fixed by not applying random_delay value to the
overlapping advertiser that does not get to use the radio.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add support for a "pm" shell command to trigger suspend/resume as well
as runtime-get/put on devices. This is useful for testing during driver
development.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
In the follow expression:
cyc_evt += UINT32_MAX + 1U
first it is evaluated (UINT32_MAX + 1U), since both types
interpreted as uint32_t, this operation causes an overflow resulting
in 0U.Then we have
cyc_evt = (uint64_t)cyc_evt + 0U
Fix it casting of the operands in the first operation to uint64_t.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Refactor only. The surrounding ifdefs are intentionally not changed in
this patch. They will be in the near future.
Rename the pool and generalize the documentation to allow using this
pool for other events that fit the same criteria. This pool can be used
for any buffer that is processed synchronously, without negatively
affecting 'num complete' messages. E.g. 'cmd complete/status' can be put
in this pool already.
We will be working towards making the host process all event buffers
synchronously. This is because events have no dedicated flow control,
and discarding events in the driver without informing the host creates
problems. Discarding should instead happen in the host higher layers
when unavoidable.
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
There was a typo in Kconfig check (missing CONFIG_ prefix) which
resulted in not setting OACP_FEAT_BIT_CRC bit in features.
This also resulted in checksum feature being disabled due to check
in bt_ots_init().
This was affecting OTS/SR/OASP/BV-03-C qualificatio test case.
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
We were missing a helper function that can be used to check
whether the given function is the virtual VLAN interface.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
As per the BAP spec, the scan delegator device should add the BASS service
data in the extended advertising data when it requests a broadcast
assistant to scan for it. For testing purposes that's usually the case
with the shell, extended advertising data shall be populated with the
BASS service data.
Signed-off-by: Nithin Ramesh Myliattil <niym@demant.com>
I am using the tracing module using the RAM backend on a system with
limited RAM & a buffer that can only store 300ms of tracing data. Current
tracing module starts recording during boot-up & we run out of memory prior
to executing code we actually want to trace.
By reseting buffer metadata here, I can call init() at an arbitrary point
of program execution & the tracing module will reset & start tracing.
I tested on E2E on an ARM M-class MCU by calling init & then reading
buffered tracing data via GDB
Signed-off-by: Galen Krulce <gkrulce@meta.com>
Similar to logging module, allow application specific extension of
shell fprintf APIs at a macro level.
Signed-off-by: Al Semjonovs <asemjonovs@google.com>
Improve the default serial backend init level.
The documentation says to be bigger than the init level of the serial
device used. Since serial devices default to the kernel device init
level (50) then put this to default of application level drivers (90).
Signed-off-by: Joakim Andersson <joerchan@gmail.com>
Add aux offset population assertion check, to ensure the
aux offset calculation is completed before the primary
PDU is setup for transmission.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Commit fixes behavior when provisioning protocol accepts
incoming transaction before ongoing tx transaction is
still active (device didn't receive acknowledgement yet).
Incoming data are ignored until ack is not received.
Specification:
5.3.3 Generic Provisioning behavior
...
If the sender receives a Transaction Acknowledgement
message, then the transaction has completed.
If the sender receives a message with other PDU types,
then the message shall be ignored.
...
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
Those helpers allow to define some typical kinds of chat matches and
scripts with more ease/less boilerplate.
Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
There have been to problems with the code where zcbor_bool_encode
has been fed value instead of expected pointer and the result
of previous zcbor_encode operations has not been taken to evaluate
value of ok status.
The change also replaces usage of #if IS_ENABLED with #ifdef, as
IS_ENABLED should not be used outside if().
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Use lock while accessing nm data.
One of the use case is while setting regulatory, it accesses nm data,
while from some other place also it can be accessed same time.
Protected the nm data processing.
Signed-off-by: Ajay Parida <ajay.parida@nordicsemi.no>
Work items on the syswq should always run-to-completion.
Override the timeout value to always be K_NO_WAIT.
Allocating with K_FOREVER leads to deadlocks if the freeing also happens
from the syswq. Non-zero timeouts are also not nice for the other users
of the syswq.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Even though we are passing mandatory args from the shell registration,
due to use of getopt the check can be bypassed without the hyphenated
options.
So, enforce and fail if mandatory parameters aren't passed through
getopt.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Change default to using advertising coding in ACL connection
when establishing connections on Coded PHY.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add missing check for Coded PHY support when creating
extended advertising set.
Added a fallback in Controller for upper layers requesting
Coded PHY while Controller is implemented without Coded PHY.
In this case, 1M PHY will be used in extended advertising
for testing purposes.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Adds a config that enables sending the object version for all objects.
According to LwM2M specification v1.0 and v1.1, non-core object versions
other than 1.0 'must' be provided, while all other versions 'may' be
provided. With specification v1.2, a client 'can always attach Object
Version Information'. Or in other words, it is OK to always report the
object version with all specifications.
Signed-off-by: Andreas Rudolf <andreas.rudolf@husqvarnagroup.com>
Ignore LE 2M PHY being set in Initiating_PHYs of the
LE Extended Create Connection command.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Adapts flash writing for BLOB IO to RRAM. The previously used write
block alignment is not needed for RRAM.
Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
An audio stream is unidirectional, so it's always either
TXing or RXing, so the fields can safely be moved to an
enum.
The struct now has both a is_rx and is_tx field. The reason
why two bools are being used, is that the both of them may
be false (we need 3 states).
All access to the rx and tx structs in the union shall be
guarded by these fields.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
We could start executing the work item after the channel has been
disconnected or destroyed, due to a race condition.
Double-check we are connected before attempting to send data.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
This check is repeated many times in `gatt.c`, with various comments.
This patch refactors these occurrences into a named function.
Resolves: https://github.com/zephyrproject-rtos/zephyr/issues/41789
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
We can't just keep blocking the syswq, people be mad.
Override the timeout value so we always have K_NO_WAIT.
Also print a message to whomever's listening.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
OTS requires that indications about state change are sent after
response to ATT Write.
OTS Specification p.4.4.4.: "An OLCP or OACP operation is started
when the ATT Write Response is received from the Object Server as
a result of the Object Client writing an Op Code to a control point
to perform some desired action. The control point operation ends
when the Object Server sends an indication to the Object Client
with the Op Code set to Response Code."
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
To make it easier to understand the code, the following was done:
- Use INITIATING/ADV for state names that are exclusive to central
or peripheral. Previously it was not necessarily clear that the state
BT_CONN_CONNECTING was for central only by just looking at where
it was used. The terms INITIATING/ADV were used in favor
of central and peripheral as these terms also work for SCO connection
establishment.
- BT_CONN_CONNECTING_SCAN -> BT_CONN_SCAN_BEFORE_INITIATING
to make it more clear that we are not scanning and connecting at
the same time. The new name should make it more clear why we are
scanning - only with the intention to start the initiator later.
- BT_CONN_CONNECTING_AUTO -> BT_CONN_INITIATING_FILTER_LIST.
This makes it clear that this state is something different than
BT_CONN_AUTO_CONNECT.
Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
When initially reading some of the host code it was unclear to me
why they were needed an how they are used.
By adding some documentation,
this can hopefully make it easier for others to understand these.
Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
The following warning is issued by clang:
warning: field within 'struct gatt_chrc' is less aligned than 'union
gatt_chrc::(anonymous at subsys/bluetooth/host/gatt.c:1859:2)' and
is usually due to 'struct gatt_chrc' being packed, which can lead
to unaligned accesses [-Wunaligned-access]
This is due to the fact that the uint16_t uuid field requires 2-byte
alignment but it is not marked as packed. Since the enclosing struct is
indeed packed, the required alignment is not guaranteed and so clang
complains. Fix it by ensuring that the union is marked as packed too.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
The advertiser options to automatically add the name in the scan
response and the advertising data will be deprecated.
The Mesh files `proxy_srv.c` and `pb_gatt_srv.c` were using
BT_LE_ADV_OPT_USE_NAME. Add the device name in the advertising data
directly.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
The advertiser options to automatically add the name in the scan
response and the advertising data will be deprecated.
Update the Bluetooth shell and its documentation to not use those
options anymore.
The option of the legacy advertiser run with `bt advertise` and the
behavior hasn't changed. The code has been updated to no longer use the
advertiser option but the original behavior has been reproduced.
The option of the extended advertiser have been updated to be more
explicit. The options `name` and `name-ad` have been removed from the
`bt adv-create` and `bt adv-param`. The option `name` and `dev-name`
have been added to the `bt adv-data` command.
- `name <str>` will advertise the given name.
- `dev-name` will advertise the device name.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
Rework USBD shell to take speed arguments into account and revise
command help text. Rename some of the commands to better reflect what
they actually do.
Since most of the init code changes, rewrite the command to initialize
the default configuration in the shell to register all available
classes, but not to enable USB device support in a single command.
This will allow earlier notification in the future, if supported by the
controller, before the USB device controller is enabled.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
For the last dozen commits, the role of usbd_class_node has actually
been taken over by usbd_class_iter. After cleaning up and merging
usbd_class_node and usbd_class_data, we can rename usbd_class_iter to
usbd_class_node to better reflect its role.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Since only usbd_class_node contains the class instance data, rename it
to usbd_class_data.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
With the latest change, there are two structures that actually contain
class instance related data. Merge them into usbd_class_dnode, because
there is already a handy macro that can be used in class instances.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Some places have been overlooked, finally get rid of it. Use helpers to
get instance priv and device context.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>