Commit graph

8027 commits

Author SHA1 Message Date
Simon Glass f4ef4daa8a emul: spi: bmi160: Prepare to support I2C
At present this driver only supports SPI. Refactor it so that SPI is
just one of the options. This does not change any functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-27 16:41:30 +01:00
Simon Glass fa90b5c243 emul: spi: bmi160: Move to top-level directory
This emulator currently only supports SPI. Before making it also
support I2C, move it up a directory to avoid I2C uses missing it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-27 16:41:30 +01:00
Simon Glass e43c181934 emul: spi: emul_bmi160: Move logging to access functions
Move the logging for transactions to the functions that actually access
registers and sample data. This avoids needed to repeat this code when
I2C starts calling these functions.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-27 16:41:30 +01:00
Simon Glass c953c32cbd emul: spi: emul_bmi160: Rename 'spi' to 'bus'
Update the language to refer to a bus instead of SPI. This will make it
more applicable with I2C support is added.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-27 16:41:30 +01:00
Viktor Sjölind 1b3abc096c net: lwm2m: Start notify sequence numbers on 0
Some LWM2M backends/servers, such as emxq, expect the sequence numbers
to begin on 0.

This change is in line with how other lwm2m clients, such as Anjay and
Wakama, starts the notification sequence.

Signed-off-by: Viktor Sjölind <viktor.sjolind@endian.se>
2020-10-27 11:25:22 +02:00
Vinayak Kariappa Chettimada b3c9565891 Bluetooth: controller: Remove redundant condition compile
Remove a redundant condition compile.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-26 17:40:08 +01:00
Vinayak Kariappa Chettimada c74438cdfa Bluetooth: controller: Fix arguments unused without Extended Scanning
Fix arguments unused when not enabling Extended Scanning
which was introduced in
commit 0cef1e43c9 ("Bluetooth: controller: Extended
Scanning Coded PHY duration and period").

Fixes #29442.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-26 17:40:08 +01:00
Jukka Rissanen a1b0a98fbf net: context: Add locking to IPv6, CAN and packet socket bind
The commit 93e5181f ("net: context: Add locking for concurrent
access") added net_context locking to only IPv4 sockets.
That is not enough and we need locking also to other supported
socket address families like IPv6, SocketCAN and packet socket.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-10-26 11:03:03 -05:00
Joakim Andersson 999a91e30d Bluetooth: host: Fix application conn param update not started
Fix application conn param update submitted before the timeout of
CONFIG_BT_CONN_PARAM_UPDATE has expired being ignored when
CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=n.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-10-26 16:16:35 +02:00
Joakim Andersson 21b8e08caa Bluetooth: host: Rename update_work to deferred_work
Rename the update_work handler to deferred_work since this handler
is being multiplexed for different kinds of deferred work, not just
updating the connection parameters.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-10-26 16:16:35 +02:00
Joakim Andersson 77b11d6b0c Bluetooth: host: Move auto-initiation of peripheral conn param update
Move auto-initiation of the peripheral connection parameter update,
this handling would only submit the delayed work with the timeout once
all other auto initiated procedures had completed. This behavior means
that the delay would not be set on when the connection was established
but instead relative to the previous procedures.
Based on the connection interval used, the instant(s) used, and the
number of auto procedures this delay becomes indeterminate.

Submit the work once connected, the constraint that existed in the
zephyr link layer earlier about requesting only one control procedure
at a time has been removed.

This also brings all the handling of the timeout work to the connection
state handling, which makes it easier to track this behavior in code.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-10-26 16:16:35 +02:00
Joakim Andersson f4888b1ff6 Bluetooth: host: Allow conn param update delay of 0 milliseconds
Allow the application to set a conn param update delay of
0 milliseconds.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-10-26 16:16:35 +02:00
Joakim Andersson f2a23ee166 Bluetooth: host: Document peripheral bt_conn_le_conn_update behavior
Document the behavior of the bt_conn_le_conn_update API when the
local device is the peripheral role.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-10-26 16:16:35 +02:00
Benjamin Lindqvist 660ad9791b net: lwm2m: Pack TLV integers more efficiently
Prior to this commit, the LwM2M stack would TLV-encode integers
depending on their internal storage size. An integer with value 5 stored
in an int8_t would be encoded with length 1, but an integer stored in an
int32_t would be encoded as "00 00 00 05" with length 4.

This commit checks if the value is castable to a smaller int and encodes
it as such if so. This is cascading, so even a 64 bit integer with value
5 will be encoded with length 1.

Note that this does not seem to be required by the specification, but
this is how Anjay and the other LwM2M stack seem to do it.

Signed-off-by: Benjamin Lindqvist <benjamin.lindqvist@endian.se>
2020-10-26 11:31:28 +02:00
Lingao Meng 27739fcc43 Bluetooth: Mesh: Add queue_size and recv_win to lpn_cb
Add Queue Size and Receive Window information to lpn
callback function to notify upper layer to determine
currently friend node information, which may be used
in future.

Add Callback structure to notification application which friendship
has been changed.

Add function `bt_mesh_friend_terminate` let's app layer determine
terminate friendship manually.

Signed-off-by: Lingao Meng <mengabc1086@gmail.com>
2020-10-24 10:57:45 +03:00
Joakim Andersson 948615d247 Bluetooth: shell: Fix ifdef order in command inclusion
Fix ifdef in command inclusion, in practice this meant that
CONFIG_BT_LL_SW_SPLIT and CONFIG_BT_CTLR_ADV_EXT switched meaning.
Added blank lines so that the commands in shell/ll.c are more
easily visible as group.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-10-23 12:56:39 +02:00
Vinayak Kariappa Chettimada 28d6028127 Bluetooth: controller: Periodic Adv Sync on Coded PHY
Added implementation to be able to establish Periodic
Advertising Sync on Coded PHY.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-23 12:56:13 +02:00
Dominik Ermel 1241e67790 fs: Move fs_file_system_t declaration out of fs.h
The struct fs_file_system_t is only useful when defining file system
drivers and is not required for typical application development,
that is why it has been moved to separate file fs_sys.h.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-10-23 12:55:41 +02:00
Jukka Rissanen 899228bb7f net: icmpv6: Store ll addresses to pkt when sending error msg
When we are sending ICMPv6 error message, we need to store the
link local addresses of the received packet somewhere in order
to know where to send the new error message.
Easiest is to store the ll addresses is to the error message
itself, just before where the sent packet will start in memory.
We cannot use the original pkt to store the ll addresses
as that packet might get overwritten if we receive lot of packets.

Fixes #29398

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-10-23 09:29:27 +03:00
Joakim Andersson d62aefe608 Bluetooth: Kconfig: Default BT_TINYCRYPT_ECC only when not supported
Introduce a support kconfig for controller ECDH command support.
Default to host ECDH emulation in combined host controller build
where the controller does not support these commands.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-10-22 16:12:26 +03:00
Trond Einar Snekvik eca0141152 Bluetooth: Mesh: Isolate cryptographic material
This is a major refactoring of the handling of the cryptographic
material of both the network and transport layers. The aim is to
encapsulate the key object manipulation, and improve overall modularity.

Pulls Applications and Subnets out of the bt_mesh and into separate
modules, with static storage types on the data. This has several
side-effects:
- The Config Server no longer operates directly on the bt_mesh.subs and
  bt_mesh.apps lists, but goes through a public configuration interface,
  following the pattern set in #27908.
- All iteration through the keys is done through iteration APIs
- Key resolution on RX and TX is centralized.
- Changes to the keys triggers events the other modules can register
  handlers for.
- Friendship credentials are stored in the lpn and friend structures.

Part of #27842.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2020-10-22 14:36:02 +03:00
Luiz Augusto von Dentz 2811f0abf7 Bluetooth: shell: Allow passing more than one byte to gatt write
This makes it possible to pass different byte arrays to gatt write
making it usable to test attributes that take more than a single byte.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2020-10-22 13:33:57 +02:00
Luiz Augusto von Dentz b4dceec686 Bluetooth: GATT: Don't start any work until the stack is initilized
This prevents any work to be submitted until the stack is initialized
thus avoiding pointless hash generation, etc, while initializing the
system.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-10-22 14:33:30 +03:00
Emil Gydesen 44f00358a6 Bluetooth: host: PA sync receive enable/disable
Adds support for enabling/disabling PA sync receive,
which allows applications to control when to receive data
while a sync is established.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2020-10-22 13:28:41 +02:00
Luiz Augusto von Dentz 6c67d3cb4b Bluetooth: conn: Fix not cleanup properly if ACL is disconnected
If an ACL connection is disconnected while there is an ISO connection
associated with it the ACL connection will not be cleanup properly as
the code attempt to cleanup the ISO connection and breaks without
proceeding to cleanup the ACL as well.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-10-22 14:26:55 +03:00
Emil Gydesen c29f62e2b8 Bluetooth: host: Removed cb pointer from bt_le_per_adv_sync
The callbacks has been moved from being local to each
bt_le_per_adv_sync object, to being global. The
removal of the pointer in bt_le_per_adv_sync was
missing from that update.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2020-10-22 13:23:01 +02:00
Joakim Andersson b2e56412a7 Bluetooth: shell: Fix shell build with out-of-tree controller
Fix shell build errors when building with combined host and controller
but the selected controller is not the in-tree zephyr controller, i.e
CONFIG_BT_CTLR=y, CONFIG_BT_LL_SW_SPLIT=n and cmd_scanx and others
are not defined.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-10-22 13:18:35 +02:00
Lingao Meng 4acfd5f6af Bluetooth: Mesh: Change the default value to Kconfig
Move default value of segment retransmit and timeout value
to Kconfig.

Signed-off-by: Lingao Meng <mengabc1086@gmail.com>
2020-10-22 14:13:49 +03:00
Lukasz Maciejonczyk 06fdea7ec8 net: config: Fix improper condition in net_config_init
Currently, there is a case for net_config_init function that for
timeout==0 and when iface is already up, the ip setup is not proceed
and the error message "Timeout while waiting network..." is logged.

This commit fixes it.

Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
2020-10-22 12:33:12 +03:00
Emil Hammarstrom ec00feef35 net: lib: sockets: added ALPN extension option to TLS
Adds the socket option TLS_ALPN_LIST for SOL_TLS sockets

Passes the configured alpn list to the mbedtls config
on mbedtls init

Signed-off-by: Emil Hammarstrom <emil.hammarstrom@assaabloy.com>
2020-10-22 11:35:43 +03:00
Jukka Rissanen 0f9ec427bc net: tcp2: Lock conn when sending data from work queue
If we are sending data directly, we already have TCP lock so
there is no need to do any locking. But when data is re-sent,
the work queue handler is doing the sending so we need to lock
the TCP connection.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-10-21 12:57:23 -05:00
Jukka Rissanen 735fcc63bf net: tcp2: Pass data to application without any TCP locks
When receiving data that needs to be passed the data to application,
queue it for short time so that we do not have TCP connection lock
held. This way if the application wants to send data, there is no
possibility that the connection lock would prevent sending data.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-10-21 12:57:23 -05:00
Jukka Rissanen 6003c988e1 net: context: Release lock before passing RX data to socket
Release the context lock before passing data to the application
socket as that might cause deadlock if the application is run
before the RX thread and it starts to send data and if the RX
thread is never able to run (because of priorities etc).

Fixes #29347

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-10-21 12:57:23 -05:00
Siddharth Chandrasekaran 4640bafca6 mgmt/osdp: Fix early check of no-data that holds PD online
When waiting for data from CP, the data timeout check must happen before
no-data check. If not, a partial packet may endlessly hold PD in
"wait-for-data" state, while the PD keeps reporting status as online
till another packet is received.

Fix this my moving no-data check below the timeout check.

Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
2020-10-21 17:36:16 +02:00
Siddharth Chandrasekaran 8d012aace9 mgmt/osdp: CP: Reset channel before sending a command
Flush channel of any existing partial packets before sending a new
command.

Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
2020-10-21 17:36:16 +02:00
Siddharth Chandrasekaran 23c0c77049 mgmt/osdp: Skip all incoming bytes till start of new packet
All OSDP packets must start with a mark byte (0xFF) followed by a Start
of Message byte (0x53). Skip all bytes received until such a sequence is
seen to to avoid waking up the refresh thread needlessly.

Also, refactor osdp_uart_isr() to reduce number of local variables.

Fixes: #28168 Coverity-ID: 214218

Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
2020-10-21 17:36:16 +02:00
Siddharth Chandrasekaran d6437c1aa1 mgmt/osdp: CP: Unify osdp_cp_send_cmd_*() as osdp_cp_send_command()
Minimize number of exported methods by unifying all osdp_cp_send_cmd_*()
as osdp_cp_send_command().

Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
2020-10-21 17:36:16 +02:00
Siddharth Chandrasekaran f0b43a4dfa mgmt/osdp: CP: Add COMSET command
Add osdp_COMSET command to set PD communication parameters.

Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
2020-10-21 17:36:16 +02:00
Emil Hammarstrom 746ba2dd9c logging: make log_backend_std header public
Exported header oftenly used when creating a logging
backend that inpects the log 'stream'.
Enables use in external Zephyr modules implementing the
logging backend interface.

Signed-off-by: Emil Hammarstrom <emil.hammarstrom@assaabloy.com>
2020-10-21 10:21:05 -04:00
Jukka Rissanen 1807e93697 net: tcp: Deprecate legacy TCP stack
Mark the legacy TCP stack as deprecated and expect it to be
removed in 2.6 release.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-10-21 10:08:48 -04:00
Lukasz Maciejonczyk 102084f873 net: openthread: Add Kconfigs to change values in Zephyr port
Refactor openthead zephyr config file. Add missing KConfigs.

Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
2020-10-21 16:09:56 +03:00
Lukasz Maciejonczyk 2015eab033 net: openthread: Remove unused defines from platform configuration
These defines are leftover of old platform settings implementation
and are not used any more.

Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
2020-10-21 16:09:56 +03:00
Lauren Murphy b82efb343e ec_host_cmd: Fix unused return value from k_sem_take call
Fixes Coverity issue 214881.

Fixes #29018

Signed-off-by: Lauren Murphy <lauren.murphy@intel.com>
2020-10-21 06:28:09 -05:00
Vinayak Kariappa Chettimada 1bb4e6caa5 Bluetooth: controller: Use conversion macros for duration and period
Use conversion macros to convert Extended Scan duration and
period to radio event counts.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-21 12:44:38 +02:00
Vinayak Kariappa Chettimada 0cef1e43c9 Bluetooth: controller: Extended Scanning Coded PHY duration and period
Added implementation to support simultaneous 1M and Coded
PHY Extended Scanning duration and period. Also, added
implementation to support update to duration and period of
an active scanning instance.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-21 12:44:38 +02:00
Vinayak Kariappa Chettimada a5be61dede Bluetooth: controller: Fix the ll_scan_enable signature
Fix the ll_scan_enable interface signature, place duration
before period parameter to reflect the order as in the HCI
LE Set Extended Scan Enable command.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-21 12:44:38 +02:00
Vinayak Kariappa Chettimada bc34d06c82 Bluetooth: controller: Use defines in place of magic numbers
Use defines for Extended Scan duration, period and scan
interval units.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-21 12:44:38 +02:00
Vinayak Kariappa Chettimada b3ac86f37f Bluetooth: controller: Extended Scan with duration and period
Added implementation for Extended Scanning with duration
and period parameters.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-21 12:44:38 +02:00
Vinayak Kariappa Chettimada d91b441685 Bluetooth: controller: Revert ticker status check
Revert the added ticker status busy check.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-21 12:44:38 +02:00
Vinayak Kariappa Chettimada 896c20188a Bluetooth: controller: Fix scan done generation
Fix scan done to be generated when the window is closed
both under abort and graceful window close.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-21 12:44:38 +02:00