Commit graph

566 commits

Author SHA1 Message Date
Théo Battrel e458f5aae6 Bluetooth: Use Zephyr standard log system instead of bluetooth/common/log
The `bluetooth/common/log.h` and `bluetooth/common/log.c` files have been
removed. Files that were using them have been updated to use
`zephyr/logging/log.h` instead.

Those replacement have been done consequently:
- `/BT_DBG/LOG_DBG/`
- `/BT_ERR/LOG_ERR/`
- `/BT_WARN/LOG_WRN/`
- `/BT_INFO/LOG_INF/`
- `/BT_HEXDUMP_DBG/LOG_HEXDUMP_DBG/`
- `/BT_DBG_OBJ_ID/LOG_DBG_OBJ_ID/`

Also, some files were relying on the `common/log.h` include to include
`zephyr/bluetooth/hci.h`, in those cases the include of `hci.h` has
been added.

For files that were including `common/log.h` but not using any logs,
the include has been removed and not replaced.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2022-11-25 17:08:36 +01:00
Aleksander Wasaznik 17fc4b811c Bluetooth: Replace 'bt_addr_le_cmp(x) != 0' with 'bt_addr_le_eq(x)'
These should be equivalent. The '_eq'-form is more readable.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2022-10-19 15:40:18 +03:00
Aleksander Wasaznik ea558187b5 Bluetooth: Replace bt_addr_le_cmp in bool context with !bt_addr_le_eq
These should be equivalent. The new form is more readable.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2022-10-19 15:40:18 +03:00
Aleksander Wasaznik 21e5dcb42a Bluetooth: Replace 'bt_addr_le_cmp(x) == 0' with 'bt_addr_le_eq(x)'
These should be equivalent. The '_eq'-form is more readable.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2022-10-19 15:40:18 +03:00
Krzysztof Kopyściński aa0c52f212 tests: bluetooth: tester: Improve stability of MESH/NODE/TNPT/BV-05-C
IUT is requested to send 2 multi-segmented model messages. In mean time,
third may be sent from Config Model Publication Status may be sent,
which is also segmented. One of the 3 messages will fail to be sent,
but test is passing if it is Status one. Let's increase number of
possible concurrent transmissions to allow all three messages to be
sent.

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2022-10-13 09:56:38 +02:00
Anders Storrø 36e34fce41 Bluetooth: Mesh: Add CDB depend on to prov Kconfig
The current implementation of provisioning features is dependent on CDB
to compile, which is reflected poorly in the Kconfig options for mesh.

This commit alters the Kconfig options for provisioning to be dependent
on the CDB option to compile.

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
2022-09-06 12:35:48 +02:00
Gerard Marull-Paretas 79e6b0e0f6 includes: prefer <zephyr/kernel.h> over <zephyr/zephyr.h>
As of today <zephyr/zephyr.h> is 100% equivalent to <zephyr/kernel.h>.
This patch proposes to then include <zephyr/kernel.h> instead of
<zephyr/zephyr.h> since it is more clear that you are including the
Kernel APIs and (probably) nothing else. <zephyr/zephyr.h> sounds like a
catch-all header that may be confusing. Most applications need to
include a bunch of other things to compile, e.g. driver headers or
subsystem headers like BT, logging, etc.

The idea of a catch-all header in Zephyr is probably not feasible
anyway. Reason is that Zephyr is not a library, like it could be for
example `libpython`. Zephyr provides many utilities nowadays: a kernel,
drivers, subsystems, etc and things will likely grow. A catch-all header
would be massive, difficult to keep up-to-date. It is also likely that
an application will only build a small subset. Note that subsystem-level
headers may use a catch-all approach to make things easier, though.

NOTE: This patch is **NOT** removing the header, just removing its usage
in-tree. I'd advocate for its deprecation (add a #warning on it), but I
understand many people will have concerns.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-09-05 16:31:47 +02:00
Michal Narajowski 5c27067dcd Bluetooth: Mesh: Align Config Client API with Health Client API
This PR adds a `*_cli_*` infix to the Config Client API to match
the changes in Health Client. The old API is marked as deprecated.

Signed-off-by: Michal Narajowski <michal.narajowski@codecoup.pl>
2022-09-05 13:56:25 +03:00
Herman Berget 8873b7f05d Bluetooth: Tests: Use chan_opt BT_ATT_CHAN_ANY
The chan_opt field of GATT parameter structs must be set.

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2022-08-19 11:59:52 +02:00
Gerard Marull-Paretas aa1d2cf3d0 tests: bluetooth: initialize devices at compile time
Initialize devices at compile time, allowing to constify device pointer.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-19 11:51:26 +02:00
Krzysztof Kopyściński f71741cea0 tests: bluetooth: tester: add support for testing Multiple Notifications
Enabled Multiple Notifications and added command for
bt_gatt_notify_multiple().

Increased possible number of connections to execute GATT/SR/GAN/BV-02-C

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2022-08-05 13:01:46 +02:00
Michal Narajowski fab8e29ee2 Bluetooth: Mesh: Add model publish support to Health Client
Mesh Profile Specification errata 11310
Section 4.4.4.1
"This model shall support model publication, as defined in Section
4.2.2 of the Mesh Profile specification and model subscription,
as defined in section 4.2.3 of the Mesh Profile specification."

Signed-off-by: Michal Narajowski <michal.narajowski@codecoup.pl>
2022-08-01 18:04:42 +01:00
Michal Narajowski e98df9f160 tests: bluetooth: tester: Fix Health Fault Test command
The buffer for response was too small.

Signed-off-by: Michal Narajowski <michal.narajowski@codecoup.pl>
2022-08-01 18:04:42 +01:00
Benjamin Björnsson 33b43547e8 tests: bluetooth: bttester: Update test to use DEVICE_DT_GET
Update test to use DEVICE_DT_GET in order to remove usage of
device_get_binding.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-27 18:44:22 +02:00
Pieter De Gendt aba4c4ea3e uart_pipe: move driver from console to serial
The uart_pipe driver is not dependent on any console driver,
however a serial driver is required.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2022-07-07 09:59:49 +02:00
Krzysztof Chruscinski 041f0e5379 all: logging: Remove log_strdup function
Logging v1 has been removed and log_strdup wrapper function is no
longer needed. Removing the function and its use in the tree.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-06-23 13:42:23 +02:00
Herman Berget 63c68dbbbb Bluetooth: Tester: Add support for EATT connection
A new command is added to connect EATT channels.

Affects L2CAP/TIM/BV-03-C, which tests requirements on ATT.

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2022-06-17 10:48:05 -05:00
Alperen Sener 12e57d414c tests/bluetooth/tester: Set mesh message cache size to 10
MESH/NODE/RLY/BI-02-C case requires cache size of 10

Signed-off-by: Alperen Sener <alperen.sener@nordicsemi.no>
2022-06-05 14:45:24 +02:00
Gerard Marull-Paretas ade7ccb918 tests: migrate includes to <zephyr/...>
In order to bring consistency in-tree, migrate all tests to the new
prefix <zephyr/...>. Note that the conversion has been scripted, refer
to #45388 for more details.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-06 20:02:14 +02:00
Michał Narajowski 54cd46ac68 tests/bluetooth/tester: Refactor Read UUID callback
ATT_READ_BY_TYPE_RSP returns Attribute Data List so handle it in the
application.

This affects GATT/CL/GAR/BV-03-C.

Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
2022-04-26 17:38:53 +02:00
Szymon Janc 218225b17a tests/bluetooth/tester: Disable EATT autoconnect
Don't autoconnect EATT as this was confusing PTS and resulted in
multiple tests failures. When needed PTS will connect EATT bearer.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2022-04-07 19:06:41 +02:00
Lingao Meng 20ff55e234 Bluetooth: host: Optimize L2CAP resource usage
Making sure struct bt_l2cap_chan has absolutely no members related
to dynamic channels.

That way we ensure that there is no overhead for a build where only
fixed channels are used.

It's not enough that the dynamic channel-related members are put behind
ifdefs - they should be completely moved out from the struct definition.

Furthermore, the public l2cap.h header file already has a struct
that's meant to be used for dynamic channels: struct bt_l2cap_le_chan!

However, currently dynamic channel support is a mess - it's a mix
between these two structs. The bt_l2cap_le_chan struct should really
be an extension of the bt_l2cap_chan struct, i.e. the former should
contain as a member the latter.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2022-04-07 09:37:12 +02:00
Emil Gydesen 9c2cf4ded5 Bluetooth: Host: Add auth_info_cb struct
Add a new callback structure for Bluetooth authentication

This struct is meant to replace the information-only
callbacks in bt_conn_auth_cb. The reason for this is that
due to the nature of bt_conn_auth_cb, it can only be registered
once. To allow mulitple users gain information about pairing
and bond deletions, this new struct is needed.

Samples, tests, etc. are updated to use the new struct.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-03-25 15:17:18 -07:00
Szymon Janc 573c0d59e0 tests/bluetooth/tester: Add support for auto connection establishment
autopts was updated to properly require support for Accept Filter List
in Auto Connection Establishment Procedure related tests. This patch
enabled support for it and adds required BTP support.

This was affecting following qualification test cases:
GAP/CONN/ACEP/BV-03-C
GAP/CONN/ACEP/BV-04-C

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2022-03-24 10:45:49 +01:00
Szymon Janc e932564f3a tests/bluetooth/tester: Enable security validation for GATT subsciption
This was affecting following qualification test cases:
GAP/SEC/SEM/BV-56-C
GAP/SEC/SEM/BV-57-C
GAP/SEC/SEM/BV-58-C
GAP/SEC/SEM/BV-59-C
GAP/SEC/SEM/BV-60-C
GAP/SEC/SEM/BV-61-C

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2022-03-21 10:14:53 +01:00
Szymon Janc 0b01cf14e1 tests/bluetooth/tester: Add support for rejecting connection parameters
This is required for GAP/CONN/CPUP/BV-05-C qualification test.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2022-02-25 10:09:09 -08:00
Szymon Janc 3cbec153b2 tests/bluetooth/tester: Add support for multiple GATT subscriptions
This is required by GATT/CL/GAI/BI-01-C qualification test.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2022-02-25 10:08:45 -08:00
Szymon Janc 382e53c255 tests/bluetooth/tester: Fix possible buffer overflow
Make sure we have enough space for notification data.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2022-02-25 10:08:45 -08:00
Szymon Janc c631469539 tests/bluetooth/tester: Allocate L2CAP channel only when needed
This fix leaking channels when autorization or key size are tested.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2022-02-22 10:23:33 +01:00
Szymon Janc 4b40915004 test/bluetooth/tester: Don't clear auth requirements on L2CAP server
We have single server but it can accept multiple connections so
keep same requirements for all connection attempts.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2022-02-22 10:23:33 +01:00
Michał Narajowski da1663ed3b test/bluetooth/tester: Use Health Client Unack API
Unacknowledged API is now separate from Ack.

Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
2021-12-16 10:15:36 +01:00
Krzysztof Kopyściński 0f6dc7a3cd bluetooth: tester: allow to set DisplayYesNo IO capability
This allows us to run SCPK tests with it.

signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2021-12-15 15:08:37 +01:00
Jordan Yates df327eeb58 net: buf: POOL_FIXED_DEFINE explicit user data
Update the macro prototype to explicitly require the length of the
desired user data. Update all in-tree usage of this macro.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-11-24 16:04:50 +02:00
Johan Lundin 403fbfcc12 Bluetooth: Adds preprocessor to L2CAP tester app
Adds preprocessor ifdefs to reconfigure() in L2CAP tester application
depending on the KConfig option CONFIG_BT_L2CAP_ECRED
Fixes issue #40456

Signed-off-by: Johan Lundin <johan.lundin@nordicsemi.no>
2021-11-22 23:10:47 -05:00
Szymon Janc d268c99266 test/bluetooth/tester: Re-pair on lost bond
If IUT is acting as a central device and peer lost bond we need
to re-pair to restore bond. PTS is not sending any WID for this
so bonding needs to be initiated implicitly by IUT.

This was affecting GAP/SEC/AUT/BV-25-C qualification test case.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2021-11-19 20:11:34 +01:00
Herman Berget 49c2c37417 tests: bluetooth: tester: Reading multiple variable length
Adds support for reading multiple variable length characteristics.
Previously read_multiple() always set the variable flag to false.

This is used by GATT/CL/GAT/BV-03-C.

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2021-11-13 07:54:27 -05:00
Szymon Janc d80e480f20 tests: bluetooth: tester: Add support for advertising with target RPA
This allows to do directed advertising with peer address set to RPA.
To do this according to specification IUT must first read Central
Address Resolution characteristic to check if peer supports it.

This is affecting GAP/CONN/DCON/BV-05-C qualification test.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2021-11-09 19:54:30 -05:00
Szymon Janc 03487ec592 tests: bluetooth: tester: Adjust Directed Advertising to latest BTP
This makes implementation in sync with autopts.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2021-11-09 19:54:30 -05:00
Szymon Janc 5f16b9ce83 tests: bluetooth: tester: Fix not marking chan as unused on disconnect
This fix not being able to re-connect channel after disconnect.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2021-11-08 11:06:51 -05:00
Szymon Janc 7e0502ebe3 tests: bluetooth: tester: Add support for pairing failed event
This event is sent if pairing failed.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2021-11-01 21:48:52 -04:00
Szymon Janc d0b02cde2c tests: bluetooth: tester: Fix NULL pointer dereference in error path
bt_conn_unref() requires valid conn pointer but could be called with
NULL in case valid connection was not found in disconnect_eatt_chans().

Fixes #39851

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2021-10-29 10:12:55 -04:00
Anas Nashif 59648f9001 tests: bluetooth: tester: reference autoPTS in README
Reference autoPTS documentation with more details on how to use this
test.

Fixes #1251

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-10-25 08:02:58 -04:00
Szymon Janc 349f9dfc71 tests: bluetooth: tester: Fix memory corruption in reconfigured_cb
Pass proper length when memsetting struct.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2021-10-25 12:23:14 +03:00
Jacob Siverskog 046f29a8cb Bluetooth: ATT: Fix typo in defines
Fix typo in ATT first/last attribute defines.

Signed-off-by: Jacob Siverskog <jacob@teenage.engineering>
2021-10-23 20:39:36 -04:00
Ilhan Ates 69abe7de8c Bluetooth: tester: Add directed adv support
GAP/CONN/DCON/BV-01-C test case needs directed advertising
support.

Signed-off-by: Ilhan Ates <ilhan.ates@nordicsemi.no>
2021-10-22 16:38:13 +02:00
Szymon Janc d7b37d8cc8 tests: bluetooth: tester: Increase ATT prepare write buffers count
GATT/SR/GAW/BV-10-C requires more buffers as it tests nested long
writes.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2021-10-22 16:37:38 +02:00
Szymon Janc 8a780680ad tests: bluetooth: tester: Add support for security_changed callback
This allows to track security levels and check for lost bond of peer
peripherals.

This was affecting GAP/SEC/AUT/BV-21-C qualification test.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2021-10-22 16:37:23 +02:00
Szymon Janc 17c01328b1 tests: bluetooth: tester: Add support for L2CAP channels options
This allows for better control over IUT behaviour by Upper Tester.

PTS and TS require inconsistent behaviour in terms of how IUT should
return credits. Some tests require return on explicit UT request and
some require that IUT returns credits autonomously.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2021-10-18 12:44:46 +02:00
Michał Narajowski 5d0f2fbc1d tests: bluetooth: tester: Adjust Segment Retransmit Count
In test cases MESH/NODE/TNPT/BV-04-C and MESH/NODE/TNPT/BI-01-C
the PTS is sending incomplete Seg Ack 3 times and in some cases we run
out of retransmit attempts before PTS sends complete Seg Ack. As a
workaround, increase Segment Retransmit Count to improve stability of
these tests.

Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
2021-10-07 15:45:22 -04:00
Michał Narajowski 4cb935f264 tests: bluetooth: tester: Set Config Client timeout to larger value
In some scenarios when there is a need for multiple re-transmissions of
segmented messages the default value of 2 seconds may be not enough.

In my experience this improves stability of Configuration Client tests
involving multiple PTS instances.

Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
2021-10-06 22:20:22 -04:00
Szymon Janc ab6c090d74 tests: bluetooth: tester: Add support for L2CAP channel reconfiguration
This allows UT to reconfigure MTU of a channel and get notfied when
channel configuration changed.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2021-10-04 11:05:03 +02:00
Szymon Janc 6cfc6fa8e1 tests: bluetooth: tester: Add support for L2CAP Credits command
This allows IUT to return credits on specified L2CAP channel when
requested by Upper Tester.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2021-09-30 08:28:34 -04:00
Agata Ponitka bd8b9ee830 Bluetooth: Tester: Add the OOB Authentication method
Adding support for automatic testing OOB Authentication method.

Signed-off-by: Agata Ponitka <agata.ponitka@codecoup.pl>
2021-09-28 11:44:33 +02:00
Szymon Janc 24007fb2ad tests: bluetooth: tester: Fix build with EATT disabled
For ECFC L2CAP test we user overlay with disabled EATT and
bt_eatt_disconnect_one() is available only with EATT enabled.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2021-09-15 16:58:06 +02:00
Krzysztof Kopyściński fa2f83bf8b Bluetooth: host: add testing API (disconnect one EATT channel)
To test fallback to remaining bearers PTS might request IUT to
disconnect one of the connected EATT channels, while the others remain
intact. Test function must be added, because we cannot create L2CAP
server on EATT PSM and manage this server as normal and have EATT
enabled at same time.

This is affecting GATT/SR/GAW/BV-14-C

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2021-09-09 10:30:31 +02:00
Krzysztof Kopyściński 7a687b8a5d Tests: bluetooth: tester: accomodate L2CAP connect commant to BTP change
BTP change extended L2CAP_CONNECT command by ECFC flag, which determines
which connection procedure is used (non-enhanced or ecred). Now, only
this flag determines the procedure used, not number of requested
channels.

This was affecting L2CAP/ECFC/BV-25-C

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2021-09-09 10:28:10 +02:00
Krzysztof Kopyściński bd068e475d Tests: bluetooth: tester: find connection for get_attr_val_rp
To check security of connection  in read_value() we need to actually
pass connection not NULL.

This is affecting GATT/SR/GAR/BI-11-C

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2021-09-06 09:23:06 -04:00
Trond Einar Snekvik 2435419416 tests: bluetooth: mesh: Remove dead code
Removes all the dead ternary expressions in the mesh bluetooth tester.

Fixes #37983.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2021-08-31 11:03:06 -04:00
Michał Narajowski a614fc02ad Bluetooth: tester: Configure L2CAP Connection Response
Some test cases require the IUT to respond with a certain error. To get
the stack to return this error to PTS the application needs to be
configured specifically for this test case.

Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
2021-08-30 14:40:59 +02:00
Krzysztof Kopyściński c94e53c9f5 Tests: bluetooth: tester: increase CONFIG_BT_ATT_PREPARE_COUNT
This is required for GATT/SR/GAW/BV-14-C

signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2021-08-21 21:34:08 -04:00
Torsten Rasmussen 1cccc8a8fe cmake: increase minimal required version to 3.20.0
Move to CMake 3.20.0.

At the Toolchain WG it was decided to move to CMake 3.20.0.

The main reason for increasing CMake version is better toolchain
support.

Better toolchain support is added in the following CMake versions:
- armclang, CMake 3.15
- Intel oneAPI, CMake 3.20
- IAR, CMake 3.15 and 3.20

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-08-20 09:47:34 +02:00
Krzysztof Kopyściński 00bfac00ae Bluetooth: gatt: Add option to read multiple without variable length
Currently, with EATT enabled, when bt_gatt_read is called with multiple
handles first it'll try to use gatt_read_mult_vl, and if it fails
gatt_read_mult will be used to try again. Add option to skip
the gatt_read_mult_vl and use gatt_read_mult right away. This is needed
by tests that expect BT_ATT_OP_READ_MULT_REQ but support variable
lenght, thus don't return BT_ATT_ERR_NOT_SUPPORTED.

Removed fallback from read multiple vl to read multiple on
BT_ATT_ERR_NOT_SUPPORTED error.

This was affecting:
GATT/CL/GAR/BV-05-C, GATT/CL/GAR/BI-18-C, GATT/CL/GAR/BI-19-C,
GATT/CL/GAR/BI-20-C, GATT/CL/GAR/BI-21-C, GATT/CL/GAR/BI-22-C

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2021-08-12 11:07:08 -04:00
Lingao Meng ce40fa434f tester: bluetooth: gatt: fix null pointer case CASE failed
GATT/SR/GAD/BV-03-C will read attr value, but we parse NULL
from `attr->read` which point to `attr_read` function.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-08-05 17:34:57 +02:00
Lingao Meng 36a385386a Tester: Bluetooth: Mesh: Rename function avoiding conflict
Since `write` or `read` belong with system standard API, so rename
this to avoiding conflict.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-08-03 10:21:16 -04:00
Lingao Meng 3911ce8d40 Bluetooth: Mesh: Mark as internal function
Marks funcs:`show_faults` as internal, avoiding conflict.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-08-03 10:21:16 -04:00
Krzysztof Kopyściński c8a196c65b Tests: Bluetooth: Tester: enable EATT by default
Since Zephyr supports EATT, which is reflected in ICS GATT_2_3
(Enhanced ATT bearer Attribute Protocol Supported (L2CAP fixed EATT PSM
supported) and GATT_2_3a (Enhanced ATT bearer supported over LE)
in GATT tests preamble 4.2.1.4 (Setup EATT Bearer over LE) is used
instead of 4.2.1.2 (Setup ATT Bearer over LE). Let's enable
EATT by default, allowing to run almost all GATT tests without
additional overlay.

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2021-08-03 13:56:41 +02:00
Michał Narajowski 0bca465cab Bluetooth: tester: Add Bond Lost API
In GAP/SEC/AUT/BV-22-C the IUT needs to inform the Upper Tester about a
lost bond.

Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
2021-07-23 14:43:01 +03:00
Agata Ponitka 0f61c0c65f Bluetooth: tester: Add Key Refresh Procedures tests support
Add support for automatic testing of KRP.

Signed-off-by: Agata Ponitka <agata.ponitka@codecoup.pl>
2021-07-22 22:41:32 +03:00
Agata Ponitka 1dbfc40705 Bluetooth: tester: Add provisioner support
Add provisioning procedure for automatic testing.

Signed-off-by: Agata Ponitka <agata.ponitka@codecoup.pl>
2021-07-22 22:41:32 +03:00
Agata Ponitka 41024b60eb Bluetooth: tester: Add Mesh Health Client Model tests support
Add support for automatic testing of Mesh Health Client Models.

Signed-off-by: Agata Ponitka <agata.ponitka@codecoup.pl>
2021-07-22 22:41:32 +03:00
Agata Ponitka b89003df86 Bluetooth: tester: Add Mesh Configuration Client tests support
Add support for automatic testing of Mesh Configuration Client Models.

Signed-off-by: Agata Ponitka <agata.ponitka@codecoup.pl>
2021-07-22 22:41:32 +03:00
Ingar Kulbrandstad 3ec6411c7f Bluetooth: Mesh: Align capitalization for BT mesh
Align the capitalization of the term "Bluetooth Mesh" to Bluetooth mesh"
in the documentation. This is done to to match the new updated naming
convention done in Bluetooth SIG. In the upcoming spec versions, it its
used "Bluetooth mesh" with the lower case convention.

Signed-off-by: Ingar Kulbrandstad <ingar.kulbrandstad@nordicsemi.no>
2021-07-13 11:23:54 -04:00
Lingao Meng 1447e796bc Tester: Add support ble auto-tester on native posix
The purpose of this PR is to automatically test the
host in the native environment.

It is used to simulate /dev/tty*, can replace by /dev/pts/*.
Also, device log will be output to stdio by default.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-06-28 20:14:32 -04:00
Krzysztof Kopyściński 79a3a0f40b bttester: add key-size and authorization based l2cap conn reject
In tests that expect returning error in response for l2cap
connection request we use predefined PSMs. This commit adds
check for required keysize (which will always return error,
as connection is not secure and key size will always be 0)
instead of setting security level 4 (which would return
insufficient authentication, not insufficient key size).
It also adds suport for PSM used in insufficient authorization
tests - choosing this PSM will set flag that triggers error
on channel accept.

This affects tests L2CAP/LE/CFC/BV-[10-15]-C

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2021-05-19 12:18:08 +03:00
Joakim Andersson b8c5eda2d2 Bluetooth: tester: Update tester to reserve bytes for an L2CAP SDU
Update the tester application to correctly reserve the number of bytes
needed for an L2CAP SDU.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-05-06 14:56:18 +02:00
Krzysztof Kopyściński ae935a7a37 Bluetooth/tester: fix coverity issue in l2cap
i is of uint type, so it'll never be negative. Thus, while loop
condition i >= 0 will always be true.
This patch also fixes issue with marking unused l2cap channels
as free by freeing only these that were marked as in_use by
get_free_channel(), and not all of them.

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2021-05-05 16:03:22 +02:00
Joakim Andersson de60823d9a Bluetooth: tester: fix bt_le_oob_set_legacy_tk excluded when supported
Fix bt_le_oob_set_legacy_tk excluded when Legacy OOB pairing is
supported. We still support legacy OOB when
CONFIG_BT_SMP_OOB_LEGACY_PAIR_ONLY is not defined.
It is only when we disable Legacy pairing that it is not included.

Check that the OOB data type is in fact Legacy OOB before calling
bt_le_oob_set_legacy_tk.

Log an error if the OOB type was not handled by the callback.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-05-03 10:00:44 +02:00
Michał Narajowski 00681f0241 Bluetooth: tester: Implement Provisioning Node Added event
This information is useful to the automation framework when implementing
tests where the IUT is the provisioner and the test uses two PTS
instances.

Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
2021-04-28 11:13:45 -04:00
Krzysztof Kopyściński 97f992c470 Bluetooth/tester: connect L2CAP using Enhanced Credit Flow Control
This change adds field to L2CAP connect command allowing to choose
ECFC in L2CAP connect() function and adds required logic to perform
such connection.

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2021-04-16 15:32:48 -04:00
Emil Gydesen 42da370df5 Bluetooth: Use ATT FIRST/LAST attribute handle defines where applicable
Change to use the BT_ATT_FIRST_ATTTRIBUTE_HANDLE and
BT_ATT_LAST_ATTTRIBUTE_HANDLE instead of the literal values where
applicable.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-04-08 16:35:57 +02:00
Joakim Andersson 122320f5bd Bluetooth: tester: Revert "Fix an error response in tester"
This reverts commit 24784b1452.

The change appears to have been submitted twice in different PRs.
The correct change is: 76789883e2

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-04-07 13:54:42 +03:00
Krzysztof Kopyściński 806ca8f78d bluetooth/tester: give data buffer for each L2CAP channel
L2CAP channels are allocating buffers from common data_pool. For that
pool buffer count was hard-coded as 1. This count should be set to value
CHANNELS, allowing each channel to allocate buffer for incoming
data. Without this change, execution would stuck at l2cap_chan_le_recv()
as we give net_buf_alloc() in alloc_buf_cb() no timeout.

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2021-04-06 15:30:47 +02:00
Jun Huang 24784b1452 Bluetooth: tester: Fix an error response in tester
In the function conn_param_update, it should send the opcode
GAP_CONN_PARAM_UPDATE, instead, it send GAP_PASSKEY_ENTRY.

Signed-off-by: Jun Huang <huangjun6@xiaomi.com>
2021-03-26 15:31:29 -04:00
Krzysztof Kopyściński 714239ba13 Bluetooth: tester: fix build with BT_SMP_SC_ONLY
bt_le_oob_set_legacy_tk is not defined with this
setting and this code is reachable only for legacy pairing

signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2021-03-26 15:29:31 -04:00
Ryan Chu 5c0544aa9d Bluetooth: tester: Reserve BT buffer for different HCI transports
With this change, L2CAP/LE/CFC/BV-06-C can be supported when using
BT_RPMSG and the others HCI transports.

Depending on CONFIG_BT_HCI_RESERVE, the HCI transport requires extra
headroom in a BT buffer.

Signed-off-by: Ryan Chu <ryan.chu@nordicsemi.no>
2021-03-26 08:26:21 -04:00
Andrzej Głąbek 031aeb2bd9 tests: bluetooth: tester: Remove assignment to CONFIG_LOG_MINIMAL
The LOG_MINIMAL option is no longer user-configurable, as now it has
no prompt. LOG_MODE_MINIMAL should be modified instead.
But in this case, the assignment is redundant, as this option is not
enabled by default. Remove it then, to align the configuration file
for nrf5340dk_nrf5340_cpuapp with the one for nrf52840dk_nrf52840.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-03-18 06:17:45 -04:00
Ayturk Duzen 99f53662dc Bluetooth: tests: Add nrf5340 support to tester
Add missing boards nrf5340dk_nrf5340_cpuapp.conf and
nrf5340dk_nrf5340_cpuapp.overlay files

Signed-off-by: Ayturk Duzen <ayturk.duzen@nordicsemi.no>
2021-03-04 13:00:04 +01:00
Michał Narajowski b386853367 Bluetooth: tester: Implement Friend and LPN callbacks
Use these callbacks to send BTP events. They are useful for test
automation in auto-pts.

Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
2021-01-15 11:14:24 -05:00
Michał Narajowski d4247b3503 Bluetooth: tester: Set LPN Poll timeout to smaller value
Smaller poll timeout means shorter test time.

Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
2021-01-15 11:14:24 -05:00
Michał Narajowski 71577b2d98 Bluetooth: tester: Use Linux Foundation Company ID
PTS now does not accept 0xffff as a company ID so set it to Linux
Foundation ID.

Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
2021-01-15 11:14:24 -05:00
Pavel Vasilyev 561a8e4f0e Bluetooth: Mesh: Break up mesh settings
The mesh settings.c module is a giant piece of code responsible for
storing the mesh stack configuration. Such approach makes it difficult
to control the data to be stored, breaks the stack modules'
encapsulation by forcing them to reveal the internal kitchen, which
leads to unpleasant issues such as #19799.

This commit moves the responsibility of storing the configuration
to corresponding modules while keeping control of the moment of storing
the configuration and of starting the stack after the settingss loading
is completed.

This doesn't introduce any abstraction between the mesh settings.c and
other modules as it will add more complexity and overhead than necessary
for the actual task.

Fixes #19850

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2021-01-14 16:38:50 +02:00
Michał Narajowski ead46e029f Bluetooth: tester: Fix net send command
After change 7e302979f3 some
MESH/NODE/NET/ tests would fail because we tried to send a message to a
non-unicast address using the device key. This patch fixes that by
defining and adding an app key for vendor model which is then used to
send network packets for these test cases.

Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
2020-12-16 12:17:03 -05:00
Jun Huang 76789883e2 Bluetooth: tester: Fix an error response in tester
In the function conn_param_update, it should send the opcode
GAP_CONN_PARAM_UPDATE, instead, it send GAP_PASSKEY_ENTRY.

Signed-off-by: Jun Huang <huangjun6@xiaomi.com>
2020-12-03 12:16:04 +02:00
Jordan Yates ffab099eb9 Bluetooth: add destroy callback to indication
Adds a `destroy` callback to the `struct bt_gatt_indicate_params` which
is used to signify to the application that the indication operation has
completed and the struct instance can be freed/destroyed.

This is required as the number of indication value callbacks that will
be triggered is not known by the caller when the `conn` parameter is
`NULL`.

Tracking when this callback should be run is mananged by a private
reference counter inside the struct.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-11-10 11:21:46 +01:00
Jordan Yates 170f17e0e7 Bluetooth: indication callback signature update
Update the signature of the `bt_gatt_indicate_func_t` callback type by
replacing the attr pointer with a pointer to the
`bt_gatt_indicate_params` struct that was used to start the indication.

This allows the callback to free the `bt_gatt_indicate_params` instance
if it was allocated from storage, while still allowing the
`bt_gatt_attr` value to be accessed through `params->attr`.

Allocating the `bt_gatt_indicate_params` instance from storage is
desirable as multiple indications can be queued, however each instance
must be valid until the callback is run.

Implements API update from #29357

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-11-10 11:21:46 +01:00
Trond Einar Snekvik ad2fd44d7a Bluetooth: Mesh: Encapsulate feature config
Moves mesh feature configuration to a separate module, deprecating the
bt_mesh_cfg_srv structure. The initial values for the features should
now be enabled through KConfig, where new config entries have been added
for each feature.

This removes the upward dependency on the config server from the core
stack, and makes the config server a pure frontend for the configuration
states, as all spec mandated behavior around the feature states is now
encapsulated.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2020-11-09 11:23:34 +02:00
Ryan Chu 385000e8d9 Bluetooth: tester: Set the required minimim security level of LE COC
With this change, these two tests can be supported:
- L2CAP/LE/CFC/BV-11-C
- L2CAP/LE/CFC/BV-14-C

Signed-off-by: Ryan Chu <ryan.chu@nordicsemi.no>
2020-10-29 20:34:21 +02:00
Ryan Chu 70a27af090 Bluetooth: tester: Clear adv_buf after sending GAP_EV_DEVICE_FOUND
Avoid sending duplicate GAP_EV_DEVICE_FOUND because adv_buf->len was
not cleared.

With this change, the following tests become more stable in a noisy
environment:
- GAP/BROB/OBSV/BV-01-C
- GAP/BROB/OBSV/BV-02-C
- GAP/BROB/OBSV/BV-05-C
- GAP/BROB/OBSV/BV-06-C
- GAP/DISC/RPA/BV-01-C

Co-authored-by: Konstantinos Sotiropoulos
                konstantinos.sotiropoulos@nordicsemi.no

Signed-off-by: Ryan Chu <ryan.chu@nordicsemi.no>
2020-10-29 20:34:21 +02:00
Ryan Chu efc8459340 Bluetooth: tester: Support SM tests related to OOB
Support the folowing new tests related to OOB pairing:
- SM/MAS/OOB/BI-01-C
- SM/MAS/OOB/BV-01-C
- SM/MAS/OOB/BV-03-C
- SM/MAS/OOB/BV-09-C
- SM/MAS/SCOB/BI-01-C
- SM/MAS/SCOB/BI-04-C
- SM/MAS/SCOB/BV-01-C
- SM/MAS/SCOB/BV-04-C
- SM/SLA/OOB/BI-02-C
- SM/SLA/OOB/BV-02-C
- SM/SLA/OOB/BV-04-C
- SM/SLA/OOB/BV-10-C
- SM/SLA/SCOB/BI-02-C
- SM/SLA/SCOB/BI-03-C
- SM/SLA/SCOB/BV-02-C
- SM/SLA/SCOB/BV-03-C

Co-authored-by: Konstantinos Sotiropoulos
                konstantinos.sotiropoulos@nordicsemi.no
Co-authored-by: Aytürk Düzen ayturk.duzen@nordicsemi.no

Signed-off-by: Ryan Chu <ryan.chu@nordicsemi.no>
2020-10-29 20:34:21 +02:00
Xavier Chapron 824f423e54 misc: Replace assert include and calls by sys/__assert.h equivalent
Replace all calls to the assert macro that comes from libc by calls to
__ASSERT_NO_MSG(). This is usefull as the former might be different
depending on the libc used and the later can be customized to reduce
flash footprint.

Signed-off-by: Xavier Chapron <xavier.chapron@stimio.fr>
2020-10-02 11:42:40 +02:00
Carles Cufi 2fd929355a Bluetooth: tester: Fixes for GCC 10.x
Fix the structures so that they are compliant with the stricter checks
of GCC 10.x, and at the same time correct a bug that was present in the
handling of the GAP Start Advertising BTP command.

Fixes #28375.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-09-18 13:32:08 +02:00
Luiz Augusto von Dentz 5c4bde55d0 Bluetooth: GATT: Rework bt_gatt_attr_func_t
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>
2020-09-05 11:06:21 +02:00
Anas Nashif dca317c730 sanitycheck: inclusive language
change whitelist -> allow.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-08-27 07:04:07 -04:00
Michał Narajowski 7c06f3c38e mesh: Adjust config values to pass Transport test cases
These values were derived experimentally by running PTS test cases.

Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
2020-07-02 16:30:01 +03:00
Kumar Gala a1b77fd589 zephyr: replace zephyr integer types with C99 types
git grep -l 'u\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/u\(8\|16\|32\|64\)_t/uint\1_t/g"
	git grep -l 's\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/s\(8\|16\|32\|64\)_t/int\1_t/g"

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-08 08:23:57 -05:00
Marc Herbert debade9121 tests: make find_package(Zephyr...) REQUIRED
... because it is (required).

This makes a difference when building with CMake and forgetting
ZEPHYR_BASE or not registering Zephyr in the CMake package registry.

In this particular case, REQUIRED turns this harmless looking log
statement:

-- Could NOT find Zephyr (missing: Zephyr_DIR)
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/cc
-- ...
-- ...
-- ...
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:8 (target_sources):
  Cannot specify sources for target "app" which is not built by
  this project.

... into this louder, clearer, faster and (last but not least) final
error:

CMake Error at CMakeLists.txt:5 (find_package):
  Could not find a package configuration file provided by "Zephyr" with
  any of the following names:

    ZephyrConfig.cmake
    zephyr-config.cmake

  Add the installation prefix of "Zephyr" to CMAKE_PREFIX_PATH or set
  "Zephyr_DIR" to a directory containing one of the above files.  If
  "Zephyr" provides a separate development package or SDK, be sure it
  has been installed.

-- Configuring incomplete, errors occurred!

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-05-29 10:47:25 +02:00
Mariusz Skamra f51557d0f2 tester: Adjust to recent changes in BTP API
This patch adjusts L2CAP CoC related command and responses to the
recent BTP API changes.
BTP has been extended with Enhanced CoC support, thus few L2CAP
CoC related commands have been changed.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2020-05-05 11:05:54 +03:00
Carles Cufi 6656214af2 boards: nrf52_pca10040: Rename to nrf52dk_nrf52832
The board name for the nRF52 DK, so far known as nrf52_pca10040, is
renamed to nrf52dk_nrf52832.  Its documentation and all references
to its name in the tree are updated accordingly. Overlay and
configuration files specific to this board are also renamed, to
match the new board name.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-04-06 13:09:07 +02:00
Joakim Andersson f2d7b77e96 Bluetooth: host: Deprecate BT_LE_ADV defines in hci.h in favour of gap.h
Deprecate BT_LE_ADV defines in hci.h that are expected to be used by the
application in the scan received callback to identify the advertising
PDU type. These defines are mixing HCI input parameters and advertising
PDU types. Internally it is acceptable to mix these, but at the API we
should to mix in them.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-03-30 00:38:23 +03:00
Joakim Andersson 405ce842ab Bluetooth: host: Add new argument and return code to bt_create_conn_le
Deprecate bt_create_conn_le and rename it to in order to add return
code, new arguments and to follow the established naming convention.

Add API for the application to control the scan parameters of the
initiator role. This allows the application more scheduling control
of the initiator in multi-role scenarios. Also provides options to
configure the initiator for LE Coded PHY for long range support.
We deprecate the old way of creating connection to make the name more
consistent with the rest of the API.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-03-30 00:38:23 +03:00
Torsten Rasmussen 407b49b35c cmake: use find_package to locate Zephyr
Using find_package to locate Zephyr.

Old behavior was to use $ENV{ZEPHYR_BASE} for inclusion of boiler plate
code.

Whenever an automatic run of CMake happend by the build system / IDE
then it was required that ZEPHYR_BASE was defined.
Using ZEPHYR_BASE only to locate the Zephyr package allows CMake to
cache the base variable and thus allowing subsequent invocation even
if ZEPHYR_BASE is not set in the environment.

It also removes the risk of strange build results if a user switchs
between different Zephyr based project folders and forgetting to reset
ZEPHYR_BASE before running ninja / make.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2020-03-27 16:23:46 +01:00
Andrzej Głąbek 4253eae005 boards: nrf52840_pca10056: Rename board to nrf52840dk_nrf52840
The nRF52840 DK board target, so far known as nrf52840_pca10056,
is renamed to nrf52840dk_nrf52840.
Its documentation and all references to its name in the tree are
updated accordingly. Overlay and configuration files specific to
this board are also renamed, to match the new board name.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-03-27 09:14:08 +01:00
Carles Cufi 02b630d494 Bluetooth: tester: Fix GATT service registration
The service registration logic was using the wrong variable to check for
a pending service to be registered, which led to the same service being
registered twice in some cases. Fix the logic so that a pending service
is only registered once.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-02-27 21:21:46 +02:00
Carles Cufi e9a416f3cd Bluetooth: tester: Add missing log_strdup
Since we enable CONFIG_ASSERT in the tester app, the logging subsystem
will assert if it detects a missing log_strdup. Add the two missing ones
that I could find to properly log transient strings.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-02-25 22:29:29 +02:00
Carles Cufi 2b0e9a3d6e Bluetooth: tester: Implement the GAP_SET_MITM command
Implement the BTP command to set MITM, although on Zephyr this is not
configurable at runtime. Instead print a warning instructing to use the
CONFIG_BT_SMP_ENFORCE_MITM Kconfig option instead.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-02-23 21:46:22 +02:00
Carles Cufi 3c69dff9a3 Bluetooth: tester: Implement the GAP_PASSKEY_CONFIRM command
Implement the BTP GAP command and event for passkey confirmation.
This also allows us to set the passkey_confirm auth callback which
enables the keyboard/display IO capabilities.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-02-23 21:46:22 +02:00
Carles Cufi c3f5677672 Bluetooth: tester: Implement the GAP_SET_BONDABLE command
Implement the BTP GAP command to set bondable on or off.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-02-23 21:46:22 +02:00
Carles Cufi 4a59e8da59 Bluetooth: tester: Disable forcing of MITM
Since some tests require MITM to be off, disable the option that forces
the MITM flag at all times.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-02-23 21:46:22 +02:00
Carles Cufi 6f8dd90a83 Bluetooth: tester: Ensure the app is bondable by default
Ensure the bondable Kconfig option is set unconditionally.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-02-23 21:46:22 +02:00
Carles Cufi 2b48a8f37b Bluetooth: tester: Fix packet field name
Correct the name of the boolean include in the set bondable
command so it reflects the spec.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-02-23 21:46:22 +02:00
Carles Cufi 5cbc3e0c6c Bluetooth: tester: Tweak nRF52840 config
Disable stack measurements by default, since they pollute the log
output.
Ensure that the logging thread has enough stack.
Ensure that the UART that connects to the BTP client is
interrupt-driven.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-02-23 21:46:22 +02:00
Carles Cufi 613e5f541f Bluetooth: tester: Update GATT cmds/evts to the latest BTP spec
Fill in all the missing GATT commands and events in the latest BTP
specification.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-02-22 19:15:04 +02:00
Carles Cufi 2be22c0473 Bluetooth: tester: Update GAP cmds/evts to the latest BTP spec
Fill in all the missing commands and events in the latest BTP
specification.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-02-21 18:17:59 +02:00
Carles Cufi cee1954ac3 Bluetooth: tester: Add abundant logging in GAP
Log all error conditions in GAP for easier debugging.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-02-21 13:42:07 +02:00
Carles Cufi 7f5ae21a6d Bluetooth: tester: Add logging in core handlers
Add warnings when something goes unhandled.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-02-21 13:42:07 +02:00
Carles Cufi b01cd4c7bb Bluetooth: tests: tester: Add an init log message
Add a log message to let people running the test know that the tester
booted up correctly.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-02-20 21:37:33 +02:00
Carles Cufi 5af621282e tests: bluetooth: tester: Add a config for the 52840 DK
Add a configuration file for the nRF52840 DK so that it uses RTT for
debugging and enables more protection measures.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-02-20 21:37:33 +02:00
Carles Cufi 6de5c4b7b3 tests: bluetooth: tester: Clean up configuration
- Use the built-in mechanism for configuration overlays
  (having a boards/ folder with <board>.conf fragments)
- Clean up variables that were giving warnings

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-02-20 21:37:33 +02:00
Ulf Magnusson cf89ba33ea global: Fix up leading/trailing blank lines in files
To make the updated test in
https://github.com/zephyrproject-rtos/ci-tools/pull/121 clean, though it
only checks modified files.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2020-01-27 17:41:55 -06:00
Peter Bigot 6a964663b1 treewide: use full path to console/uart_pipe.h header
The build infrastructure should not be adding the drivers subdirectory
to the include path.  Fix the legacy uses that depended on that
addition.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-01-26 17:52:12 +01:00
Ulf Magnusson 2f2a04d167 tests: bluetooth: kconfig: Do not assign promptless BT_MESH_PROV
Assignments have no effect on promptless symbols. Flagged by
https://github.com/zephyrproject-rtos/zephyr/pull/20742.

BT_MESH_PROV is already selected by BT_MESH_PB_ADV and BT_MESH_PB_GATT,
which these configuration files enable.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2020-01-14 16:49:25 -05:00
Johan Hedberg 0e91493ab4 Bluetooth: L2CAP: Make channel ops const
Make the channel ops struct const since there really isn't anything
there that needs to change at runtime. The only exception is the L2CAP
shell which was playing with the recv callback, however that can be
fixed by introducing a simple bool variable.

With tests/bluetooth/shell this reduces RAM consumption by 112 bytes
while adding only 16 bytes to flash consumption.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2019-12-19 11:28:24 +02:00
Joakim Andersson b30b480c7c Bluetooth: UUID: Expose bt_uuid_to_str to application
Expose the bt_uuid_to_str function as an API to the application.
This aligns this function with the bt_addr_to_str function call. This
allows the application to use this function without having to enable
the BT_DEBUG option.

Move the in-place bt_uuid_str to internal logging, this is mainly done
due to the limitation in the log_strdup that shouldn't be exposed to the
application.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-12-09 17:15:05 +02:00
Jacob Siverskog 7096fa512f Bluetooth: GATT: Remove all subscriptions for connection when unpairing
Make sure all subscriptions are removed when a connection is unpaired.

Fixes #21131

Signed-off-by: Jacob Siverskog <jacob@teenage.engineering>
2019-12-04 19:14:28 +01:00
Johan Hedberg 39291fbbbe Bluetooth: Remove usage of BT_BUF_USER_DATA_MIN
This define is not of use anymore since there's a global net_buf user
data Kconfig variable and its definition already guarantees a
sufficient minimum for Bluetooth.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2019-11-28 13:35:11 +02:00
Maksim Masalski e9d7565d66 tests: remove duplicate names for the bluetooth tests
According to the comment in #20008 I found out that some test cases
for different tests have same names.
To get rid of it, I decided to change test cases names.

Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
2019-10-24 06:29:17 -04:00
Johan Hedberg 5537181e1a Bluetooth: Fix missing includes for hci.h
With the changes in PR #19836 applications now need to explicitly
include hci.h to use defines from it. Fix two sample/tests apps which
were missing this.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2019-10-17 19:05:33 +03:00
Mariusz Skamra 9828b0fae8 Bluetooth: tester: Adapt to BTP Get Attribute Value API change
Adapt the gatt_get_attribute_value_cmd to recent changes in API.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2019-09-25 17:36:05 +02:00
Luiz Augusto von Dentz 03b9ce487c Bluetooth: GATT: Add support to setting permission on CCCD
This adds support to set different permissions to CCCD so security can
be checked when enabling notification which conforms to:

BLUETOOTH CORE SPECIFICATION Version 5.1 | Vol 3, Part G page 2360:

  '3.3.3.3 Client Characteristic Configuration

   Authentication and authorization may be required by the server to
   write the configuration descriptor.'

In addition to that also ensure that notification are not re-enabled
until the proper security level is reached to conform to the following
statement:

  '10.3.1.1 Handling of GATT indications and notifications

   A client “requests” a server to send indications and notifications
   by appropriately configuring the server via a Client Characteristic
   Configuration Descriptor. Since the configuration is persistent
   across a disconnection and reconnection, security requirements must
   be checked against the configuration upon a reconnection before
   sending indications or notifications. When a server reconnects to a
   client to send an indication or notification for which security is
   required, the server shall initiate or request encryption with the
   client prior to sending an indication or notification. If the client
   does not have an LTK indicating that the client has lost the bond,
   enabling encryption will fail.'

Fixes #17983

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2019-09-19 21:12:39 +03:00
Joakim Andersson 3e9888105e Bluetooth: Host: Rename API function to initiate bluetooth security.
Rename bt_conn_security to bt_conn_set_security, this makes the API
naming more consistent.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-08-27 15:13:25 +02:00
Joakim Andersson 1c48757d94 Bluetooth: Host: Rename security level enum
Rename security level enum, using level and number instead of low,
medium, high and fips.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-08-27 15:13:25 +02:00
Luiz Augusto von Dentz 5f3595e47c Bluetooth: GATT: Fix using variable size storage for CCC
This removes the necessity of registering the storage for CCC and make
it part of the declaration itself.

Fixes #18547

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2019-08-22 15:14:39 +03:00
Mariusz Skamra 5a7a520ea1 Bluetooth: GATT: Add BTP Discover All Primary Services command handler
This will handle BTP Discover All Primary Services command.

Related TC: GATT/CL/GAD/BV-01-C
Fixes: #17861
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2019-08-07 18:07:45 +02:00
Anas Nashif ffaba63b10 boards: remove arduino 101 and related boards
This board and SoC was discontinued some time ago and is currently not
maintained in the zephyr tree.
Remove all associated configurations and variants from the tree.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-07-29 21:30:25 -07:00
Mariusz Skamra 8b27af58eb Bluetooth: tester: Change RPA timeout
This changes RPA timeout so that the address is changed every 60
seconds. This change is needed to speed up privacy related test cases.
Currently, the new RPA was initiated on request that was a bit hackish
and could be done via BT_RPA_TIMEOUT Kconfig option.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2019-07-19 16:28:13 +03:00
Mariusz Skamra 1074efd3cd Bluetooth: tester: Update to recent conn param related changes in BTP
This updates tester application to recent changes in BTP related
to Connection Parameters Update.
Connected event has been extended with connection parameters.
Connection Parameters Update command and event have beend added to
initiate and track current connection parameters.
Needed to automate qualification test GAP/CONN/CPUP/BV-06-C

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2019-07-19 11:24:11 +02:00
Mariusz Skamra d4f1a5aba6 Bluetooth: tester: Enable GAP writable device name
This enables support for GAP writable device name in tester application
for testing purposes.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2019-07-18 14:36:30 +02:00
Mariusz Skamra 35dcab988e Bluetooth: tester: Enable Mesh Friend support
Enable Mesh Friend support in tester application.

Fixes: #17600
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2019-07-18 14:35:40 +02:00
Anas Nashif a2fd7d70ec cleanup: include/: move misc/util.h to sys/util.h
move misc/util.h to sys/util.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif 9ab2a56751 cleanup: include/: move misc/printk.h to sys/printk.h
move misc/printk.h to sys/printk.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif 5d001f3e41 cleanup: include/: move misc/byteorder.h to sys/byteorder.h
move misc/byteorder.h to sys/byteorder.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif e1e05a2eac cleanup: include/: move atomic.h to sys/atomic.h
move atomic.h to sys/atomic.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Nicolas Pitre 659fa0d57d lifo/fifo: first word is not always first 4 bytes
The first word is used as a pointer, meaning it is 64 bits on 64-bit
systems. To reserve it, it has to be either a pointer, a long, or an
intptr_t. Not an int nor an u32_t.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-06-26 09:08:42 -04:00
Anas Nashif f2cb20c772 docs: fix misspelling across the tree
Found a few annoying typos and figured I better run script and
fix anything it can find, here are the results...

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-19 15:34:13 -05:00
Ulf Magnusson a84ded74ea dts: Replace status = "ok" with status = "okay"
The DT spec. only has "okay" and not "ok". The Linux kernel has around
12k "okay"s and 300 "ok"s.

The scripts/dts scripts only check for "disabled", so should be safe re.
those at least.

The replacement was done with

    git ls-files | xargs sed -i 's/status\s*=\s*"ok"/status = "okay"/'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-06-14 19:51:13 -05:00
Marc Herbert 704b460b0d tests/bluetooth/tester: remove spurious CONFIG_GPIO=y
This tries to build gpio without any driver which fails at cmake time
like this:

CMake Error at ../../../cmake/extensions.cmake:378 (add_library):
  No SOURCES given to target: drivers__gpio
  Call Stack (most recent call first):
  ../../../cmake/extensions.cmake:355 (zephyr_library_named)
  ../../../drivers/gpio/CMakeLists.txt:3 (zephyr_library)

Remove TEST_USERSPACE workaround added in commit 3b53e69249 which
added gpio_handlers.c to the SOURCES.

Fixes #15232.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2019-05-22 10:54:40 -04:00
Tedd Ho-Jeong An 543b9c972d tests: bluetooth/tester: Add support Read Using Characteristic UUID
This patch adds an API to support Read Using Characteristic UUID.

Signed-off-by: Tedd Ho-Jeong An <tedd.an@intel.com>
2019-04-24 09:39:53 -07:00
Anas Nashif 3ae52624ff license: cleanup: add SPDX Apache-2.0 license identifier
Update the files which contain no license information with the
'Apache-2.0' SPDX license identifier.  Many source files in the tree are
missing licensing information, which makes it harder for compliance
tools to determine the correct license.

By default all files without license information are under the default
license of Zephyr, which is Apache version 2.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-04-07 08:45:22 -04:00
Andrew Boie 3b53e69249 tests: bluetooth: tester: workaround build error
For mysterious reasons this test fails cmake if
CONFIG_TEST_USERSPACE=n.

Enable it for now, bug tracked in #15232

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-04-06 14:30:42 -04:00
Patrik Flykt 24d71431e9 all: Add 'U' suffix when using unsigned variables
Add a 'U' suffix to values when computing and comparing against
unsigned variables.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2019-03-28 17:15:58 -05:00
Mariusz Skamra 56ec1d876d Bluetooth: tester: Fix possible NULL pointer dereference
Fix calling NULL attribute read function pointer.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2019-03-19 06:55:16 +02:00
Mariusz Skamra 8b5d73e0f1 Bluetooth: tester: Move BTP specification to auto-pts repository
This moves BTP specification from Zephyr so that it's accessible for
all projects.

Related auto-pts PR: https://github.com/intel/auto-pts/pull/244

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2019-03-15 07:24:08 -05:00
Tedd Ho-Jeong An 378cc3d57b Bluetooth: btp: Add overlay for nrf52 and reel boards
This patch adds overlay for nrf52_pca10040 and reel board to use
btp tester. These are based on nrf52840.

Signed-off-by: Tedd Ho-Jeong An <tedd.an@intel.com>
2019-03-03 23:46:00 -05:00
Carlos Stuart 75f77db432 include: misc: util.h: Rename min/max to MIN/MAX
There are issues using lowercase min and max macros when compiling a C++
application with a third-party toolchain such as GNU ARM Embedded when
using some STL headers i.e. <chrono>.

This is because there are actual C++ functions called min and max
defined in some of the STL headers and these macros interfere with them.
By changing the macros to UPPERCASE, which is consistent with almost all
other pre-processor macros this naming conflict is avoided.

All files that use these macros have been updated.

Signed-off-by: Carlos Stuart <carlosstuart1970@gmail.com>
2019-02-14 22:16:03 -05:00
Anas Nashif 5060ca6a30 cmake: increase minimal required version to 3.13.1
Move to latest cmake version with many bug fixes and enhancements.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-01-03 11:51:29 -05:00
Patrik Flykt 440b535602 tests: Add 'U' to unsigned variable assignments
Add 'U' to a value when assigning it to an unsigned variable.
MISRA-C rule 7.2

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2018-12-04 22:51:56 -05:00
Johan Hedberg 62fb942d74 tests: bluetooth/tester: Fix having unique log domains
Each c-file must have unique log domains or building will fail at the
linker stage.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-11-02 10:41:11 -04:00
Reto Schneider 7eabab2f5d samples, tests: Use semi-accurate project names
When using an IDE (e.g. Eclipse, Qt Creator), the project name gets
displayed. This greatly simplifies the navigation between projects when
having many of them open at the same time. Naming every project "NONE"
defeats this functionality.

This patch tries to use sensible project names while not duplicating
too much of what is already represented in the path. This is done by
using the name of the directory the relevant CMakeLists.txt file is
stored in. To ensure unique project names in the samples (and again, in
the tests folder) folder, small manual adjustments have been done.

Signed-off-by: Reto Schneider <code@reto-schneider.ch>
2018-10-27 21:31:25 -04:00
Johan Hedberg a0c22de270 tests: bluetooth/tester: Convert from SYS_LOG to new logger
Use the LOG_* macros instead of the deprecated SYS_LOG_* ones.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-10-19 14:50:22 +02:00
Luiz Augusto von Dentz 3151d26572 Bluetooth: L2CAP: Add return to recv
This adds a int return to recv callback which can be used to notify the
stack about errors when receiving a packet. In addition to that the user
can return -EINPROGRESS to inform the stack the data will be processed
asynchronously which can be complete by calling
bt_l2cap_chan_recv_complete.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2018-09-24 12:51:11 +03:00
Flavio Ceolin da49f2e440 coccicnelle: Ignore return of memset
The return of memset is never checked. This patch explicitly ignore
the return to avoid MISRA-C violations.

The only directory excluded directory was ext/* since it contains
only imported code.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-09-14 16:55:37 -04:00
Grzegorz Kolodziejczyk 734eda39f5 bluetooth: tester: Increase SDU size to meet PTS requirement
PTS test cases MESH/NODE/TNPT/BV-07-C, MESH/NODE/TNPT/BV-12-C, requires
to receive 8 segment of data which summary requires 108 bytes of SDU.
This patch make test cases PASSing.

Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@codecoup.pl>
2018-08-16 12:41:55 +03:00
Sebastian Bøe 55ee53ce91 cmake: Prepend 'cmake_minimum_required()' into 'app' build scripts
Prepend the text 'cmake_minimum_required(VERSION 3.8.2)' into the
application and test build scripts.

Modern versions of CMake will spam users with a deprecation warning
when the toplevel CMakeLists.txt does not specify a CMake
version. This is documented in bug #8355.

To resolve this we include a cmake_minimum_required() line into the
toplevel build scripts. Additionally, cmake_minimum_required is
invoked from within boilerplate.cmake. The highest version will be
enforced.

This patch allows us to afterwards change CMake policy CMP000 from OLD
to NEW which in turn finally rids us of the verbose warning.

The extra boilerplate is considered more acceptable than the verbosity
of the CMP0000 policy.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-08-15 04:06:50 -07:00
Johan Hedberg 7ec40e81d0 Bluetooth: shell: Add multiple identity support
Add shell support for creating and showing identities.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-08-13 19:53:22 +03:00
Johan Hedberg 5708f1e8b1 Bluetooth: Add infrastructure to handle multiple identities
Make it possible to have multiple identity addresses as an LE
peripheral. For central role only the default identity is supported
for now. This also extends the flash storage in a backward compatible
way.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-08-13 19:53:22 +03:00
Anas Nashif 19666a9beb tests: fix u32_t type usage
We have been mixing u32_t and uint32_t. Using u32_t when the API expects
something else.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-07-18 12:32:23 -04:00
Mariusz Skamra aa190cd5b5 bluetooth: tester: Set configuration file for qemu_cortex_m3 target
qemu.conf will be chosen by default for qemu_cortex_m3.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2018-06-15 13:42:09 +02:00
Mariusz Skamra 3904442e6b bluetooth: tester: Remove redundant config option from qemu.conf
UART_PIPE_ON_DEV_NAME is set to UART_1 by default in
boards/arm/qemu_cortex_m3/qemu_cortex_m3.dts

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2018-06-15 13:42:09 +02:00
Mariusz Skamra 37e6162c47 bluetooth: tester: Fix bt_gatt_service_register call with invalid params
This fixes an assert
ASSERTION FAIL [svc->attr_count] @ subsys/bluetooth/host/gatt.c:259:
	invalid parameters
caused by bt_gatt_service_register call with invalid (uninitialized)
services array.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2018-06-15 13:42:09 +02:00
Mariusz Skamra bb4ed94c60 bluetooth: tester: Increase system workqueue stack size
This fixes an issue of system workqueue stack overflow that was
was observed during Bluetooth Mesh automated testing.
Increase system workqueue stack to avoid MPU faults.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Fixes #8262
2018-06-12 16:51:26 +02:00
Johan Hedberg 8d1f67c605 Bluetooth: Remove references to non-existing Kconfig symbols
Remove non-existent Kconfig symbol references. An additional (but
related) change is the removal of all persistent storage symbols from
the Arduino 101 Bluetooth shell app, since BT_STORAGE no longer
exists.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-05-23 16:57:59 -04:00
Luiz Augusto von Dentz 1b038f2941 Bluetooth: GATT: Make BT_GATT_CHARACTERISTIC declare its value
This ensures the every characteristic has a value attribute declared
with the same UUID since the old macro did not declare the value the
application would normally have to declare one itself using a different
UUID which is not allowed.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2018-05-14 18:51:22 +03:00
Johan Hedberg 88dfd399f4 Bluetooth: Mesh: Remove sequence number from bt_mesh_provision()
The sequence number was acting as a stop-gap for missing persistent
storage. Now that we have the settings support in place it's no longer
needed.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-05-11 16:44:43 +03:00
Johan Hedberg 8703ffad23 Bluetooth: Mesh: Redesign element and storage info for models
Keeping the model struct same sized, change the element pointer to two
indexes, and add a flags member that will be used to track pending
storage actions.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-05-11 16:44:43 +03:00
Johan Hedberg d22b7c9f2d Bluetooth: Remove bt_storage API
The same functionality is now supported by the settings-based
solution, so remove bt_storage out of the way. There were stubs in
bt_storage to handle per-peer information (e.g. pairing keys) but this
was never actually implemented in full. The next step is to add this
support to the settings-based solution.

Leave the code for generating temporary IRK and identity address in
case BT_SETTINGS is not enabled. Also leave the code for using vendor
HCI to read the identity address, in which case the settings
implementation will not touch it.

Introduce a new bt_unpair() API to replace the removed
bt_storage_clear(), since the latter was actually doing more than just
storage management: it was also handling runtime storage of pairing
information. Later, the bt_unpair() implementation will be extended to
clear settings-based pairing storage.

There is one feature that the bt shell module looses: the ability to
give a specific identity address to the "init" command as a parameter.
We might look later in the future if this is really needed, and add a
separate API for this.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-05-04 17:26:05 -04:00
Anas Nashif d7e7b08cdc tests: cleanup meta-data of various tests
Use sensible test name and cleanup filtering.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-04-09 22:55:20 -04:00
Mariusz Skamra fd2124913c Bluetooth: btp: Add Enable advertising with Node Identity cmd
This adds Enable advertising with Node Identity BTP command and
it's implementation.
This command is needed to pass PTS MESH/NODE/CFG/NID/BV-02-C
test case.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2018-03-10 11:56:22 +02:00
Mariusz Skamra c2d7c8579d Bluetooth: btp: Add missing Clear Replay Protection List Cache cmd
This command has been agreed and implemented in tester application.
The patch updates BTP document only.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2018-03-10 11:56:22 +02:00
Johan Hedberg ac1360f0a7 Bluetooth: Mesh: Convert to new net_buf_simple APIs
Convert the mesh code to use the new net_buf_siple APIs. This has the
benefit of saving 4 bytes off the stack due to the not needed pointer.
Also update the publication context helpers to map to the new
net_buf_simple API in an intuitive way.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-02-13 14:00:08 +02:00
Luiz Augusto von Dentz 800bfaf9a7 Bluetooth: UUID: Remove macros defining 16 bit values
Application should normally declare a bt_uuid with proper type and then
use bt_uuid_cmp.

Fixes #5162

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2018-02-13 13:33:48 +02:00
Mariusz Skamra 834ab2c192 Bluetooth: tester: Fix device connected and disconnected events
This fixes parameters order in events to be BTP compliant.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2018-01-23 12:30:29 +02:00
Mariusz Skamra a6cfda8d64 Bluetooth: btp: Fix address in GAP Device Found event
This event had address and address type parameters swapped
in it's structure.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2018-01-23 12:30:29 +02:00
Mariusz Skamra 83f5c3365e Bluetooth: tester: Fix uart-pipe build error on nrf52840 board
This fixes build error due to undeclared CONFIG_UART_PIPE_ON_DEV_NAME
on nrf52840 board.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2018-01-16 14:41:23 +02:00
Mariusz Skamra bf58fb481b Bluetooth: tester: Add Configuration and Health Client models
PTS requires the composition data of size that cannot be sent in
single PDU. This patch adds Configuration and Health Client models
to the root_models to increase the Elements size in Composition Data
Page 0.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2018-01-12 15:10:24 +02:00
Mariusz Skamra a45e18ec2e Bluetooth: tester: Set BT_MESH_LABEL_COUNT
This is required to run tests related to Virtual Addresses

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2018-01-09 10:29:10 +02:00
Anas Nashif 829598be2b tests: add CONFIG_TEST for marking tests
Mark tests with CONFIG_TEST to allow for test specific setup and
configuration.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-01-08 10:03:57 -05:00
Mariusz Skamra 0083634f73 Bluetooth: tester: Increase Mesh model group count
BT_MESH_MODEL_GROUP_COUNT has to be increased to meet the
PTS requirements.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2018-01-05 18:53:42 +02:00
Mariusz Skamra 9d6bb0995c Bluetooth: tester: Do not start LPN automatically
This disables CONFIG_BT_MESH_LPN_AUTO flag in Kconfig.
LPN is enabled by calling BTP Low Power Node command
if requested.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2018-01-04 15:03:33 +01:00
Mariusz Skamra 813ec50838 Bluetooth: btp: Add event indicating expiration of incomp timer
This event indicates that segmented message incomplete timer
expired.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2018-01-03 10:48:13 +01:00
Mariusz Skamra 8274cbabf6 Bluetooth: btp: Add Mesh Clear Replay Protection List Cache command
This command is needed for Bluetooth Mesh testing against PTS.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2018-01-03 10:48:13 +01:00
Mariusz Skamra a909aa3a0b Bluetooth: btp: Add LPN Subscribe/Unsubscribe commands
This adds commands to manage Friend node Subscription List.
Those will be used to add or remove and group/virtual address
from subscription list.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2018-01-03 10:48:13 +01:00
Mariusz Skamra 0bd3790d5b Bluetooth: btp: Add event indicating invalid provisioning BearerOpcode
This adds BTP event indicating reception of provisioning message
with invalid (RFU) BearerOpcode.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2018-01-03 10:48:13 +01:00
Mariusz Skamra 083937be32 Bluetooth: tester: Do not send BTP error if fault_update failed
This may fail, if model publication was not set by remote.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2018-01-03 10:48:13 +01:00
Mariusz Skamra 0d71cef1f2 Bluetooth: tester: Add BTP Mesh Model Send command implementation
This command will be used to test if model can properly send
segmented and unsegmented messages to a given destination address.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2018-01-03 10:48:13 +01:00
Paul Sokolovsky e25df54eae various: Update/fix some textual material and code comments.
Of these, only struct net_ipv6_nbr_data::send_ns is a descriptive
change:

send_ns is used for timing Neighbor Solicitations in general, not
just for DAD.

The rest are typo/grammar fixes.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-12-29 09:45:39 -05:00
Anas Nashif d4784555d0 tests: remove build_only option
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-28 20:24:29 -05:00
Mariusz Skamra 3e8a5bc72f Bluetooth: tester: Add Core Unregister Service command
This adds stubs for Core Unregister Service command implementation.
It will be used to clean up the stack and tester after test case
execution.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2017-12-19 15:43:43 +01:00
Mariusz Skamra 16fbf25ceb Bluetooth: tester: Add Mesh Health Model related commands
This adds Mesh Health Model related commands implementation.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2017-12-19 12:12:00 +01:00
Mariusz Skamra 2f5d1f7a30 Bluetooth: tester: Add Mesh Network Received event
This adds implementation of Mesh Network receive event.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2017-12-18 12:43:23 +01:00
Mariusz Skamra c5a04fad64 Bluetooth: tester: Add Mesh Network Send command
This adds Mesh Network Send command implementation.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2017-12-18 09:37:31 +01:00
Mariusz Skamra 244e9564ac Bluetooth: tester: Add Mesh IV Update related commands
This adds Mesh IV Update related command handlers implementation.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2017-12-15 11:10:54 +02:00
Mariusz Skamra c20af89020 Bluetooth: tester: Fix not checking btp2bt_uuid return value
btp2bt_uuid might return BTP_STATUS_FAILED. Procedure shall be aborted
in this case.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2017-12-13 11:18:32 +02:00
Mariusz Skamra 78aa543d6f Bluetooth: tester: Fix attribute uuid type check
This chack shall be performed on attribute uuid type, not uuid provided
in Gatt Get Attributes command paramteres.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2017-12-13 11:18:32 +02:00
Mariusz Skamra 1e8b9766dc Bluetooth: tester: Add implementation of Mesh LPN related BTP commands
This adds implementation of Mesh LPN and Mesh LPN Poll commands.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2017-12-13 10:07:46 +02:00
Mariusz Skamra 4dd2ae56f2 Bluetooth: btp: Introduce Health Generate/Clear Faults commands
Those commands will be used for qualification purposes to verify
the functionality of Mesh Health Model.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2017-12-13 09:30:12 +02:00
Mariusz Skamra e7a6b2d047 Bluetooth: btp: Add Mesh Network receive event
This event is needed for qualification purposes to verify functionality
of Mesh Network layer.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2017-12-13 09:30:12 +02:00
Mariusz Skamra 581d6c3158 Bluetooth: btp: Add BTP Mesh Network Send command
This command will be used to verify functionality of the network
layer against PTS.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2017-12-13 09:30:12 +02:00
Mariusz Skamra 090444829f Bluetooth: BTP: Add BTP MESH IV Update related commands
This commands will be used while testing IV Update procedure
against PTS.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2017-12-13 09:30:12 +02:00
Mariusz Skamra 589a5dad17 Bluetooth: tester: Add initial support for BTP Mesh service
This adds initial implementation of BTP Mesh service.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2017-12-12 12:44:21 +02:00
Mariusz Skamra 48465c5eaf Bluetooth: btp: Add Mesh LPN related commands
Extend BTP with Mesh LPN related commands.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2017-12-12 10:29:20 +02:00
Anas Nashif 23f81eeb42 tests/samples: fixed yaml syntax
Use a map directory, avoid the list which makes parsing a bit
cumbersome.

Fixes #5109

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-11 14:47:08 -05:00
Mariusz Skamra da68167331 Bluetooth: btp: Add events indicating provisioning link state
This introduced two BTP events to indicate provisioning link state.
This is needed for testing purposes, since PTS requests tester to
confirm link state.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2017-12-11 13:52:05 +02:00
Mariusz Skamra 85f16efbeb Bluetooth: tester: Add Get Attribute Value command implementation
This procedure will be used to query GATT Server for attribute value.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2017-12-09 09:25:04 +02:00
Mariusz Skamra c168769b95 Bluetooth: btp: Add GATT Get Attribute Value command
This procedure will be used to query GATT Server for attribute value.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2017-12-09 09:25:04 +02:00
Mariusz Skamra 444b2ad21e Bluetooth: tester: Add Get Attributes command implementation
This procedure is used query local GATT Server for attributes
based on given search pattern. Attributes can be searched using
Attribute Handle range and Attribute Type.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2017-12-09 09:25:04 +02:00
Mariusz Skamra 55fe397853 Bluetooth: btp: Add GATT Get Attributes command
This will be used for verification in GATT test cases.
This procedure is used query local GATT Server for attributes
based on given search pattern. Attributes can be searched using
Attribute Handle range and Attribute Type.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2017-12-09 09:25:04 +02:00
Johan Hedberg 9bdd8d6b60 Bluetooth: tests: Update tester documentation for cmake
Remove references to make-centric build process, and refer to the
steps in a more neutral way (which is equally applicable to using
either make or ninja as the generator type).

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-11-12 15:05:49 +02:00
Szymon Janc 1a50ee1fe0 Bluetooth: btp: Add initial commands for Mesh service
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2017-11-10 14:44:23 +02:00
Sebastian Bøe c7832bd343 cmake: Use -serial bt-server when CONFIG_BT
Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-11-08 20:00:22 -05:00
Sebastian Bøe 0829ddfe9a kbuild: Removed KBuild
Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-11-08 20:00:22 -05:00
Sebastian Bøe 12f8f76165 Introduce cmake-based rewrite of KBuild
Introducing CMake is an important step in a larger effort to make
Zephyr easy to use for application developers working on different
platforms with different development environment needs.

Simplified, this change retains Kconfig as-is, and replaces all
Makefiles with CMakeLists.txt. The DSL-like Make language that KBuild
offers is replaced by a set of CMake extentions. These extentions have
either provided simple one-to-one translations of KBuild features or
introduced new concepts that replace KBuild concepts.

This is a breaking change for existing test infrastructure and build
scripts that are maintained out-of-tree. But for FW itself, no porting
should be necessary.

For users that just want to continue their work with minimal
disruption the following should suffice:

Install CMake 3.8.2+

Port any out-of-tree Makefiles to CMake.

Learn the absolute minimum about the new command line interface:

$ cd samples/hello_world
$ mkdir build && cd build
$ cmake -DBOARD=nrf52_pca10040 ..

$ cd build
$ make

PR: zephyrproject-rtos#4692
docs: http://docs.zephyrproject.org/getting_started/getting_started.html

Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-11-08 20:00:22 -05:00
Mariusz Skamra f1753ae0f3 Bluetooth: tester: Add Attribute Value Changed event implementation
This adds implementation of previously introduced BTP event.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2017-10-17 21:28:14 +03:00
Mariusz Skamra 204c468d16 Bluetooth: btp: Add new event to indicate GATT attribute value change
Attribute Value Changed Event will be used to indicate characteristic
or descriptor value change in local GATT Server database.
Event will be triggered when PTS performed ATT Write operation
successfully.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2017-10-17 21:28:14 +03:00
Mariusz Skamra 4d831a7bdd Bluetooth: tester: Fix include service attribute user data
GATT Server:
According to the API, include service declaration user data
points to the first service attribute to include.

bt_gatt_include structure is valid only for client role.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2017-10-17 17:30:50 +03:00
Anas Nashif 0356590df5 tests: samples: fix yaml syntax
Fix indentation and syntax and make it pass yamllint tool.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-15 08:15:00 -04:00
Ruslan Mstoi 47f4af4310 Bluetooth: tester: Fix bt-stack-tester to unix domain socket
/tmp/bt-stack-tester is not a pipe, but unix domain socket.
This commit fixes respective "make run" errors:

qemu-system-arm: -serial pipe:/tmp/bt-stack-tester: Could
not open '/tmp/bt-stack-tester': No such device or address

qemu-system-arm: -serial pipe:/tmp/bt-stack-tester: could
not connect serial device to character backend
'pipe:/tmp/bt-stack-tester

Signed-off-by: Ruslan Mstoi <ruslan.mstoi@intel.com>
2017-09-07 05:53:01 -05:00
Savinay Dharmappa 3c9fb93dc5 tests: bluetooth: tester: Make UART usage consistent
We use UART1 for UART pipe in a number of qemu tests, so lets do the
same thing for the bluetooth test and move the bluetooth uart to UART2.

Jira: ZEP-2412.

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-08-30 10:07:07 -05:00
Luiz Augusto von Dentz d229ec07ad Bluetooth: tester: Fix using invalid elements with k_fifo
The documentation of k_fifo_put mentions that the items must have 32
bits reserved for kernel use as that is where the sys_snode_t pointer
is placed but this detail was not taken into consideration when
designing the cmd_queue which access each element as a btp_cmd.

Note: This probably used to work just because k_fifo_get used to place
data directly into thread's swap_data so the kernel never really touched
the list but with the changes to use k_poll the list is always updated
exposing this issue.

Jira: ZEP-2568

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-08-30 08:16:16 -04:00
Johan Hedberg 2975ca0754 Bluetooth: Kconfig: Rename CONFIG_BLUETOOTH_* to CONFIG_BT_*
The API name space for Bluetooth is bt_* and BT_* so it makes sense to
align the Kconfig name space with this. The additional benefit is that
this also makes the names shorter. It is also in line with what Linux
uses for Bluetooth Kconfig entries.

Some Bluetooth-related Networking Kconfig defines are renamed as well
in order to be consistent, such as NET_L2_BLUETOOTH.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-08-09 11:14:19 +03:00
David B. Kinder eeed8ce179 doc: fix wiki board references in non .rst files
Some README files referenced wiki articles that have been
moved to the doc area on the website.

Fixes #668

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-07-11 12:45:35 -05:00
Johan Hedberg 30beef9419 Bluetooth: GATT Introduce BT_GATT_CCC_MAX helper define
The worst-case maximum number of CCC entries we need is actually
MAX_CONN + MAX_PAIRED. Provide a helper define for it and use it
whenever appropriate.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-07-04 17:30:40 +03:00
Johan Hedberg 7a79101fd5 Bluetooth: tests: Remove unused prj_nimble.conf files
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-07-03 08:22:58 -04:00
Johan Hedberg e094560dbc Bluetooth: tests: Fix left-over issues from bt_gatt_service() removal
The new GATT service registration API is bt_gatt_service_register(),
which takes a bt_gatt_service object pointer.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-06-27 19:10:43 -04:00
Anas Nashif 470c5f3189 tests: remove testcase.ini files
We now use yaml files.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-21 20:56:53 -04:00
Anas Nashif cc24f4b03c tests: samples: convert testcase files to yaml
This will prepare test cases and samples with metadata and information
that will be consumed by the sanitycheck script which will be changed to
parse YAML files instead of ini.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-21 20:56:53 -04:00
Luiz Augusto von Dentz 79af35991b Bluetooth: GATT: Add bt_gatt_register_service
This adds bt_gatt_register_service using bt_gatt_service which contains
the attribute array that is then added to the database saving a pointer
in each and every attribute declared.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-06-15 21:53:00 +03:00
Luiz Augusto von Dentz b3cfabab63 Bluetooth: Remove CONFIG_BLUETOOTH_GATT_DYNAMIC_DB
Removes CONFIG_BLUETOOTH_GATT_DYNAMIC_DB in preparation to the
introduction of bt_gatt_unregister.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-06-15 21:53:00 +03:00
Andrew Boie 15ed8ec7ea tests: use K_THREAD_STACK_DEFINE macros
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-06-09 18:53:28 -04:00
Johan Hedberg 9516d63836 Bluetooth: Remove support for NBLE
NBLE has been deprecated for a few releases now and can be removed.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-05-25 09:03:16 -07:00
Andrew Boie 68d3678abb tests: use k_thread_create()
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-05-11 20:24:22 -04:00