platform/upstream/bluez.git
18 months agoriscv64: Set ARCH64 on RISC-V 59/284559/1 submit/tizen/20221206.094110
Marek Pikuła [Mon, 14 Nov 2022 11:49:54 +0000 (12:49 +0100)]
riscv64: Set ARCH64 on RISC-V

Change-Id: I8c87bccaf6ccde2f82cefa387c0b5c6f26f1c0f1
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
18 months agoSupport RFCOMM Client and Server with same UUID 41/284041/1 accepted/tizen/unified/20221115.172855
Anuj Jain [Wed, 9 Nov 2022 04:57:43 +0000 (10:27 +0530)]
Support RFCOMM Client and Server with same UUID

This patch add functionality to support both RFCOMM
client and server with same UUID at a time.

Change-Id: Ie64d46d9d50de65f322112a6a3793b05922254f4
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
18 months agoa2dp: Fix not detecting transport connection collision 66/283666/1 accepted/tizen/unified/20221103.165739
Luiz Augusto von Dentz [Fri, 16 Sep 2022 21:35:28 +0000 (14:35 -0700)]
a2dp: Fix not detecting transport connection collision

Some headsets appears to attempt to connect back after receiving
AVDTP_Open which would cause unexpected transitions since setup->io
and stream->io would not be in sync:

> ACL Data RX: Handle 70 flags 0x02 dlen 6
      Channel: 64 len 2 [PSM 25 mode Basic (0x00)] {chan 0}
      AVDTP: Open (0x06) Response Accept (0x02) type 0x00 label 2 nosp 0
< ACL Data TX: Handle 70 flags 0x00 dlen 12
      L2CAP: Connection Request (0x02) ident 6 len 4
        PSM: 25 (0x0019)
        Source CID: 67
> ACL Data RX: Handle 70 flags 0x02 dlen 12
      L2CAP: Connection Request (0x02) ident 10 len 4
        PSM: 25 (0x0019)
        Source CID: 68
< ACL Data TX: Handle 70 flags 0x00 dlen 16
      L2CAP: Connection Response (0x03) ident 10 len 8
        Destination CID: 68
        Source CID: 68
        Result: Connection pending (0x0001)
        Status: Authorization pending (0x0002)
< ACL Data TX: Handle 70 flags 0x00 dlen 16
      L2CAP: Connection Response (0x03) ident 10 len 8
        Destination CID: 68
        Source CID: 68
        Result: Connection successful (0x0000)
        Status: No further information available (0x0000)
> ACL Data RX: Handle 70 flags 0x02 dlen 16
      L2CAP: Connection Response (0x03) ident 6 len 8
        Destination CID: 69
        Source CID: 67
        Result: Connection successful (0x0000)
        Status: No further information available (0x0000)

Fixes: https://github.com/bluez/bluez/issues/327
Change-Id: Ifb7f3014cb73701e591cead934f0ce04bab4ca1c
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
19 months agofhub: create the bluez log to /run/network/log 49/281849/2
Ayush Garg [Thu, 22 Sep 2022 08:56:49 +0000 (14:26 +0530)]
fhub: create the bluez log to /run/network/log

Change-Id: I6564eeb4b46e142de74587c350c13427b773d04c
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
19 months agoFix the coverity issues 56/281456/1 accepted/tizen_7.0_unified_hotfix tizen_7.0_hotfix accepted/tizen/7.0/unified/20221110.062900 accepted/tizen/7.0/unified/hotfix/20221116.110628 accepted/tizen/unified/20220920.110657 tizen_7.0_m2_release
Wootak Jung [Mon, 19 Sep 2022 07:28:33 +0000 (16:28 +0900)]
Fix the coverity issues

Change-Id: Iea3544fb1a71b9cde9693646b598310777bae66e

20 months agofhub: diallaow A2DP multistream and change avrcp version 38/281338/1
Ayush Garg [Wed, 14 Sep 2022 04:48:52 +0000 (10:18 +0530)]
fhub: diallaow A2DP multistream and change avrcp version

Change-Id: I4f89fe9e46689fc7854b2f7313aca46f41226bc3
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
20 months agofhub: apply DA feature (default a2dp mode, adv data flag) 45/281145/2
Ayush Garg [Tue, 13 Sep 2022 09:19:48 +0000 (14:49 +0530)]
fhub: apply DA feature (default a2dp mode, adv data flag)

Change-Id: I9251ad5ddac62efeb6c743ed086c13f526594c21
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
20 months agofhub: do not support Player Application Settings in AVRCP TG role 48/281048/1
Ayush Garg [Thu, 8 Sep 2022 08:05:29 +0000 (13:35 +0530)]
fhub: do not support Player Application Settings in AVRCP TG role

Change-Id: I566d1fe5aa1dd0e047a7c6bb5614a6d8fc5e4e2b
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
20 months agofhub: Add new profile for Family Hub 20/280820/1
Ayush Garg [Mon, 5 Sep 2022 09:32:21 +0000 (15:02 +0530)]
fhub: Add new profile for Family Hub

Change-Id: I9b3bb497e4359e1e4c33817fab4c7bb8f9a8fb56
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
23 months agoadapter: Set max_filter to 0 not empty if filter not supported 43/275843/2 accepted/tizen/unified/20220615.135403 submit/tizen/20220614.010252
Wootak Jung [Thu, 2 Jun 2022 23:19:55 +0000 (08:19 +0900)]
adapter: Set max_filter to 0 not empty if filter not supported

D/BLUETOOTH_HAL( 6284): bt-hal-adapter-dbus-handler.c:
    __bt_adapter_all_properties_cb(862) > LE Supported features
D/BLUETOOTH_HAL( 6284): bt-hal-adapter-dbus-handler.c:
    __bt_adapter_all_properties_cb(888) > le supported features values are NOT provided by Stack
...
E/BLUETOOTH_HAL( 2510): bt-hal-adapter-le.c:
    _bt_hal_get_available_adv_slot_id(347) > le_adv_slot is NULL
E/BLUETOOTH_HAL( 2510): bt-hal-gatt-server.c:
    bt_hal_gatts_allocate_adv_slot(3637) > failed to get the adv_slot
E/BLUETOOTH_HAL( 2510): bt-hal-gatt-server.c:
    gatt_server_multi_adv_enable(3749) > failed to get adv_slot

Change-Id: I41515e7efa47dbb2255451e845b209a31d0a6b5f

23 months agoMerge "adapter: Disable platform scan filter feature" into tizen submit/tizen/20220531.044319 submit/tizen/20220601.225953
Wootak Jung [Thu, 26 May 2022 22:45:00 +0000 (22:45 +0000)]
Merge "adapter: Disable platform scan filter feature" into tizen

23 months agoadapter: Disable platform scan filter feature 93/275493/1
Wootak Jung [Thu, 26 May 2022 01:04:01 +0000 (10:04 +0900)]
adapter: Disable platform scan filter feature

Change-Id: I27798e150d25068c59706f18eeded947d75ad00b

23 months agoRemove the ceritifcate definition 80/275480/1
Dohyun Pyun [Wed, 25 May 2022 22:34:14 +0000 (07:34 +0900)]
Remove the ceritifcate definition

We will handle the certification logic in the runtime

Change-Id: Ic8b96a2f88d7821f1cdba7c8244618c637e5685d
Signed-off-by: Dohyun Pyun <dh79.pyun@samsung.com>
23 months agoCheck the certification mode in the runtime 89/275389/1
Dohyun Pyun [Mon, 23 May 2022 05:25:26 +0000 (14:25 +0900)]
Check the certification mode in the runtime

Change-Id: Ibde861ed71f0998d61fdbab25681c8226df19ed7
Signed-off-by: Dohyun Pyun <dh79.pyun@samsung.com>
2 years agoModify the packaging for hcidump 91/274891/1
Dohyun Pyun [Wed, 11 May 2022 11:18:15 +0000 (20:18 +0900)]
Modify the packaging for hcidump

Change-Id: I443586fcbc5fe01dae47a8edd826f5875e98751e
Signed-off-by: Dohyun Pyun <dh79.pyun@samsung.com>
2 years agoshared/gatt-server: Add PTS certification logic 49/274749/1
Wootak Jung [Mon, 9 May 2022 01:31:26 +0000 (10:31 +0900)]
shared/gatt-server: Add PTS certification logic

GATT/CL/GAI/BI-01-C
GATT/SR/GAR/BI-04-C
GATT/SR/GAR/BI-10-C
GATT/SR/GAW/BI-12-C

Change-Id: I4fce46e7f2ea669b445767b597d0a6475e71381f

2 years agoaudio/avrcp: Add PTS certification related logic 19/273919/3 accepted/tizen/unified/20220503.071451 submit/tizen/20220419.002311 submit/tizen/20220502.051527 submit/tizen/20220502.224718
Wootak Jung [Mon, 18 Apr 2022 00:55:02 +0000 (09:55 +0900)]
audio/avrcp: Add PTS certification related logic

IOPT/SR/SDSS/BV-02-I

Change-Id: I8d209bd6f2e541870d8e6446522dceb533dfdb0d

2 years agoshared/gatt-server: Add PTS certification related logic 18/273918/3
Wootak Jung [Mon, 18 Apr 2022 00:52:10 +0000 (09:52 +0900)]
shared/gatt-server: Add PTS certification related logic

GATT/SR/GAW/BI-05-C
GATT/SR/GAR/BI-34-C
GATT/SR/GAR/BI-35-C
GATT/SR/GAW/BI-12-C

Change-Id: I049f410d9eecdc490ba275c907891def179ee8c7

2 years agoAdd certificate definition for PTS 17/273917/1
Wootak Jung [Mon, 18 Apr 2022 00:46:42 +0000 (09:46 +0900)]
Add certificate definition for PTS

Change-Id: I3619e2dc82cdd7253e08109ee1345e9e1527c1fd

2 years agoFix svace issue 59/272559/1 accepted/tizen/unified/20220323.062650 submit/tizen/20220322.002237
Wootak Jung [Mon, 21 Mar 2022 02:35:36 +0000 (11:35 +0900)]
Fix svace issue

Remove unnecessary check logic

Change-Id: I39d8c4753d30be92c300bafb7f7aef11d4f7f9b9

2 years agoRemove unnecessary dbus policy 45/272445/1 accepted/tizen/unified/20220318.133040 submit/tizen/20220317.013237
Wootak Jung [Thu, 17 Mar 2022 01:20:10 +0000 (10:20 +0900)]
Remove unnecessary dbus policy

FAILED(assert) at /busconfig/policy[1]/allow[5] : You mustn't use
send_interface without send_destination or send_destination_prefix,
unless you limit the rule to only signals with send_type="signal"

Change-Id: I0074697fa485ea60fe2a1264e7499043cd41a2e6

2 years agoMerge "Add avtest to test rpm" into tizen submit/tizen/20220314.225934 submit/tizen/20220316.003414
Wootak Jung [Mon, 14 Mar 2022 07:58:46 +0000 (07:58 +0000)]
Merge "Add avtest to test rpm" into tizen

2 years agoAdd avtest to test rpm 81/272281/1
Wootak Jung [Mon, 14 Mar 2022 05:20:37 +0000 (14:20 +0900)]
Add avtest to test rpm

Change-Id: I36cb45a3d2f3da08374dff4094ae45a6491984c6

2 years agoUpdate the version to 5.63 bluez_upgrade_5.63 submit/tizen/20220313.220938
Ayush Garg [Fri, 11 Mar 2022 13:40:49 +0000 (19:10 +0530)]
Update the version to 5.63

Change-Id: I04c0b9d1795e7ad9c9b8101f9e69131e43f102a7
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoRelease 5.63
Marcel Holtmann [Wed, 5 Jan 2022 21:49:00 +0000 (22:49 +0100)]
Release 5.63

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agogattrib: Fix passing NULL to memcpy
Luiz Augusto von Dentz [Tue, 21 Dec 2021 20:48:31 +0000 (12:48 -0800)]
gattrib: Fix passing NULL to memcpy

This fixes the following runtime error:

  attrib/gattrib.c:198:2: runtime error: null pointer passed as
  argument 2, which is declared to never be null

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agobootstrap-configure: Enable sanitizer options
Luiz Augusto von Dentz [Mon, 20 Dec 2021 23:50:52 +0000 (15:50 -0800)]
bootstrap-configure: Enable sanitizer options

This makes bootstrap-configure enables all sanitizers.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agobuild: Fix build when sanitizer are enabled
Luiz Augusto von Dentz [Mon, 20 Dec 2021 23:51:49 +0000 (15:51 -0800)]
build: Fix build when sanitizer are enabled

This fixes various issues found when sanitizers are enabled.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agobuild: Add sanitizer options
Luiz Augusto von Dentz [Mon, 20 Dec 2021 23:49:45 +0000 (15:49 -0800)]
build: Add sanitizer options

Build using Address Sanitizer (asan), Leak Sanitizer (lsan), or
Undefined Behavior Sanitizer (ubsan) by using one of these options for
the configure script:

  --enable-asan
  --enable-lsan
  --enable-ubsan

For each of these to work, the compiler must support the requested
sanitizer and the requisite libraries must be installed (libasan,
liblsan, libubsan).

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agotest-hog: Add monitor support
Luiz Augusto von Dentz [Tue, 21 Dec 2021 19:32:51 +0000 (11:32 -0800)]
test-hog: Add monitor support

This adds monitor support so data can properly be decoded by the likes
of btmon:

= test-hog: /TP/HGRF/RH/BV-01-I - init
= test-hog: /TP/HGRF/RH/BV-01-I - setup
= test-hog: /TP/HGRF/RH/BV-01-I - setup complete
= test-hog: /TP/HGRF/RH/BV-01-I - run
> test-hog: User Data RX
      ATT: Read By Group Type Request (0x10) len 6
        Handle range: 0x0001-0xffff
        Attribute group type: Primary Service (0x2800)

Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agodevice: Fix bogus errors on load_att_info
Luiz Augusto von Dentz [Wed, 15 Dec 2021 22:48:07 +0000 (14:48 -0800)]
device: Fix bogus errors on load_att_info

load_att_info would attempt to load attributes file from the storage but
in case it doesn't exists it would print an error instead of just
bailing out as attributes file is created on demand when there are
something to be stored.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoadvertising: Fix reporting advertising properties
Claudio Takahasi [Wed, 15 Dec 2021 18:05:27 +0000 (15:05 -0300)]
advertising: Fix reporting advertising properties

InterfacesAdded signal for LEAdvertisingManager1 might be emitted
containing initial/default properties values and property changed is
not emitted after reading advertising features. This patch registers
the interface (LEAdvertisingManager1) after reading advertising features
from kernel.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoshared/gatt-client: Skip included service if it cannot be resolved
Luiz Augusto von Dentz [Wed, 10 Nov 2021 22:10:53 +0000 (14:10 -0800)]
shared/gatt-client: Skip included service if it cannot be resolved

Instead of failing if the included service cannot be resolved just
skip it so doesn't fail and the discovery is stop due to a possible
application error.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agobtdev: Add support for BT_HCI_CMD_LE_CREATE_CONN_CANCEL
Luiz Augusto von Dentz [Fri, 10 Dec 2021 23:19:07 +0000 (15:19 -0800)]
btdev: Add support for BT_HCI_CMD_LE_CREATE_CONN_CANCEL

This adds support for BT_HCI_CMD_LE_CREATE_CONN_CANCEL so it is able to
generate proper command complete.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoprofiles/health: Replace random number generation function
Tedd Ho-Jeong An [Wed, 8 Dec 2021 22:39:23 +0000 (14:39 -0800)]
profiles/health: Replace random number generation function

This patch replaces the rand() function to the getrandom() syscall.

It was reported by the Coverity scan
  rand() should not be used for security-related applications, because
  linear congruential algorithms are too easy to break

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoplugins: Replace random number generation function
Tedd Ho-Jeong An [Wed, 8 Dec 2021 22:39:22 +0000 (14:39 -0800)]
plugins: Replace random number generation function

This patch replaces the rand() function to the getrandom() syscall.

It was reported by the Coverity scan
  rand() should not be used for security-related applications, because
  linear congruential algorithms are too easy to break

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agotools/btgatt-server: Replace random number generation function
Tedd Ho-Jeong An [Wed, 8 Dec 2021 22:39:21 +0000 (14:39 -0800)]
tools/btgatt-server: Replace random number generation function

This patch replaces the rand() function to the getrandom() syscall.

It was reported by the Coverity scan
  rand() should not be used for security-related applications, because
  linear congruential algorithms are too easy to break

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoperipheral: Replace random number generation function
Tedd Ho-Jeong An [Wed, 8 Dec 2021 22:39:20 +0000 (14:39 -0800)]
peripheral: Replace random number generation function

This patch replaces the rand() function to the getrandom() syscall.

It was reported by the Coverity scan
  rand() should not be used for security-related applications, because
  linear congruential algorithms are too easy to break

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoemulator: Replace random number generation function
Tedd Ho-Jeong An [Wed, 8 Dec 2021 22:39:19 +0000 (14:39 -0800)]
emulator: Replace random number generation function

This patch replaces the rand() function to the getrandom() syscall.

It was reported by the Coverity scan
  rand() should not be used for security-related applications, because
  linear congruential algorithms are too easy to break

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoclient/gatt: Fix property_change in WriteValue for desc
Ulisses Costa [Mon, 6 Dec 2021 23:40:01 +0000 (00:40 +0100)]
client/gatt: Fix property_change in WriteValue for desc

g_dbus_emit_property_changed was not working properly in the WriteValue
for the descriptor because the Characteristic interface was being used.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agomesh: Don't log error for false positive mkdir failure
Inga Stotland [Tue, 30 Nov 2021 23:14:12 +0000 (15:14 -0800)]
mesh: Don't log error for false positive mkdir failure

When invoking mkdir() for mesh configuration storage, do not
report an error if a target directory already exists.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agogatt: Omit MTU if not connected
Luiz Augusto von Dentz [Mon, 29 Nov 2021 17:59:42 +0000 (09:59 -0800)]
gatt: Omit MTU if not connected

If not connected there is no reason to expose the MTU as that only
valid while connected.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agogatt-client: Fix disconnecting due to GattCharacteristic1.MTU
Javier de San Pedro [Sat, 27 Nov 2021 22:21:36 +0000 (23:21 +0100)]
gatt-client: Fix disconnecting due to GattCharacteristic1.MTU

After the MTU dbus property patches in 5.62 we are seeing bluetoothd
terminate frequently with "Disconnected from D-Bus. Exiting." msgs.
Apparently this is because bluetoothd sent an invalid reply to a D-Bus
Property Get (for GattCharacteristic1's MTU).
Multiple issues in bluez Github.com project reported similar behavior;
at least #235 (see Fixes:), #219, and likely #238.

When the Characteristic1 object is still cached/alive, but the
underlying att connection is not (e.g. someone just called Disconnect),
the property getter (characteristic_get_mtu) right now returns false.
However, gdbus seems to ignore the return value and sends the empty reply
message anyway (rather than a dbus error?), and this seems to cause
the dbus connection to be terminated (due to the ill-formed reply?).
bluetoothd then aborts.

This patch makes the property value BT_ATT_DEFAULT_LE_MTU if the
underlying att object does not exist, rather than returning an invalid
message. This is consistent with the existing PropertyChanged signal
behavior (we will emit a PropertyChange only if a larger MTU is
exchanged), and fixes the issue on my machines.
An alternative could be to change gdbus behavior, but I'm not sure if we
are allowed to return an error here anyway without causing problems in
other dbus libraries/wrappers.

Fixes: aaa0c4996ae9 ("gatt: Add implementation of GattCharacteristic1.MTU")
Fixes: https://github.com/bluez/bluez/issues/235
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agodoc: Add Name Request Fail flag in device found event
Archie Pusaka [Thu, 25 Nov 2021 07:06:27 +0000 (15:06 +0800)]
doc: Add Name Request Fail flag in device found event

Userspace should use this new flag to decide whether to do the remote
name resolving or not.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agomain: add configurable RemoteNameRequestRetryDelay parameter
Archie Pusaka [Thu, 25 Nov 2021 07:06:26 +0000 (15:06 +0800)]
main: add configurable RemoteNameRequestRetryDelay parameter

This specifies how long will the userspace ignore a peer with an
unknown name after a failed remote name resolving procedure.

The peer device can still be connected, this only prevents the remote
name resolving procedure retry.

Reviewed-by: Miao-chen Chou <mcchou@chromium.org>
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agodevice: Save remote name request attempts into cache file
Archie Pusaka [Thu, 25 Nov 2021 07:06:25 +0000 (15:06 +0800)]
device: Save remote name request attempts into cache file

Since a peer device is potentially removed if not discovered for more
than 30 seconds, we would lost the remote name request activity when
the device is rediscovered. This could end up with a remote name
request much sooner than we intend it to be.

Therefore, put the RNR record into a cache file, so we can recover it
when the peer device is rediscovered.

Reviewed-by: Miao-chen Chou <mcchou@chromium.org>
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoListen and process remote name resolving failure
Archie Pusaka [Thu, 25 Nov 2021 07:06:24 +0000 (15:06 +0800)]
Listen and process remote name resolving failure

When Remote Name Resolve ends with failure, record this occurrence and
prevent remote name resolving for the same device for some time.

Reviewed-by: Miao-chen Chou <mcchou@chromium.org>
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agomgmt: Add NAME_REQUEST_FAILED flag for device_found event
Archie Pusaka [Thu, 25 Nov 2021 07:06:23 +0000 (15:06 +0800)]
mgmt: Add NAME_REQUEST_FAILED flag for device_found event

Report failure when resolving remote name to userspace. This is useful
so the userspace can make an informed decision when to retry name
resolving procedure.

Reviewed-by: Miao-chen Chou <mcchou@chromium.org>
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agobuild: Check for linux/uinput.h and linux/uhid.h
Luiz Augusto von Dentz [Tue, 23 Nov 2021 21:32:12 +0000 (13:32 -0800)]
build: Check for linux/uinput.h and linux/uhid.h

This makes configure to check the presence of linux/uinput.h and
linux/uhid.h kernel uapi headers since the code no longer contain copies
of them and otherwise the code cannot be build without them:

checking linux/uinput.h usability... yes
checking linux/uinput.h presence... yes
checking for linux/uinput.h... yes
checking linux/uhid.h usability... yes
checking linux/uhid.h presence... yes
checking for linux/uhid.h... yes

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoemulator: fix potential resource leak
Tedd Ho-Jeong An [Tue, 16 Nov 2021 06:49:49 +0000 (22:49 -0800)]
emulator: fix potential resource leak

This patch releases the allocated fd to prevent the potential resource
leak. This was reported by the Coverity scan.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agocore: Update default advmon Sampling_Period to 0xFF
Manish Mandlik [Sat, 20 Nov 2021 15:29:41 +0000 (07:29 -0800)]
core: Update default advmon Sampling_Period to 0xFF

Update default Advertisemet Monitor Sampling_Period to 0xFF. It
indicates that controller will report only one advertisement per
monitoring period for a device. This will help reduce the power
consumption drastically.

Reviewed-by: Miao-chen Chou <mcchou@google.com>
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoadv_monitor: Change sampling period to uint16_t
Manish Mandlik [Sat, 20 Nov 2021 15:29:40 +0000 (07:29 -0800)]
adv_monitor: Change sampling period to uint16_t

In the Advertisement Monitor API, RSSISamplingPeriod is an unsigned
value. Change sampling_period variable to uint16_t in the code.

More info: doc/advertisement-monitor-api.txt

Reviewed-by: Archie Pusaka <apusaka@google.com>
Reviewed-by: Miao-chen Chou <mcchou@google.com>
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoadv_monitor: Invoke DeviceFound/Lost on tracked monitors
Manish Mandlik [Sat, 20 Nov 2021 15:29:39 +0000 (07:29 -0800)]
adv_monitor: Invoke DeviceFound/Lost on tracked monitors

This patch delivers DeviceFound/DeviceLost events to apps over D-Bus
whenever controller starts/stops tracking a device.

Tests performed:
- Add a monitor and verify that DeviceFound/DeviceLost events are
  received whenever controller starts/stops monitoring.
- Verify from logs that only one Adv Report is received from the
  controller when Sampling_Period is set to 0xFF and the
  DeviceFound/DeviceLost functionality still works as intended.
- Verify that DeviceFound/DeviceLost is reported appropriately even
  when the Active Scanning is in progress.
- Verify that the reconnection also works properly with and without
  any active Advertisement Monitor.

Reviewed-by: Miao-chen Chou <mcchou@google.com>
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoadv_monitor: Receive the Device Found/Lost events
Manish Mandlik [Sat, 20 Nov 2021 15:29:38 +0000 (07:29 -0800)]
adv_monitor: Receive the Device Found/Lost events

This patch registers callback functions to receive the Advertisement
Monitor Device Found and Device Lost events. It also disables software
based filtering whenever controller offloading support is available.

Test performed:
- Verified by logs that the MSFT Monitor Device is received from the
  controller and the bluetoothd is notified whenever the controller
  starts/stops monitoring a device.

Reviewed-by: Miao-chen Chou <mcchou@google.com>
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agolib: Add definitions of the Adv Monitor Device Found/Lost events
Manish Mandlik [Sat, 20 Nov 2021 15:29:37 +0000 (07:29 -0800)]
lib: Add definitions of the Adv Monitor Device Found/Lost events

This patch adds definitions of the new Advertisement Monitor Device
Found and Device Lost events to indicate that the controller has
started/stopped tracking a particular device.

Reviewed-by: Miao-chen Chou <mcchou@google.com>
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agodoc: Introduce the Adv Monitor Device Found/Lost events
Manish Mandlik [Sat, 20 Nov 2021 15:29:36 +0000 (07:29 -0800)]
doc: Introduce the Adv Monitor Device Found/Lost events

This patch introduces two new MGMT events
MGMT_EV_ADV_MONITOR_DEVICE_FOUND and MGMT_EV_ADV_MONITOR_DEVICE_LOST to
indicate that the controller has started/stopped tracking a particular
device matching one of the already added Advertisement Monitor.

If the controller offloading support is not available,
MGMT_EV_ADV_MONITOR_DEVICE_FOUND event is also used to report all
advertisements to perform software based filtering whenever we are not
active scanning.

Reviewed-by: Miao-chen Chou <mcchou@google.com>
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agouinput: Remove local copy of uinput.h
Luiz Augusto von Dentz [Mon, 22 Nov 2021 19:39:00 +0000 (11:39 -0800)]
uinput: Remove local copy of uinput.h

uinput.h is part of kernel uapi nowadays so it can be included directly
from linux/uinput.h which has a compatible definition with 32 bits
systems:

https://github.com/bluez/bluez/issues/84#issuecomment-942155841

Fixes: https://github.com/bluez/bluez/issues/84
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoclient: Fix uninitiailzed scalar variable
Tedd Ho-Jeong An [Sat, 13 Nov 2021 02:35:59 +0000 (18:35 -0800)]
client: Fix uninitiailzed scalar variable

This patch fixes the uninitiailzed varialble(CWE-457) reported by
the Coverity scan.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agomonitor: Fix uninitiailzed scalar variable
Tedd Ho-Jeong An [Sat, 13 Nov 2021 02:35:58 +0000 (18:35 -0800)]
monitor: Fix uninitiailzed scalar variable

This patch fixes the uninitiailzed varialble(CWE-457) reported by
the Coverity scan.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoemulator: Fix uninitiailzed scalar variable
Tedd Ho-Jeong An [Sat, 13 Nov 2021 02:35:57 +0000 (18:35 -0800)]
emulator: Fix uninitiailzed scalar variable

This patch fixes the uninitiailzed varialble(CWE-457) reported by
the Coverity scan.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoadmin: fix devices not reset
Yun-Hao Chung [Fri, 12 Nov 2021 04:01:49 +0000 (12:01 +0800)]
admin: fix devices not reset

When |admin_policy_remove| is called, we set |devices| to NULL but never
set it back until |admin_init|. This makes admin lost track of current
registered device interface, so the next |admin_policy_removed| will not
be able to unregister those interfaces.

Reviewed-by: Archie Pusaka <apusaka@chromium.org>
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoshared/gatt-server: Fix heap overflow when appending prepare writes
Luiz Augusto von Dentz [Tue, 8 Jun 2021 23:46:49 +0000 (16:46 -0700)]
shared/gatt-server: Fix heap overflow when appending prepare writes

The code shall check if the prepare writes would append more the
allowed maximum attribute length.

Fixes https://github.com/bluez/bluez/security/advisories/GHSA-479m-xcq5-9g2q

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agosdpd: Fix leaking buffers stored in cstates cache
Luiz Augusto von Dentz [Thu, 15 Jul 2021 18:01:20 +0000 (11:01 -0700)]
sdpd: Fix leaking buffers stored in cstates cache

These buffer shall only be keep in cache for as long as they are
needed so this would cleanup any client cstates in the following
conditions:

 - There is no cstate on the response
 - No continuation can be found for cstate
 - Different request opcode
 - Respond with an error
 - Client disconnect

Fixes: https://github.com/bluez/bluez/security/advisories/GHSA-3fqg-r8j5-f5xq
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agotools/mesh: Add <Vendor ID> option to sub-add cmd
Jefferson Zhai [Fri, 5 Nov 2021 16:57:35 +0000 (09:57 -0700)]
tools/mesh: Add <Vendor ID> option to sub-add cmd

If the Subscription being added is a Vendor Model, there needs to be a
4th parameter. Fixes oversight of not supporting vendor model in Meshctl.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agomgmt-tester: Add test for Device Privacy Mode flag
Luiz Augusto von Dentz [Fri, 5 Nov 2021 19:04:49 +0000 (12:04 -0700)]
mgmt-tester: Add test for Device Privacy Mode flag

This tests the use of Set Device Flags to set Device Privacy Mode which
results in the following sequence:

@ MGMT Event: Command Compl.. (0x0001) plen 10  {0x0001}
      Set Device Flags (0x0050) plen 7
        Status: Success (0x00)
        LE Address: BC:9A:78:56:34:12 (OUI BC-9A-78)
< HCI Command: LE Set Exten.. (0x08|0x0042) plen 6
        Extended scan: Disabled (0x00)
        Filter duplicates: Disabled (0x00)
        Duration: 0 msec (0x0000)
        Period: 0.00 sec (0x0000)
= mgmt-tester: Set Device Flags (0x0050): Success (0x00)
= mgmt-tester: Test condition complete, 4 left
= mgmt-tester: New Device Flags Changed event received
= mgmt-tester: Test condition complete, 3 left
> HCI Event: Command Complete (0x0e) plen 4
      LE Set Extended Scan Enable (0x08|0x0042) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Set Addre.. (0x08|0x002d) plen 1
        Address resolution: Disabled (0x00)
= mgmt-tester: HCI Command 0x2042 length 6
> HCI Event: Command Complete (0x0e) plen 4
      LE Set Address Resolution Enable (0x08|0x002d) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Set Priva.. (0x08|0x004e) plen 8
        Peer Identity address type: Public (0x00)
        Peer Identity address: BC:9A:78:56:34:12 (OUI BC-9A-78)
        Privacy Mode: Use Device Privacy (0x01)
= mgmt-tester: HCI Command 0x202d length 1
= mgmt-tester: Test condition complete, 2 left
> HCI Event: Command Complete (0x0e) plen 4
      LE Set Privacy Mode (0x08|0x004e) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Set Addre.. (0x08|0x002d) plen 1
        Address resolution: Enabled (0x01)
= mgmt-tester: HCI Command 0x204e length 8
= mgmt-tester: Test condition complete, 1 left
> HCI Event: Command Complete (0x0e) plen 4
      LE Set Address Resolution Enable (0x08|0x002d) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Set Exten.. (0x08|0x0041) plen 8
        Own address type: Random (0x03)
        Filter policy: Ignore not in accept list (0x01)
        PHYs: 0x01
        Entry 0: LE 1M
          Type: Passive (0x00)
          Interval: 60.000 msec (0x0060)
          Window: 30.000 msec (0x0030)
= mgmt-tester: HCI Command 0x202d length 1
= mgmt-tester: Test condition complete, 0 left

Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agomonitor: Add support for Device Privacy Mode flag
Luiz Augusto von Dentz [Fri, 5 Nov 2021 19:03:23 +0000 (12:03 -0700)]
monitor: Add support for Device Privacy Mode flag

This adds proper decoding for Device Privacy Mode flag:

@ MGMT Command: Set Device... (0x0050) plen 11  {0x0001}
        LE Address: BC:9A:78:56:34:12 (OUI BC-9A-78)
        Current Flags: 0x00000002
          Device Privacy Mode
@ MGMT Event: Device Flags... (0x002a) plen 15  {0x0002}
        LE Address: BC:9A:78:56:34:12 (OUI BC-9A-78)
        Supported Flags: 0x00000003
          Remote Wakeup
          Device Privacy Mode
        Current Flags: 0x00000002
          Device Privacy Mode

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoadapter: Set Device Privacy Mode
Luiz Augusto von Dentz [Thu, 4 Nov 2021 00:26:30 +0000 (17:26 -0700)]
adapter: Set Device Privacy Mode

This adds support for setting Device Privacy flag when enabled in
main.conf via Privacy = device,limited-device.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agomain.conf: Rework privacy options
Luiz Augusto von Dentz [Thu, 4 Nov 2021 00:25:33 +0000 (17:25 -0700)]
main.conf: Rework privacy options

This reworks privacy options so the limited discoverable is only
available when controller mode is set to dual.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agomgmt-api: Add new Device Flag to use Device Privacy Mode
Luiz Augusto von Dentz [Wed, 3 Nov 2021 22:26:07 +0000 (15:26 -0700)]
mgmt-api: Add new Device Flag to use Device Privacy Mode

This adds a new flag to Get/Set Device Flag commands so it is possible
to set the Device Privacy Mode which allows to connect when the
remote device uses either identity or random address.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agobtdev: Add support for LE Set Privacy mode
Luiz Augusto von Dentz [Tue, 2 Nov 2021 05:33:08 +0000 (22:33 -0700)]
btdev: Add support for LE Set Privacy mode

This adds support for LE Set Privacy mode which is required when using
Device Privacy mode:

< HCI Command: LE Set Priva.. (0x08|0x004e) plen 8
        Peer Identity address type: Public (0x00)
        Peer Identity address: BC:9A:78:56:34:12 (OUI BC-9A-78)
        Privacy Mode: Use Device Privacy (0x01)
> HCI Event: Command Complete (0x0e) plen 4
      LE Set Privacy Mode (0x08|0x004e) ncmd 1

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agomedia: Fix memory leak
Luiz Augusto von Dentz [Tue, 9 Nov 2021 21:50:38 +0000 (13:50 -0800)]
media: Fix memory leak

This fixes the following memory leak as a result of not freeing
app->proxies:

160 (32 direct, 128 indirect) bytes in 1 blocks are definitely lost in
loss record 218 of 261
   at 0x484086F: malloc (vg_replace_malloc.c:381)
   by 0x1CF80E: btd_malloc (util.c:33)
   by 0x1CF24D: queue_new (queue.c:47)
   by 0x144DB9: create_app (media.c:2262)
   by 0x144DB9: register_app (media.c:2322)
   by 0x1CC148: process_message (object.c:246)

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoclient/gatt: Fix using atoi
Luiz Augusto von Dentz [Mon, 8 Nov 2021 19:15:44 +0000 (11:15 -0800)]
client/gatt: Fix using atoi

atoi doesn't support values entered in hexadecimal (0x...) which is
likely the prefered format for the likes of handles, etc, so this
replaces the uses of atoi with strtol.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agomidi: Free ALSA seq resources in midi_device_remove()
Jacek Konieczny [Mon, 1 Nov 2021 13:49:18 +0000 (14:49 +0100)]
midi: Free ALSA seq resources in midi_device_remove()

Sometimes, on connection error, this gets called and frees the device
when midi_disconnect() was not called which would leave ALSA sequencer
objects leaking.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoadapter: Remove "Master" entry from LTK storage
Archie Pusaka [Wed, 3 Nov 2021 09:02:55 +0000 (17:02 +0800)]
adapter: Remove "Master" entry from LTK storage

The entry has been deprecated since 2014 and it's time to remove them
altogether.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agodoc: Add PeripheralLongTermKey for storing LTK
Archie Pusaka [Wed, 3 Nov 2021 09:02:54 +0000 (17:02 +0800)]
doc: Add PeripheralLongTermKey for storing LTK

Update doc to reflect update in adapter.c.

Reviewed-by: Sonny Sasaka <sonnysasaka@chromium.org>
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoadapter: Use PeripheralLongTermKey to store LTK
Archie Pusaka [Wed, 3 Nov 2021 09:02:53 +0000 (17:02 +0800)]
adapter: Use PeripheralLongTermKey to store LTK

Introducing PeripheralLongTermKey group for storing LTK info to
replace the less inclusive term. Currently we still need to write/read
from both to ensure smooth transition, but later we should deprecate
the old term.

Reviewed-by: Sonny Sasaka <sonnysasaka@chromium.org>
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agodevice: Fix not updating the auto-connect/accept list
Luiz Augusto von Dentz [Tue, 2 Nov 2021 00:08:15 +0000 (17:08 -0700)]
device: Fix not updating the auto-connect/accept list

When receiving a new IRK the device address is updated but the old
address is not removed from the auto-connect/accept list.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoadvertising-api: Clarify Duration property
Luiz Augusto von Dentz [Tue, 2 Nov 2021 04:35:52 +0000 (21:35 -0700)]
advertising-api: Clarify Duration property

Duration property refers to the rotation duration not the actual
lifetime of the advertising which is controlled by the Timeout
property.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agomgmt-tester: Add test for Limited/Device Privacy
Luiz Augusto von Dentz [Mon, 1 Nov 2021 22:24:34 +0000 (15:24 -0700)]
mgmt-tester: Add test for Limited/Device Privacy

This adds a test for Limited/Device Privacy (0x02):

@ MGMT Command: Set Privacy (0x002f) plen 17
        Privacy: Limited (0x02)
        Key: 01020304050607080102030405060708
@ MGMT Event: Command Complete (0x0001) plen 7
      Set Privacy (0x002f) plen 4
        Status: Success (0x00)
        Current settings: 0x00002080
          BR/EDR
          Privacy
@ MGMT Event: New Settings (0x0006) plen 4
        Current settings: 0x00002080
          BR/EDR
          Privacy

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agomain.conf: Fix Privacy modes
Luiz Augusto von Dentz [Mon, 1 Nov 2021 22:01:04 +0000 (15:01 -0700)]
main.conf: Fix Privacy modes

Device privacy 0x01 uses RPA regardless of the discoverable setting thus
it conforms to network mode not device mode.

Also this improves documentation to state what is the expectation of
each mode since it may not have been very clear by just using the terms
from the spec.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agotools/mgmt-tester: Add LL Privacy test cases
Tedd Ho-Jeong An [Fri, 29 Oct 2021 18:29:29 +0000 (11:29 -0700)]
tools/mgmt-tester: Add LL Privacy test cases

This patch adds LL Privacy related test cases.

Multi Ext Advertising - Success 3 (Add 2 Advs)
Multi Ext Advertising - Success 4 (Remove Adv)
Multi Ext Advertising - Success 5 (Remove all)
Multi Ext Advertising - Success 6 (Add w/o power on)
Multi Ext Advertising - Fail (Add MAX)

LL Privacy - Add Device 1 (Add to AL)
LL Privacy - Add Device 2 (Add to RL)
LL Privacy - Add Device 3 (Enable RL)
LL Privacy - Add Device 4 (2 Devices to AL)
LL Privacy - Add Device 5 (2 Devices to RL)
LL Privacy - Add Device 6 (RL is full)
LL Privacy - Add Device 7 (WL is full)
LL Privacy - Add Device 8 (Disable Adv)
LL Privacy - Add Device 9 (Multi Adv)
LL Privacy - Add Device 10 (Multi Dev and Multi Adv)

LL Privacy - Remove Device 1 (Remove from AL)
LL Privacy - Remove Device 2 (Remove from RL)
LL Privacy - Remove Device 3 (Disable RL)
LL Privacy - Remove Device 4 (Disable Adv)
LL Privacy - Remove Device 5 (Multi Adv)

LL Privacy - Start Discovery 1 (Disable RL)
LL Privacy - Start Discovery 2 (Disable RL)

LL Privacy - Advertising 1 (Scan Results)
LL Privacy - Acceptor 1
LL Privacy - Acceptor 2

LL Privacy - Pair 1
LL Privacy - Pair 2 (Add to AL)
LL Privacy - Unpair 1
LL Privacy - Unpair 2 (Remove from AL)

Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agotools/mgmt-tester: Update the expected manufacturer of emulator
Tedd Ho-Jeong An [Fri, 29 Oct 2021 18:29:28 +0000 (11:29 -0700)]
tools/mgmt-tester: Update the expected manufacturer of emulator

This patch updates the expected manufacturer of the emulator for the
following test cases:

> Read Ext Controller Info 1                           Failed
> Read Ext Controller Info 2                           Failed
> Read Ext Controller Info 3                           Failed
> Read Ext Controller Info 4                           Failed
> Read Ext Controller Info 5                           Failed

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agodevice: Fix not clearing error on update_bredr_services
Luiz Augusto von Dentz [Wed, 27 Oct 2021 19:53:34 +0000 (12:53 -0700)]
device: Fix not clearing error on update_bredr_services

When trying to loads contents from file using g_key_file_load_from_file
it may cause an error which needs to be cleared since the gerr is
reused, also make sure the file is always created upfront to avoid
having such error when storage has not been initialized.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoobexd: Add missing phonebook backends
Luiz Augusto von Dentz [Tue, 26 Oct 2021 18:03:01 +0000 (11:03 -0700)]
obexd: Add missing phonebook backends

This adds missing phonebook backends to EXTRA_DIST so they can be build
from tarballs.

Fixes: https://github.com/bluez/bluez/issues/222
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoMakefile: Fix code style
Luiz Augusto von Dentz [Tue, 26 Oct 2021 17:54:12 +0000 (10:54 -0700)]
Makefile: Fix code style

Fix lines going over 80 columns.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agogatt: added missing disconn_id's and removed extra check
Bernie Conrad [Tue, 12 Oct 2021 21:51:51 +0000 (14:51 -0700)]
gatt: added missing disconn_id's and removed extra check

Adds missing assignment to disconn_id for pending operations and removes
check that is already handled by checking if the owner_queue of the op
is gone at the start of write_reply_cb.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agotools/mgmt-tester: Add support for experimental feature in setup
Tedd Ho-Jeong An [Mon, 25 Oct 2021 20:31:20 +0000 (13:31 -0700)]
tools/mgmt-tester: Add support for experimental feature in setup

This patch adds support for experimental feature in setup_settings
options.

Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoemulator: Add support to get the advertising address
Tedd Ho-Jeong An [Mon, 25 Oct 2021 20:31:19 +0000 (13:31 -0700)]
emulator: Add support to get the advertising address

This patch add supprt emulator to get the advertising address of the
central device.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoemulator: bthost: Add support LE Ext Adv Report
Tedd Ho-Jeong An [Mon, 25 Oct 2021 20:31:18 +0000 (13:31 -0700)]
emulator: bthost: Add support LE Ext Adv Report

This patch adds support LE_Extended_Advertising_Report Eevnt in bthost.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoemulator: Add support to config the accept and resolve list
Tedd Ho-Jeong An [Mon, 25 Oct 2021 20:31:17 +0000 (13:31 -0700)]
emulator: Add support to config the accept and resolve list

This patch adds interfaces to config the accept list and resolve list in
the btdev.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agobtdev: Fix using the callback return as command complete
Luiz Augusto von Dentz [Fri, 22 Oct 2021 21:51:49 +0000 (14:51 -0700)]
btdev: Fix using the callback return as command complete

Command callback can only be used when generating a command status as
command complete can carry more than just the status.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoadapter: Fix storing IRK causing invalid read
Luiz Augusto von Dentz [Fri, 22 Oct 2021 20:10:09 +0000 (13:10 -0700)]
adapter: Fix storing IRK causing invalid read

When storing an IRK the storage file may not have been created yet
since that uses the device address which is likely changed to the
identity address causing the following trace:

Invalid read of size 8
   at 0x196452: store_irk.constprop.0 (adapter.c:8679)
   by 0x198C92: new_irk_callback (adapter.c:8737)
   by 0x1CF6DC: queue_foreach (queue.c:207)
   by 0x1D1394: process_notify (mgmt.c:308)
   by 0x1D1394: can_read_data (mgmt.c:374)
   by 0x1E0634: watch_callback (io-glib.c:157)
   by 0x4954A9E: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.6600.8)
   by 0x49A6A97: ??? (in /usr/lib64/libglib-2.0.so.0.6600.8)
   by 0x4954162: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.6600.8)
   by 0x1E0CD4: mainloop_run (mainloop-glib.c:66)
   by 0x1E10B1: mainloop_run_with_signal (mainloop-notify.c:188)
   by 0x12E3FC: main (main.c:1210)
 Address 0x6534418 is 8 bytes inside a block of size 16 free'd

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agobtdev: Set Local RPA when own_addr_type is 0x03
Luiz Augusto von Dentz [Thu, 21 Oct 2021 21:35:21 +0000 (14:35 -0700)]
btdev: Set Local RPA when own_addr_type is 0x03

This enables the emulator to properly emulate the generation of a Local
RPA so it always set the random_addr when Create Connection sets 0x03 as
own_addr_type 0x03:

< HCI Command: LE Extended.. (0x08|0x0043) plen 26
        Filter policy: Accept list is not used (0x00)
        Own address type: Random (0x03)
        Peer address type: Public (0x00)
        Peer address: 00:AA:01:01:00:00 (Intel Corporation)
        Initiating PHYs: 0x01
        Entry 0: LE 1M
          Scan interval: 60.000 msec (0x0060)
          Scan window: 60.000 msec (0x0060)
          Min connection interval: 30.00 msec (0x0018)
          Max connection interval: 50.00 msec (0x0028)
          Connection latency: 0 (0x0000)
          Supervision timeout: 420 msec (0x002a)
          Min connection length: 0.000 msec (0x0000)
          Max connection length: 0.000 msec (0x0000)
> HCI Event: Command Status (0x0f) plen 4
      LE Extended Create Connection (0x08|0x0043) ncmd 1
        Status: Success (0x00)
> HCI Event: LE Meta Event (0x3e) plen 31
      LE Enhanced Connection Complete (0x0a)
        Status: Success (0x00)
        Handle: 42
        Role: Central (0x00)
        Peer address type: Public (0x00)
        Peer address: 00:AA:01:01:00:00 (Intel Corporation)
        Local resolvable private address: 60:0C:C5:B9:10:5D (Resolvable)
        Peer resolvable private address: 00:00:00:00:00:00 (Non-Resolvable)
        Connection interval: 50.00 msec (0x0028)
        Connection latency: 0 (0x0000)
        Supervision timeout: 420 msec (0x002a)
        Central clock accuracy: 0x00

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agomgmt-tester: Fix expected manufacturer
Luiz Augusto von Dentz [Thu, 21 Oct 2021 21:34:04 +0000 (14:34 -0700)]
mgmt-tester: Fix expected manufacturer

The emulator is now using Linux Foundation manufacturer ID.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agotools/hcitool: Fix the descriptions of leal* commands
Archie Pusaka [Fri, 24 Sep 2021 09:29:21 +0000 (17:29 +0800)]
tools/hcitool: Fix the descriptions of leal* commands

The descriptions of leal* commands are copied from lewl* commands.
However they should use "accept list" instead.

Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoemulator: Add initial support for MSFT vendor commands
Luiz Augusto von Dentz [Wed, 20 Oct 2021 18:41:46 +0000 (11:41 -0700)]
emulator: Add initial support for MSFT vendor commands

This adds the initial support for MSFT vendor commands and enable them
when in btvirt:

< HCI Command: Microsoft Ex.. (0x3f|0x001e) plen 1
      Read Supported Features (0x00)
> HCI Event: Command Complete (0x0e) plen 14
      Microsoft Extension (0x3f|0x001e) ncmd 1
      Read Supported Features (0x00)
        Status: Success (0x00)
        Features: 0x3f 0x00 0x00 0x00 0x00 0x00 0x00 0x00
          RSSI Monitoring feature for BR/EDR
          RSSI Monitoring feature for LE connections
          RSSI Monitoring of LE advertisements
          Advertising Monitoring of LE advertisements
          Verifying the validity of P-192 and P-256 keys
          Continuous Advertising Monitoring
        Event prefix length: 0
        Event prefix:
< HCI Command: Microsoft Ex.. (0x3f|0x001e) plen 2
      LE Set Advertisement Filter Enable (0x05)
        Enable: All filter conditions (0x01)
> HCI Event: Command Complete (0x0e) plen 5
      Microsoft Extension (0x3f|0x001e) ncmd 1
      LE Set Advertisement Filter Enable (0x05)
        Status: Success (0x00)

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agomonitor: Enable decoding of MSFT extension with emulator
Luiz Augusto von Dentz [Wed, 20 Oct 2021 21:29:08 +0000 (14:29 -0700)]
monitor: Enable decoding of MSFT extension with emulator

This enables decoding MSFT extension with emulator instances since it
shall be the only one using Linux Foundation as manufacturer.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agobtdev: Use Linux Foundation as manufacturer
Luiz Augusto von Dentz [Wed, 20 Oct 2021 21:27:01 +0000 (14:27 -0700)]
btdev: Use Linux Foundation as manufacturer

This makes the emulator use Linux Foundation manufacturer id which
shall be simpler to distinguish emulator instances since it is unlikely
there will be other vendors using it.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoemulator/vhci: Fix writing msft_opcode using binary format
Luiz Augusto von Dentz [Wed, 20 Oct 2021 18:39:27 +0000 (11:39 -0700)]
emulator/vhci: Fix writing msft_opcode using binary format

debugfs expects values in string format not binary format.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agomonitor/msft: Add feature bits definition
Luiz Augusto von Dentz [Tue, 19 Oct 2021 23:41:05 +0000 (16:41 -0700)]
monitor/msft: Add feature bits definition

This adds the feature bits definition used in
HCI_VS_MSFT_Read_Supported_Features.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>