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>
USB High-Speed devices must be able to operate at both High-Speed and
Full-Speed. The USB specification allows the device to have different
configurations depending on connection speed. Modify the API to reflect
USB Specification requirements on what can (e.g. configurations) and
what cannot (e.g. VID, PID) be speed dependent.
While the class configurations for different speeds are completely
independent, the actual class instances are shared between operating
speeds (because only one speed can be active at a time). Classes are
free to provide different number of interfaces and/or endpoints for
different speeds. The endpoints are assigned for all operating speeds
during initialization.
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
Introduce usbd_class_iter for keeping endpoint assignment variables
and the single-linked list node. No functional changes right now, but
this paves the way for independent speed specific configurations.
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
When device is not configured, any class or endpoint request must result
in request error. Do not try to find transfer owner because there cannot
be one.
Make sure that the actual handling code path does not depend on the
configured log level because it is absolutely not desired for log level
to affect actual handling.
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
Do not require nil descriptor at the end of descriptor set because it
serves no other purpose than a sentinel. Just end processing on first
NULL pointer within descriptor set.
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Add necessary macros and convert UAC2 descriptor test from descriptor
blob to descriptor set. Currently there is only Full-Speed descriptor
set.
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
For specification-compliant high-speed support, we need to support
device quilifiers and other-speed-configuration descriptor requests. We
also need to store different configurations of the class/function
descriptors, which typically only affect the endpoint descriptors. With
this change, the stack expects class/function descriptors to be passed
as an array of struct usb_desc_header pointers to e.g. interface,
interface-specific, and endpoint descriptors, with the last element of
the array pointing to a nil descriptor. And also passed for a specific
speed, for now we support full and high speed configurations.
During instantiation, the class/function implementation must choose the
correct configuration in the full-speed and high-speed descriptor sets
for values such as maximum packet size and bInterval values of interrupt
and isochronous endpoints.
During initialization, the stack reads the highest speed supported by
the controller and uses it to get the appropriate descriptors set
from the instance. If the controller supports only full speed, the stack
configures the class/function descriptor for full speed only, if the
controller supports high speed, the stack configures the descriptors for
high speed only, and a class/function must update the full speed
descriptor during the init callback processing.
During device operation, the class/function implementation must check
the actual speed of the device and use the correct configuration, such
as the endpoint address or maximum packet size.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Save actual device speed in the device context and add helpers to get
highest supported and actual speed.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
The class implementations should not access the members of the struct
usbd_class_node directly.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
This implementation is WIP and has mostly been used to test interface
and endpoint configuration by the stack. For future changes, make the
interfaces more compliant with the USB specification.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
If compiling with optimizations (-O2/-Ofast) gcc emits a
maybe-uninitialized warning for `size`.
As far as I can tell, `size` will always be initialized in the cases
where it is used and only left uninitialized in error cases.
Reproduced on main with the multi_endpoint sample on
nrf5340dk/nrf5340/cpuapp.
Signed-off-by: Herman Berget <herman.berget@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>
Updates the linker script fragments under 'subsys' to use
Z_LINK_ITERABLE_SUBALIGN for the subalignment instead of
a hardcoded value of 4.
Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
The IPv6 address lifetime timers are kept in a slist, but
the code that adds the entry to the list does not check
whether the item is already in the list. This will cause
problems when trying to remove the address from the list.
Normally this is not causing issues, but if the function
net_if_ipv6_addr_update_lifetime() is called multiple times
before the address expires, then the item was added to the
slist multiple times.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Applications need to run a scan to identify the security
mode before attempting the connection which adds to the time
taken for connection to be established.
To avoid the initial scan, support auto security mode which will
enable STA to choose between WPA, WPA2 and WPA3, based on the
network configuration.
Signed-off-by: Ravi Dondaputi <ravi.dondaputi@nordicsemi.no>
In situations, where the address, the port and the auth token of the
hawkbit server are not known during build, it should be possible to set
it during runtime.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
This commit fixes removing indirect blocks (marking them as 0)
in the inode structure. Previous version of the code was removing
the top-level blocks only when the first removed block was
one of the first 12 direct blocks. However, when the first removed
block is the first block in the referenced block list, its parent
(indirect block) should also be removed.
Signed-off-by: Franciszek Pindel <fpindel@antmicro.com>
Since `NONE` is a valid option for key management in `connect`
command, we should remove the part in help text which says:
"valid only for secure SSIDs".
Signed-off-by: Ravi Dondaputi <ravi.dondaputi@nordicsemi.no>
UBSan was showing the following error:
```
runtime error: left shift of 137 by 24 places cannot be represented in
type 'int'
```
Cast the value to `uint32_t` to make UBSan happy.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
The comment states the reason for this requirement is to detect
violations by a remote peer. The ATT version of this was removed in
ea04fd95f9. TLDR: It's neither possible
for, nor the job of the host to police the remote device.
We remove this requirement to be more flexible about the number of
priority levels in the system, and to avoid the temptation of using
priorities as a synchronization mechanism.
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
The remote domain may send unsolicited Z_LOG_MULTIDOMAIN_ID_DROPPED IPC
messages, which are not handled in log_multidomain_link_on_recv_cb().
With CONFIG_ASSERT=y, this will cause an assertion failure. With asserts
disabled, this message would be treated as a reply to any in progress
request and cause getter_msg_process() to return early. In turn, this
can cause various kinds of memory corruption when the real reply arrives
and the callback reads/writes stack variables that are no longer valid.
Fix this by explicitly ignoring Z_LOG_MULTIDOMAIN_ID_DROPPED, and also
don't treat unrecognized message types as replies.
Signed-off-by: Ben Wolsieffer <benwolsieffer@gmail.com>
This fixes warnings when building with icbmsg
backend for IPC service by defining
_POSIX_C_SOURCE 200809L in source file.
Signed-off-by: Kamil Gawor <Kamil.Gawor@nordicsemi.no>
In hawkbit there are currently a lot of values send to the server, that
are not required or even optional. This commit corrects that.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
This commit change a method of printing multicast routes by showing
all interfaces per entry instead of aggregating them by interface.
Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
In order to save memory, a single multicast routing entry now
contains configurable number of network interfaces.
Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
This commit adds a check to determine if the packet wasn't already
forwarded to a given interface.
Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
This commmit changes the way of iterating over multicast routing
entries from explicit for-loop to ARRAY_FOR_EACH_PTR().
Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
The log message header "source" field for messages received from a
remote domain contains the source ID, rather than a pointer to the
source data (which would not be valid in the local domain).
msg_filter_check() did not handle this case and obtained a garbage source
ID for remote log messages. This caused an assertion failure in
filter_get().
Consistently handle this by adding a log_msg_get_source_id() function
that returns the source ID for both local and remote messages. This
function was implemented based on code factored out of
log_output_msg_process().
Signed-off-by: Ben Wolsieffer <benwolsieffer@gmail.com>
Add support for decoding incoming LC3 data. At this point
we only instantiate a single LC3 decoder, so only one frequency
and duration is supported.
To accomodate for the increased RAM usage, the number of unicast
streams support have been decreased.
Further more, the LC3 handling in the shell has overall been
improved, also for encoding.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Returned values are copies, so trying to "const" return values cannot
have any effect.
Fixes the following compiler warning:
```
llext.h:165: warning: type qualifiers ignored on function return type
```
Fixes commit 41e0a4a371 ("llext: Linkable loadable extensions")
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
`ret` is the amount sent from the current buffer. `sent` contains the
total amount that was transferred in the while loop.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Modifies the audio configuration (ac) commands for CAP
and GMAP to use the default presets instead of supplying
the preset as arguments. This will allow the user to
use the `bap preset` command to configure everything in the
codec configuration before the AC commands are issued.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When creating a broadcast sink using the auto scan feature,
the call to bt_le_per_adv_sync_create would use a local
PA sync pointer, instead of one from the per_adv_syncs
array, making it impossible to stop the PA sync afterwards.
This commit modifed the auto_scan so that it properly uses
the per_adv_syncs array, while still assigning the PA sync
in the shell broadcast sink struct.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The print_codec_cfg_chan_allocation did not take the case where
chan_allocation == BT_AUDIO_LOCATION_MONO_AUDIO into account,
in which case it should print "Mono".
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The commit 8256d02d3a introduced
getopt parsing for the wifi connect command
This needs to be updated for the wifi ap enable since ap
enable also uses the same parsing as connect.
The use of getopt removes the parameter ordering restrictions
Signed-off-by: Brad Kemp <brad@beechwoods.com>
In case FIN packet included data bytes, Zephyr would ignore the
data. It wasn't passed to the application, and it wasn't considered
when bumping the ACK counter. This ended out in connection timing out,
instead of being properly terminated.
Fix this, by refactoring FIN processing in TCP_ESTABLISHED state.
Instead of handling FIN/FIN,ACK/FIN,ACK,PSH cases separately, have a
common handler when FIN flag is present, and when ACK flag is present
along with FIN. When FIN is present, take any potentially incoming data
into account.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
`bt_recv` is invoked from the BT long work queue, which is preemptible.
The host uses cooperative scheduling to ensure thread safety.
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
Allow changing the CoAP Block-wise transfers block-size
for subsequent GET requests.
It looks like Leshan switches block size back to its
configured value, if it is smaller.
So even when we send block N=0 with size of 512, Leshan
seem to handle that properly but still asks N=2 with
block size 256(if that is configured).
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Implement test version of the LE Create BIG command ll_big_test_create
(BT_HCI_OP_LE_CREATE_BIG_TEST) in the controller.
This enables use of CONFIG_BT_ISO_ADVANCED, which supports use of
the following BIG/QoS configuration parameters (otherwise derived):
- ISO_Interval
- NSE
- Max_PDU
- BN
- IRC
- PTO
Signed-off-by: Morten Priess <mtpr@oticon.com>
Fix regression in BT_RX_STACK_SIZE use due to
commit b91728619c ("Bluetooth: host: remove
`CONFIG_BT_RECV_BLOCKING`").
Profiling of Controller Rx thread has been mentioned in
commit 586ba9fd13 ("Bluetooth: Controller: Increase
BT_RX_STACK_SIZE for BT_HCI_RAW enabled").
Also, move the TX_STACK_SIZE value as default in Kconfig
from the explicit value being set in hci_ipc sample.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Minor improvements to usage of zperf_shell upload.
Added common defaults for the upload commands arguments.
Print defaults in cmd help.
Throw warning when user sets baud rate for TCP upload.
Signed-off-by: Adam Matus <adam.matus@nxp.com>
The network interface parameter for net_eth_get_vlan_tag() should
be the VLAN interface so use the search loop properly.
Earlier the main interface could be checked.
Add also test cases for this so that we can catch that the func
works properly.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Add more error logs in case of (mostly) mbed TLS errors, so it's easier
to get an initial idea of what went wrong based on logs only. Getting
an information on an actual mbed TLS error code is quite helpful in such
cases.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Generic node_rx_hdr struct contains data not used for done event, so this
pdu specific data is moved to node_rx_pdu to minimize memory usage for
MFIFO_done alloc.
This however calls for a considerable write-through replacing the generic
node_rx_hdr with node_rx_pdu when relevant and needed.
Signed-off-by: Erik Brockhoff <erbr@oticon.com>
Use CONFIG_BT_CTLR_CENTRAL_ISO instead of CONFIG_BT_CENTRAL in
declaring central CIS CREATE procedure context data. In some configs the
size of this data structure is bound by central CIS CREATE, so doing it
correctly will save memory in the procedure context allocation.
Signed-off-by: Erik Brockhoff <erbr@oticon.com>
This commit adds support for building relocatable (partially linked)
ELF files as the binary object type for the llext subsystem.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
Add a new Kconfig option to select the binary object type for the llext
subsystem. This will allow to fully decouple the architecture type from
the kind of binary object that is expected by the loader.
The defaults have been chosen to match the current behavior of the ARM
and Xtensa architectures, but developers can now more easily experiment
with other object types.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
If central initiates incompatible procedure after having replied (with
_IND), peripheral fails to disconnect as spec'ed.
Fix by correctly setting the INCOMPAT flag to reserved on IND receipt to
enforce the disconnect.
Signed-off-by: Erik Brockhoff <erbr@oticon.com>
Block size is a 3-bit value mapping values [0, 6] to powers of 2 in the
range [16, 1024]. Value 7 is invalid.
The previous formula was not working in case the client's preferred size
was 4 (or more) times bigger than the server's.
This commit takes into account also the case the client's preferred size
is smaller than the server's.
Signed-off-by: Marco Argiolas <marco.argiolas@ftpsolutions.com.au>
It's needless complexity, and the terminology clashes with
Bluetooth (HCI frags).
It has one user, IPSP, that is going away soon.
Removing frag support will allow a future optimization, removing the
need for HCI and L2CAP fragment buffer pools, saving memory.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Remove IPSP support from the tree.
It has no maintainers, and is regularly broken. The fact that it's
nontrivial to set-up in linux makes it hard to fix reported issues.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
By exposing the underlying iso channel, the application can retrieve
properties of the iso channel.
This can be useful in case the application wants to use the connection
handle for vendor specific HCI commands or to retrieve the particular
parameters used for the given channel.
Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
First sector starts at CONFIG_EXT2_DISK_STARTING_SECTOR.
This commit fixes calculating free space, based on that value.
Signed-off-by: Franciszek Pindel <fpindel@antmicro.com>
Adds support for all relocation type produced by GCC
on ARM platform using partial linking (-r flag) or
shared link (-fpic and -shared flag).
Signed-off-by: Cedric Lescop <cedric.lescop@se.com>
This extends the thread abort hook to support memory mapped
stack. The calculation to find out to which instance of thread
pools the outgoing thread belongs requires physical address.
So find the physical address via the memory mapped stack for
that.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
The "struct sockaddr" should only be used in casts and never
as a standalone variable because it might not have enough
space allocated for all the protocol specific fields.
So refactor the port_in_use() function to reflect that.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
errno values are positive, therefore they should be negated when
assigned as return values for net_dhcpv4_server_start().
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The commit adds dependency on Kconfig FLASH_PAGE_LAYOUT to subsystems
that really require it:
FCB, NVS, LittleFS
and removes direct selection from '*.conf' files where no longer
needed.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>