Commit graph

21541 commits

Author SHA1 Message Date
Lingao Meng
5fe698286e Bluetooth: Mesh: Add kconfig for thread priority
Add Kconfig `CONFIG_BT_MESH_ADV_PRIO`.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-07-28 15:44:34 +02:00
Joep Buruma
6f6e5dfde0 mgmt: hawkbit: fix codestyle and whitespaces
Fix compliance code check

Signed-off-by: Joep Buruma <burumaj50@gmail.com>
2021-07-28 07:32:46 -04:00
Joep Buruma
e45c07cd60 mgmt: hawkbit: Fix case where body_data not set correctly
When downloading large files from the hawkbit server
 the only time rsp->body_start is checked is on the
first call. After this it is never checked again.

This caused the wrong data to be written to flash
and a failed update.

Signed-off-by: Joep Buruma <burumaj50@gmail.com>
2021-07-28 07:32:46 -04:00
Vinayak Kariappa Chettimada
97adf875b8 Bluetooth: Controller: Flush pending Tx PDUs before PHY update
Flush any pending Tx PDUs in the lower link layer before
enqueueing PHY_UPDATE_IND PDU with instant to ensure the
PDU is transmitted before the instant occurs.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-07-28 11:38:42 +02:00
Vinayak Kariappa Chettimada
ad1edf1cc4 Bluetooth: Controller: Advanced scheduling for Extended Initiator
Implement the advanced scheduling for Extended Initiator to
group central connections established to Extended
Advertisements.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-07-28 11:38:29 +02:00
Vinayak Kariappa Chettimada
d8f4759c5f Bluetooth: Controller: Fail on multiple PHY use in PHY_UPDATE_IND
Disconnect connection if peer central uses multiple PHYs in
PHY_UPDATE_IND PDU.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-07-28 11:38:15 +02:00
Uday Ammu
17d2e9d084 shell: optionally configure priority of the shell thread
Currently, in Zephyr the shell thread is the lowest priority i.e.
K_LOWEST_APPLICATION_THREAD_PRIO. Due to this all the other threads can
preempt the shell thread. Proposed solution is to add Kconfig which
gives the flexibility to change the priority of the shell thread.

This is now implemented using a new Kconfig variable
SHELL_THREAD_PRIORITY_OVERRIDE. By setting this option
SHELL_THREAD_PRIORITY can be set.

Signed-off-by: Uday Ammu <udaykiran@google.com>
2021-07-27 19:11:47 -04:00
Krzysztof Chruscinski
5d80cbae59 lib: os: cbprintf: Add support for conversion to fsc package
Added support for conversion from a standard package which contains
pointers to read only strings to fully self-contained (fsc) package.
Fsc package contains all strings associated with the package thus
access to read only strings is not needed to format a string.

In order to allow conversion to fsc package, standard package must
contain locations of all string pointers within the package. Appending
that information is optional and is controlled by flags parameter
which was added to packaging API. If option flag is set then
package contains header, arguments, locations of read only strings and
transient strings (each prefixed with string argument location).
Package header has been extended with field which contains number of
read only string locations.

A function for conversion to fsc package has been added
(cbprintf_fsc_package()).

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-07-27 14:50:45 +02:00
Arvin Farahmand
c95e0825d2 dsa: updated api to use net_if
Change DSA API to use `net_if` directly to make API calls instead of
indirectly via `dsa_context` and `switch_id`.
Remove unused `switch_id`, `switch_enable_port`, and `dsa_get_context`.

Signed-off-by: Arvin Farahmand <arvinf@ip-logix.com>
2021-07-26 19:37:22 -04:00
Fabio Baltieri
532a85ccd9 tests: net: dns-sd: add a test case for setup_dst_addr
Add a test case for mdns setup_dst_addr.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-07-26 10:46:50 -04:00
Fabio Baltieri
c25b04bfd3 net: mdns: set the correct type of dst addr
Check for the address family of the packet when setting the multicast
destination address used in the response. Current code checks either the
query type or the stack configuration, which can result in setting the
wrong type of address for the frame.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-07-26 10:46:50 -04:00
Fabio Baltieri
1d500f075c net: dns_sd, mdns: add few missing strdup
Add few missing log_strdup found when running the mdns code with
debugging enabled.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-07-26 10:46:50 -04:00
Emil Lindqvist
0e8c04a9ee settings: fs: check directory presence before attemp to create it
In order to avoid to generate warning log message from
file system, first check if directory exists before trying to
create it.

Signed-off-by: Emil Lindqvist <emil@lindq.gr>
2021-07-26 10:44:42 -04:00
Emil Lindqvist
1e9f1231fe logging: fs: treat absent file on stat as no error
There are multiple reasons to want to find out if file or
directory exists, for example to create it. Stating and
finding out it doesn't exist should not cause an LOG_ERR call as
this gives information to the user in a normal call case.

Fixes #35718

Signed-off-by: Emil Lindqvist <emil@lindq.gr>
2021-07-26 10:44:42 -04:00
Vinayak Kariappa Chettimada
9a1b5c68f5 Bluetooth: Controller: Explicitly check previous auxiliary PDU for ADI
To be consistent in how order header flags are handled when
updating the common header format fields, explicit check
for ADI flag in previous auxiliary PDU buffer.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-07-26 15:30:04 +02:00
Vinayak Kariappa Chettimada
ad8f4d368a Bluetooth: Controller: Remember last used DID for each SID
Remember last used DID for each SID, so that DID value used,
when updating the advertising PDU fields, change between
consecutive changes to PDU fields.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-07-26 15:30:04 +02:00
Vinayak Kariappa Chettimada
a919e1ba40 Bluetooth: Controller: Make Extended Advertising DID unique
Make the Extended Advertising DID value updated to be unique
for every new advertising set created.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-07-26 15:30:04 +02:00
Vinayak Kariappa Chettimada
d19476c3c2 Bluetooth: Controller: Fix corrupt AD data after directed advertising
Fix corrupt AD data used after directed advertising by
storing a backup of the AD data before switching to directed
advertising. Restore back the AD data with switching to non-
directed advertising.

The fix also addresses AD data backup when switching between
Legacy and Extended Advertising.

Fixes #18850.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-07-26 15:29:55 +02:00
Vinayak Kariappa Chettimada
4e6357e549 Bluetooth: Controller: Resolve AdvA in AUX_CONNECT_RSP PDU
Add implementation to resolve AdvA in the received
AUX_CONNECT_RSP PDU before generating the connection
complete.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-07-26 15:29:41 +02:00
Flavio Ceolin
dd54a8daed pm: Avoid weak function clash
SoC hooks are defined as weak functions for the case where they are
not implemented by a SoC. The problem that may happen is when an
application define it as weak as well. In this case, no compilation
error is issued but the version that will be used depends on the build
order. Just remove the weak placeholder implementation.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-07-26 04:31:54 -04:00
Aurelien Jarno
0cd3daacba usb: truncate the most significant part of the serial number
When the Hardware Information Driver (HWINFO) provides a device ID
longer than the configured USB serial number, truncate the most
significant part instead of the least significant part. The lower part
is usually having more entropy, e.g. on STM32.

Fixes #34550

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2021-07-24 21:26:06 -04:00
Emil Obalski
36cf484640 mcumgr: smp: Fix NULL pointer reference
SMP implementation across bt/udp does not check
if allocation of the buffer was successful.
If the buffer is not granted an error shall be
returned.

This patch fixes BUS FAULT issue when NULL
pointer is referenced.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2021-07-23 16:25:47 -04:00
Emil Gydesen
3a6952e3e6 Bluetooth: iso: Compile conn.c for BT_ISO even without BT_CONN
If BT_ISO is enabled we now compile conn.c which contains a
lot of functionality used by BT_ISO, even for broadcast-iso
builds, i.e. builds that do not require BT_CONN.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-07-23 16:11:52 -04:00
Emil Gydesen
a02abea0a2 Bluetooth: conn: Move ACL only data fields to ACL group
Move the data that is only relevant for ACL to
a guarded ACL group.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-07-23 16:11:52 -04:00
Emil Gydesen
72319abc7e Bluetooth: conn: Add BT_CONN guards in bt_conn_set_state
Add BT_CONN guards for ACL only functionality in
bt_conn_set_state.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-07-23 16:11:52 -04:00
Emil Gydesen
32da3287ac Bluetooth: conn: Add BT_CONN guard to bt_conn_get_pkts
Add a guard for BT_CONN and return NULL if no
packets can be returned.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-07-23 16:11:52 -04:00
Emil Gydesen
90a9ea92e2 Bluetooth: hci_core: Remove BT_CONN guard for ISO fields in bt_dev_le
Change the guard such that the iso_mtu and iso_pkts are
not guarded by BT_CONN as they should be available for
iso broadcast-only builds.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-07-23 16:11:52 -04:00
Emil Gydesen
4ac8a9e6c0 Bluetooth: conn: Add guard for ACL in conn_mtu
Add guard for accessing the bt_dev.le.acl_mtu if
CONFIG_BT_CONN is not enabled.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-07-23 16:11:52 -04:00
Emil Gydesen
5612f60185 Bluetooth: conn: Add bt_acl_recv for ACL only data
Add the bt_acl_recv function that works similar to
bt_iso_recv but for ACL data only, simplying the
generic bt_conn_recv function.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-07-23 16:11:52 -04:00
Emil Gydesen
c877045133 Bluetooth: conn: Guard acl_send with CONFIG_BT_CONN
Guard the ACL send to only be called if CONFIG_BT_CONN
is enabled.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-07-23 16:11:52 -04:00
Emil Gydesen
c56fd68a13 Bluetooth: conn: Move bt_conn_connected to ACL group
Move the bt_conn_connected function to the ACL group.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-07-23 16:11:52 -04:00
Emil Gydesen
6952dcd7a8 Bluetooth: conn: Move acl_conns to ACL group
Move the acl_conns array to the ACL group.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-07-23 16:11:52 -04:00
Emil Gydesen
2249091176 Bluetooth: conn: Move bt_conn_disconnect to ACL group
Move the bt_conn_disconnect and conn_disconnect functions
to the ACL group.

Also adds a guard in the iso.c file for connected ISO.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-07-23 16:11:52 -04:00
Emil Gydesen
d203422082 Bluetooth: conn: Fix type of recieved to received
Fixed a typo that caused a CI issue.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-07-23 16:11:52 -04:00
Emil Gydesen
cbec9ffbc0 Bluetooth: conn: Move ACL callback handlers to ACL group
Move the notify_le_phy_updated, notify_le_data_len_updated,
notify_le_param_updated, notify_remote_info,
notify_disconnected and notify_connected functions
to the ACL group.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-07-23 16:11:52 -04:00
Emil Gydesen
866062d7ca Bluetooth: conn: Move ACL conn param functions to ACL group
Move the send_conn_le_param_update and le_param_req functions
to the ACL group.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-07-23 16:11:52 -04:00
Emil Gydesen
bee720e797 Bluetooth: conn: Move tx_complete_work to the ACL group
Move the tx_complete_work function to the ACL group.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-07-23 16:11:52 -04:00
Emil Gydesen
fc69f01136 Bluetooth: conn: Moved deferred_work to the ACL group
Move the deferred_work callback function to the ACL group.
This also moves the static function conn_lookup_iso
which is only called form deferred_work.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-07-23 16:11:52 -04:00
Emil Gydesen
fce489087f Bluetooth: conn: Move acl_conn_new to the ACL group
Move the acl_conn_new function to the ACL group.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-07-23 16:11:52 -04:00
Emil Gydesen
c6472f3b56 Bluetooth: conn: Move the BREDR functions to the ACL group
Move the BREDR functions to the ACL group.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-07-23 16:11:52 -04:00
Emil Gydesen
1aefa8baac Bluetooth: conn: Move SMP functions to the ACL group
Move the SMP functions to the ACL group.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-07-23 16:11:52 -04:00
Emil Gydesen
d0d2df4cd8 Bluetooth: conn: Move bt_conn_cb_register to ACL group
Move the bt_conn_cb_register function to the ACL group.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-07-23 16:11:52 -04:00
Emil Gydesen
83e25a7d4b Bluetooth: conn: Move the bt_conn add and exist functions to ACL group
Move the bt_conn_add_le and bt_conn_exists_le functions to the
ACL group.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-07-23 16:11:52 -04:00
Emil Gydesen
f1e438c63b Bluetooth: conn: Move bt_conn ACL lookup functions to ACL group
Move the bt_conn_lookup_state_le, bt_conn_lookup_addr_le and
bt_conn_is_peer_addr_le functions to the ACL group.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-07-23 16:11:52 -04:00
Emil Gydesen
9ec9943bab Bluetooth: conn: Move bt_conn_get_dst to ACL group
Move the bt_conn_get_dst function to the ACL group.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-07-23 16:11:52 -04:00
Emil Gydesen
8b64e3c8fd Bluetooth: conn: Move bt_conn get info functions to ACL group
Move the bt_conn_get_info and bt_conn_get_remote_info functions
to the ACL group.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-07-23 16:11:52 -04:00
Emil Gydesen
bcf2515f3b Bluetooth: conn: Move TX power level functions to ACL group
Move the bt_conn_get_tx_power_level and
bt_conn_le_get_tx_power_level functions to the ACL group.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-07-23 16:11:52 -04:00
Emil Gydesen
422beb41bd Bluetooth: conn: Move bt_conn_le_param_update to ACL group
Move the bt_conn_le_param_update function to the ACL group.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-07-23 16:11:52 -04:00
Emil Gydesen
c9250fea7c Bluetooth: conn: Move bt_conn_le_data_len_update to ACL group
Move the bt_conn_le_data_len_update function to the ACL group.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-07-23 16:11:52 -04:00
Emil Gydesen
661377192a Bluetooth: conn: Move bt_conn_le_phy_update to ACL group
Move the bt_conn_le_phy_update function to the ACL group.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-07-23 16:11:52 -04:00