Commit Graph

26380 Commits

Author SHA1 Message Date
Marcel Holtmann
01956e3f22 build: Update library version 2021-10-13 20:33:29 +02:00
Thomas Weißschuh
9cf8365baa Use accurate icons for headphones and headsets
While these icon names are not part of the spec standard names [0] they
are in practice implemented by at least Adwaita, Gnome, Oxygen, Arc and Breeze
themes.

[0] https://specifications.freedesktop.org/icon-naming-spec/latest/ar01s04.html
2021-10-11 13:20:09 -07:00
Inga Stotland
c815b6ba30 tools/mesh-cfg-client: Fix NULL pointer dereferencing
This patch fixes a number of potential NULL pointer dereferencing
cases.
2021-10-08 15:35:01 -07:00
Tedd Ho-Jeong An
5879dbf687 tools/mgmt-tester: Add more suspend/resume test cases
This patch adds more suspend/resuem test cases like
 - Discover -> Suspend
 - Discover -> Suspend -> Resume
 - Suspend -> Resume -> Suspend -> Resume
2021-10-08 13:59:40 -07:00
Tedd Ho-Jeong An
b4a9e65491 tools/mgmt-tester: Updates Experimental Feature test cases
This patch updates/adds test cases for Read and Set Experimental Feature
commands.
2021-10-08 13:59:40 -07:00
Tedd Ho-Jeong An
9bf38bc666 doc/tester-config: Enable Runtime Debugging Feature
This patch adds CONFIG_BT_FEATURE_DEBUG=y in tester config to enable the
runtime debug option.
2021-10-08 13:59:39 -07:00
Luiz Augusto von Dentz
56c70d431e test-hog: Update pdu sequence
With recent changes to use bt_att_resend the procedures such as read
long will group the reads to the same handler before proceeding to the
next procedures.
2021-10-06 14:36:51 -07:00
Luiz Augusto von Dentz
ac2c2e10b3 attrib: Make use of bt_att_resend
If the id != 0 that means that a proceedure that needs multiple PDUs is
in progress so use bt_att_resend with its id that way the bt_att id and
gattrib shall always be the same.
2021-10-06 14:36:50 -07:00
Luiz Augusto von Dentz
ebc08d9423 shared/gatt-client: Make use of bt_att_resend
This makes use of bt_att_resend when sending continuation of PDUs such
as BT_ATT_OP_READ_BLOB_REQ and BT_ATT_OP_PREP_WRITE_REQ to avoid having
it interleave with other procedures, which is both simpler for the
peripheral to handle as well as it should reduce the lifetime of the
objects used for tracking the state of these procedures.
2021-10-06 14:36:48 -07:00
Luiz Augusto von Dentz
6024de8589 shared/att: Add bt_att_resend
This adds bt_att_resend which can be used with procedures that needs to
send multiple PDUs to complete (e.g. Read Long, Write Long, etc.) so
they are pushed to the head instead of the tail of the queue so one can
retain its position on the queue.
2021-10-06 14:36:46 -07:00
Tedd Ho-Jeong An
b353ae3cf2 tools/mgmt-tester: Update the correct suspend reason for disconnect
This patch fixes the suspend reason for the pairing test cases to the
disconnect.
2021-10-06 10:40:04 -07:00
Tedd Ho-Jeong An
be1af7b8be tools/mgmt-tester: Fix the suspend reason code
This patch fixes the suspend reason code to align with the corrent
kernel implementation.
2021-10-05 11:39:19 -07:00
Tedd Ho-Jeong An
bb12ef4a9f tools/mgmt-tester: Add test cases for load_long_term_keys command
This patch adds extra test cases for load_long_term_keys command.
2021-10-04 16:07:47 -07:00
Miao-chen Chou
f4151f35b2 client: Print error code for connect methods
The following steps were performed.
- Issuing repeated commands to connect the same BLE device.
- Verifying the print in bluetoothctl console

Reviewed-by: Alain Michaud <alainm@chromium.org>
Reviewed-by: Howard Chung <howardchung@google.com>
2021-10-04 15:44:56 -07:00
Miao-chen Chou
e20bd10368 device: Include detailed error string in Connect() return
This replaces generic strerror message with context detailed error
string to better indicate the detailed failure reason so that the D-Bus
clients can optimize their application to work better with BlueZ, e.g.
introducing retry mechanism or building metrics.

Reviewed-by: Alain Michaud <alainm@chromium.org>
Reviewed-by: Howard Chung <howardchung@google.com>
2021-10-04 15:44:56 -07:00
Miao-chen Chou
8f73362e8c error: BR/EDR and LE connection failure reasons
The source of Connect() failures can be divided into the following
three.
- bluetoothd's device interface state transition and profile state
  transition
- Kernel's L2CAP layer state transition
- Potential HCI error codes returned by the remote device

Reviewed-by: Alain Michaud <alainm@chromium.org>
Reviewed-by: Howard Chung <howardchung@google.com>
2021-10-04 15:44:55 -07:00
Miao-chen Chou
de48279160 doc: Add errors.txt to describe errors of D-Bus method returns 2021-10-04 15:44:55 -07:00
Manish Mandlik
cf4144ff47 adv_monitor: Mark the device as lost on device_lost_timeout
Mark the device as lost on device_lost_timeout so that it can be found
again next time.

Verified this by adding a monitor using bluetoothctl and confirming that
the DeviceLost event is getting triggered when bt peer stops advertising
and DeviceFound event gets triggered again when the bt peer restarts the
advertising.

Reviewed-by: Yun-Hao Chung <howardchung@google.com>
2021-10-04 15:44:43 -07:00
Dagan Martinez
61576a8e78 gatt: Allow GATT server to dicate CCC permissions
Allow a GATT server to impose write permissions/restrictions on a CCC by
setting additional `X-notify` and `X-indicate` flags on its associated
characteristic.

This allows a developer to require encryption/authentication in order
for a GATT client to subscribe to server-initiated updates.

```
[bluetooth]# register-characteristic\
	4b75f0f8-1f23-46b1-900c-5bbabcd5ca93 encrypt-read,encrypt-notify

[NEW] Characteristic (Handle 0x0000)
        /org/bluez/app/service0/chrc17
        4b75f0f8-1f23-46b1-900c-5bbabcd5ca93
        Vendor specific
[/org/bluez/app/service0/chrc17] Enter value: 42
```
2021-10-01 10:59:14 -07:00
Dagan Martinez
7d0fc7e7f0 doc/gatt-api: Add 'X-notify/X-indicate`
Update docs to reflect the addition of the `X-notify` and `X-indicate`
characteristic flags, which allow a GATT server to restrict CCC write
permissions.
2021-10-01 10:58:56 -07:00
Tedd Ho-Jeong An
c1e6d6c46f tools/mgmt-tester: Add suspend/resume test cases
This patch adds the suspend/resume test cases:

Suspend/Resume - Success 1 (Suspend)
Suspend/Resume - Success 2 (Resume)
Suspend/Resume - Success 3 (Device in WL)
Suspend/Resume - Success 4 (Advertising)
Suspend/Resume - Success 5 (Pairing - Legacy)
Suspend/Resume - Success 6 (Pairing - SSP)
2021-09-29 15:43:17 -07:00
Tedd Ho-Jeong An
77eed55b30 tools/mgmt-tester: Fix Read Experiemental Feature test case
The quality report feature is supported only if the device support it.
Current emulator/btdev doesn't support it yet.

This patch updates the supported experimental feature list to align with
the current btdev implementation.
2021-09-29 15:43:16 -07:00
Bernie Conrad
838c0dc764 gatt: Fix not cleaning up when disconnected
There is a current use after free possible on a gatt server if a client
disconnects while a WriteValue call is being processed with dbus.

This patch includes the addition of a pending disconnect callback to handle
cleanup better if a disconnect occurs during a write, an acquire write
or read operation using bt_att_register_disconnect with the cb.
2021-09-29 15:43:15 -07:00
Luiz Augusto von Dentz
1e9ce5ed80 client: Print MTU on attribute-info
This prints the MTU of the characteristic when available.
2021-09-28 16:53:08 -07:00
Luiz Augusto von Dentz
3a6b5f5ec1 gatt: Emit PropertiesChanged("MTU") when MTU is exchanged
This notifies client when the ATT MTU changes.
2021-09-28 16:42:58 -07:00
Luiz Augusto von Dentz
9bb8fbe51a shared/att: Add bt_att_register_exchange
This adds bt_att_register_exchange which can be used to register
handlers that gets notified when the MTU gets changed via MTU exchange
procedure.
2021-09-28 16:07:10 -07:00
Luiz Augusto von Dentz
aaa0c4996a gatt: Add implementation of GattCharacteristic1.MTU
This implements MTU property in GattCharacteristic1 interface.
2021-09-28 15:45:05 -07:00
Luiz Augusto von Dentz
1abf1400fa gatt-api: Add MTU property to GattCharacteristic1
This adds MTU properyt to GattCharacteristic1 which can be used in
order to determine how much data can be read/write using non-long
procedures which sometimes is the only thing the remote device
supports.

Fixes: https://github.com/bluez/bluez/issues/199
2021-09-28 15:42:46 -07:00
Luiz Augusto von Dentz
756fbd5ebd doc/tester-config: Enable KASAN
This patch adds CONFIG_KASAN=y in tester config.
2021-09-27 15:27:51 -07:00
Luiz Augusto von Dentz
2df3bba5b7 doc/tester-config: Enable Android Extension
This patch adds Android Extension in tester config.
2021-09-27 15:27:51 -07:00
Tedd Ho-Jeong An
f2db5c7afd doc/tester-config: Enable Microsoft Extension
This patch adds Microsoft Extension in tester config.
2021-09-27 15:27:51 -07:00
Inga Stotland
91c9329a05 tools/mesh-cfgclient: Export configuration database
This adds main menu command "export-db".
When the command is invoked, JSON configuration object is
cloned and trimmed of extraneous properties.
Information about netkeys, appkeys and device keys are obtained
from bluetooth-meshd by calling ExportKeys() method.
The obtained key values are recorded in the export JSON object.
2021-09-27 13:22:40 -07:00
Inga Stotland
7514aa8d9c tools/mesh-cfgclient: Excluded addresses property
The correct name for a property that contains a list of addresses
not allowed in circulation is "networkExclusions"
The "excluded" property in "nodes" array entry is used to indicated that
this node has been removed from a mesh network and it's address should not
be re-used.
2021-09-27 13:22:40 -07:00
Inga Stotland
1616e4883f tools/mesh-cfgclient: Store UUIDs in standard format
Use standard xxxx-xx-xx-xx-xxxxxxxx format for string
representation of mesh and node UUIDs in stored configuration.
2021-09-27 13:22:40 -07:00
Inga Stotland
eb642a59fb mesh: Implement ExportKeys() method
Add implementation for new method ExportKeys() on
org.bluez.mesh.Management1 interface.
This method is used by the authorized application to export information
about network keys, application keys and device keys present in the
local key database.
2021-09-27 13:22:39 -07:00
Inga Stotland
1dc1106895 doc/mesh-api: Add ExportKeys call
Add description for a new method:
ExportKeys() on org.bluez.mesh.Management1 interface.

This method is used by the authorized application to export information
about network keys, application keys and device keys present in the local
key database.
2021-09-27 13:22:39 -07:00
Inga Stotland
4e16431a51 tools/mesh-cfgclient: Add group parent address for DB compliance 2021-09-27 13:22:39 -07:00
Inga Stotland
55f91fd373 tools/mesh-cfgclient: Store remote's heartbeat sub/pub
Store remote node's heartbeat publication or subscription info upon
receiving CONFIG_HEARTBEAT_PUB_STATUS or CONFIG_HEARTBEAT_SUB_STATUS
messages when the messages' status code is set to Success.
2021-09-27 13:22:39 -07:00
Inga Stotland
725ad808fd tools/mesh-cfgclient: Save remote node feature setting
Save the information for remote node's relay, friend, proxy and
secure network beacon settings.
2021-09-27 13:22:39 -07:00
Inga Stotland
8525542fa7 tools/mesh-cfgclient: Rename mesh-db APIs for consistency 2021-09-27 13:22:39 -07:00
Inga Stotland
278805887d tools/mesh-cfgclient: Check the result of config save
After successful completion of configuration commands that change
configuration state of network, the updates are expected to be
recorded in configuration file. If for the results are not saved,
print a warning message.
2021-09-27 13:22:39 -07:00
Inga Stotland
8dc6b45207 tools/mesh-cfgclient: Store remote's model publication info
Update remote node's model publication after a successful completion
of "pub-set" or "pub-get" commands.
2021-09-27 13:22:39 -07:00
Inga Stotland
d66d3d34f9 tools/mesh-cfgclient: Disallow model commands w/o composition
If remote node's composition hasn't been acquired, disallow commands
that change model state (that is, bindings, subscriptions, publications).
Prompt to run "get-composition" command first.
2021-09-27 13:22:39 -07:00
Inga Stotland
5d14cbc2d5 tools/mesh-cfgclient: Store remote node's model subs
Update remote node's model subscriptions after a successful completion
of "sub-add", "sub-del", "sub-wrt" and "sub-del_all" commands.
2021-09-27 13:22:39 -07:00
Inga Stotland
aabda1e487 tools/mesh-cfgclient: Store remote node's model bindings
Update remote node's model binding after a successful completion
of "bind" or "unbind" commands.
2021-09-27 13:22:39 -07:00
Inga Stotland
87d13379a5 tools/mesh-cfgclient: Overwrite config values when adding new ones
This changes common utilities used in mesh-db.c to replace old values
by default whenever a new value is written.
2021-09-27 13:22:39 -07:00
Inga Stotland
e01a82948f tools/mesh: Add new info to stored remote nodes
When adding a new remote node into configuration database,
initialize additional default properties:
"excluded": false
"security": "secure"
"configComplete": false
2021-09-27 13:22:39 -07:00
Inga Stotland
d4e093b54f tools/mesh-cfgclient: Keep track of updated keys 2021-09-27 13:22:39 -07:00
Inga Stotland
ad1ecb0ad8 tools/mesh-cfgclient: Update stored NetKey and AppKey
NetKeys:
- Record additional properties: "name", "minSecurity", "timestamp"

AppKeys:
- Record additional property: "name"
2021-09-27 13:22:39 -07:00
Inga Stotland
a3054bda48 tools/mesh-cfgclient: Add timestamp to config database
This adds timestamp property to the configuration database.
The UTC timestamp format: YYYY-MM-DDThh:mm:ssZ
2021-09-27 13:22:39 -07:00