platform/upstream/bluez.git
3 years agoprofile: Export Remote Audio Volume Control SDP value
Pali Rohár [Mon, 13 Apr 2020 16:25:12 +0000 (18:25 +0200)]
profile: Export Remote Audio Volume Control SDP value

Remote Audio Volume Control property in SDP record for HSP HS role
indicates if device supports volume control.

It is required for D-Bus agents which implements audio part of HSP
profile to know if remote device supports volume control or not.

With this change bluez exports status of this SDP property via firt bit
in Features entry in NewConnection() DBus callback method, like for HFP
profile.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agoprofile: Remove duplicate initialization of version and profile
Luiz Augusto von Dentz [Mon, 13 Apr 2020 23:43:42 +0000 (16:43 -0700)]
profile: Remove duplicate initialization of version and profile

These values are always set later by send_new_connection.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agoprofile: Fix not setting default features for HFP 1.7
Pali Rohár [Mon, 13 Apr 2020 16:25:11 +0000 (18:25 +0200)]
profile: Fix not setting default features for HFP 1.7

When HFP AG features are not set then according to HFP 1.7.2
specification it has value 0b001001.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agotest/example-advertisement: Fix advertising when discoverable
Szymon Janc [Thu, 9 Apr 2020 10:30:35 +0000 (12:30 +0200)]
test/example-advertisement: Fix advertising when discoverable

If adapter is discoverable (or LE-only) advertising was failing due
to too big adv data being set. Make sure there is enough space left
for flags if needed.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agomonitor: Add support for opening extra mgmt socket for events
Marcel Holtmann [Wed, 8 Apr 2020 08:08:24 +0000 (10:08 +0200)]
monitor: Add support for opening extra mgmt socket for events

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agoshared/att: Check the signature of att packets
Archie Pusaka [Tue, 7 Apr 2020 08:56:09 +0000 (16:56 +0800)]
shared/att: Check the signature of att packets

Tested to pass these BT certification test
SM/MAS/SIGN/BV-03-C
SM/MAS/SIGN/BI-01-C

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agounit/test-crypto: test for bt_crypto_verify_att_sign
Archie Pusaka [Tue, 7 Apr 2020 08:56:08 +0000 (16:56 +0800)]
unit/test-crypto: test for bt_crypto_verify_att_sign

Adding tests for verifying att signature

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agoshared/crypto: Add bt_crypto_verify_att_sign
Archie Pusaka [Tue, 7 Apr 2020 08:56:07 +0000 (16:56 +0800)]
shared/crypto: Add bt_crypto_verify_att_sign

This is used to verify the signature of incoming ATT packets.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agoclient: Make advertise instances default to discoverable
Luiz Augusto von Dentz [Tue, 7 Apr 2020 00:24:08 +0000 (17:24 -0700)]
client: Make advertise instances default to discoverable

The more common case is that advertisements are discoverable not the
other way around.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agogatt: Fix not sending any data when server supports AcquireWrite
Luiz Augusto von Dentz [Mon, 6 Apr 2020 21:19:03 +0000 (14:19 -0700)]
gatt: Fix not sending any data when server supports AcquireWrite

msg.msg_iovlen should be set to 1 to forward the data received over the
file descriptor.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agomonitor: Fix off-by-one error with IRKs and LTKs
Marcel Holtmann [Sun, 5 Apr 2020 18:51:36 +0000 (20:51 +0200)]
monitor: Fix off-by-one error with IRKs and LTKs

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agolib: Update company identifiers
Marcel Holtmann [Sun, 5 Apr 2020 07:58:31 +0000 (09:58 +0200)]
lib: Update company identifiers

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agodoc: Define bus controller value for VIRTIO transport
Marcel Holtmann [Sat, 4 Apr 2020 20:24:57 +0000 (22:24 +0200)]
doc: Define bus controller value for VIRTIO transport

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agotools/hciattach_ath3k: Load BT board data based on country code
Sonny Sasaka [Tue, 31 Mar 2020 00:33:55 +0000 (17:33 -0700)]
tools/hciattach_ath3k: Load BT board data based on country code

BT board data file PS_ASIC-<country-code>.pst is loaded based
on country code. If not exist, default BT board data file
PS_ASIC.pst would be loaded.

This patch doesn't define how to get the country code at the moment, but
future patches can supply the country code in the region parameter of
get_ps_file_name.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agolib: Add details for reading security information command
Marcel Holtmann [Thu, 2 Apr 2020 13:21:18 +0000 (15:21 +0200)]
lib: Add details for reading security information command

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agotools: Add command for reading the security information
Marcel Holtmann [Thu, 2 Apr 2020 13:20:53 +0000 (15:20 +0200)]
tools: Add command for reading the security information

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agodoc: Add Read Security Information command description
Marcel Holtmann [Thu, 2 Apr 2020 13:20:09 +0000 (15:20 +0200)]
doc: Add Read Security Information command description

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agotools: Fix command for reading extended controller information
Marcel Holtmann [Thu, 2 Apr 2020 11:45:41 +0000 (13:45 +0200)]
tools: Fix command for reading extended controller information

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agotools: Add command for toggling wideband speech feature
Marcel Holtmann [Thu, 2 Apr 2020 11:36:41 +0000 (13:36 +0200)]
tools: Add command for toggling wideband speech feature

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agolib: Add missing text for wideband speech command
Marcel Holtmann [Thu, 2 Apr 2020 11:36:00 +0000 (13:36 +0200)]
lib: Add missing text for wideband speech command

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agogatt: Fix Acquire* reply handling
Luiz Augusto von Dentz [Wed, 1 Apr 2020 23:27:33 +0000 (16:27 -0700)]
gatt: Fix Acquire* reply handling

Originally these operation did not set any owner_queue which caused
them to crash if the attribute is freed before the respose, to fix that
the reply will now check if owner_queue was reset to NULL which means
the attribute is no longer available but the owner_queue was never set
in the first place so this ensures they are now setup properly.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agomonitor: Fix missing setting string
Howard Chung [Tue, 31 Mar 2020 03:16:43 +0000 (11:16 +0800)]
monitor: Fix missing setting string

Add wideband speech to setting string

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agogatt: Check error before retrying if Acquire* failed
Luiz Augusto von Dentz [Tue, 31 Mar 2020 21:05:48 +0000 (14:05 -0700)]
gatt: Check error before retrying if Acquire* failed

If the method has timed out it probably means the application is not
responding so a follow up method call might have the same result, also
in case the application returns org.bluez.Error.Failed it indicates the
operation has been attempted but failed which again most likely will
have the same result if reattempted.

Change-Id: Ie768f1e3613957f362b65fba12a03d0ee21bce9c
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agogatt: Fix possible crashes when disconnecting
Luiz Augusto von Dentz [Tue, 31 Mar 2020 17:28:23 +0000 (10:28 -0700)]
gatt: Fix possible crashes when disconnecting

If there are pending AcquireWrite or AcquireNotify when disconnecting
the attribute object may be freed (e.g. device is temporary) leading to
the following backtrace:

bluetoothd[369928]: src/gatt-database.c:gatt_db_service_removed() Local GATT service removed
bluetoothd[369928]: src/adapter.c:adapter_service_remove() /org/bluez/hci1
bluetoothd[369928]: src/adapter.c:remove_uuid() sending remove uuid command for index 1
bluetoothd[369928]: src/sdpd-service.c:remove_record_from_server() Removing record with handle 0x1002e
bluetoothd[369928]: src/gatt-database.c:send_notification_to_device() GATT server sending indication
bluetoothd[369928]: src/device.c:gatt_debug() Write Complete: err -125
bluetoothd[369928]: src/gatt-database.c:client_disconnect_cb() Client disconnected
bluetoothd[369928]: src/advertising.c:client_disconnect_cb() Client disconnected
bluetoothd[369928]: Failed to acquire write: org.freedesktop.DBus.Error.NoReply

Program received signal SIGSEGV, Segmentation fault.
0x0000555555631450 in acquire_write_reply (message=0x55555583dec0, user_data=0x555555843e40) at src/gatt-database.c:2437
2437            send_write(op->device, op->attrib, chrc->proxy, NULL, op->id,

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agoshared/gatt: Fix NULL pointer dereference
Szymon Janc [Tue, 31 Mar 2020 10:45:32 +0000 (12:45 +0200)]
shared/gatt: Fix NULL pointer dereference

bluetoothd[363094]: src/device.c:device_connect_le() Connection attempt to: 00:AA:01:00:00:23

Program received signal SIGSEGV, Segmentation fault.
write_complete_cb (attr=0x55555580aa30, err=-110, user_data=0x55555585f7c0) at src/shared/gatt-server.c:793
793             util_debug(server->debug_callback, server->debug_data,
(gdb) bt
 #0  write_complete_cb (attr=0x55555580aa30, err=-110, user_data=0x55555585f7c0) at src/shared/gatt-server.c:793
 #1  0x00005555556a5852 in pending_write_result (p=0x555555866030, err=<optimized out>) at src/shared/gatt-db.c:162
 #2  0x00005555556a5ac7 in write_timeout (user_data=0x555555866030) at src/shared/gatt-db.c:1879
 #3  0x00005555556a9b15 in timeout_callback (user_data=user_data@entry=0x555555864b20) at src/shared/timeout-glib.c:34
 #4  0x00007ffff7e1f081 in g_timeout_dispatch (source=source@entry=0x555555864f00, callback=0x5555556a9b00 <timeout_callback>, user_data=0x555555864b20) at ../glib/gmain.c:4705
 #5  0x00007ffff7e1e570 in g_main_dispatch (context=0x5555557d9630) at ../glib/gmain.c:3216
 #6  g_main_context_dispatch (context=context@entry=0x5555557d9630) at ../glib/gmain.c:3881
 #7  0x00007ffff7e1e900 in g_main_context_iterate (context=0x5555557d9630, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/gmain.c:3954
 #8  0x00007ffff7e1ebf3 in g_main_loop_run (loop=0x5555557d75d0) at ../glib/gmain.c:4148
 #9  0x00005555556a9dbd in mainloop_run () at src/shared/mainloop-glib.c:79
 #10 0x00005555556aa36a in mainloop_run_with_signal (func=<optimized out>, user_data=0x0) at src/shared/mainloop-notify.c:201
 #11 0x00005555555bb9e3 in main (argc=<optimized out>, argv=<optimized out>) at src/main.c:770

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agomain: Fix GATT option parsing
Szymon Janc [Tue, 31 Mar 2020 12:07:25 +0000 (14:07 +0200)]
main: Fix GATT option parsing

Key name is Channels.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agocore/device: Handle Just-Works auto-accept
Sonny Sasaka [Sat, 28 Mar 2020 00:33:18 +0000 (17:33 -0700)]
core/device: Handle Just-Works auto-accept

The kernel starts to always request confirmation to BlueZ daemon for
Just-Works pairing. In this patch the daemon does auto-accept if the
client has clearly indicated a pairing intent by calling the Pair()
D-Bus API.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agogatt: Enable connecting to EATT channel using Ext-Flowctl mode
Luiz Augusto von Dentz [Mon, 16 Mar 2020 22:16:12 +0000 (15:16 -0700)]
gatt: Enable connecting to EATT channel using Ext-Flowctl mode

This makes use of BT_IO_MODE_EXT_FLOWCTL to connect to EATT channels.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agotools/l2cap-tester: Add test for Ext-Flowctl mode
Luiz Augusto von Dentz [Tue, 10 Mar 2020 20:44:27 +0000 (13:44 -0700)]
tools/l2cap-tester: Add test for Ext-Flowctl mode

This adds tests for Ext-Flowctl which uses ECRED PDUs.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agoemulator/bthost: Add support for ECRED Connection request/response
Luiz Augusto von Dentz [Tue, 10 Mar 2020 20:09:52 +0000 (13:09 -0700)]
emulator/bthost: Add support for ECRED Connection request/response

This adds support for ECRED Connection request/response which will be
used by l2cap-runner to test L2CAP_MODE_EXT_FLOWCTL mode.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agol2test: Add support for BT_MODE_EXT_FLOWCTL
Luiz Augusto von Dentz [Fri, 2 Aug 2019 07:44:43 +0000 (10:44 +0300)]
l2test: Add support for BT_MODE_EXT_FLOWCTL

This enables using l2test to connect or listen with
BT_MODE_EXT_FLOWCTL.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agobtio: Add mode to for Enhanced Credit Mode
Luiz Augusto von Dentz [Wed, 31 Jul 2019 10:56:24 +0000 (13:56 +0300)]
btio: Add mode to for Enhanced Credit Mode

This adds BT_IO_MODE_EXT_FLOWCTL which directly maps to
BT_MODE_EXT_FLOWCTL.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agolib: Add definitions for Enhanced Credits Based Mode
Luiz Augusto von Dentz [Mon, 29 Jul 2019 10:09:57 +0000 (13:09 +0300)]
lib: Add definitions for Enhanced Credits Based Mode

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agomonitor: Fix decoding of LE Setup ISO Data Path command
Luiz Augusto von Dentz [Mon, 30 Mar 2020 21:43:12 +0000 (14:43 -0700)]
monitor: Fix decoding of LE Setup ISO Data Path command

LE Setup ISO Data Path command contains not only the transport but also
the codec along with its configuration.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agolib: Add identifier for VIRTIO devices
Marcel Holtmann [Mon, 30 Mar 2020 18:32:53 +0000 (20:32 +0200)]
lib: Add identifier for VIRTIO devices

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agomonitor: Add support for Read Local Simple Pairing Options command
Marcel Holtmann [Mon, 30 Mar 2020 18:24:06 +0000 (20:24 +0200)]
monitor: Add support for Read Local Simple Pairing Options command

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agobtmgmt: Rename version command to revision
Luiz Augusto von Dentz [Mon, 30 Mar 2020 17:28:08 +0000 (10:28 -0700)]
btmgmt: Rename version command to revision

version is already handled by btshell and always refer to BlueZ version
rather than MGMT version, so this renames the command to revision to
avoid having the clash of command names.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agobtmgmt: Fix irks command parsing
Luiz Augusto von Dentz [Mon, 30 Mar 2020 17:23:16 +0000 (10:23 -0700)]
btmgmt: Fix irks command parsing

btshell does not allow use of nested parameter delimiters.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agomonitor: Adding missing settings descriptions in btmon
Alain Michaud [Fri, 27 Mar 2020 15:03:53 +0000 (15:03 +0000)]
monitor: Adding missing settings descriptions in btmon

This change adds the missing settings descriptions from btmon.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agoavdtp: fix delay report valid states
Archie Pusaka [Fri, 20 Mar 2020 05:14:25 +0000 (13:14 +0800)]
avdtp: fix delay report valid states

According to AVDTP specification section 6.19,
avdtp_delayreport_cmd could also be received when the state of SEP
is open.

Therefore, updating to accommodate such condition.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agotools/btmgmt: Fix missing setting string in btmgmt
Howard Chung [Thu, 26 Mar 2020 08:14:27 +0000 (16:14 +0800)]
tools/btmgmt: Fix missing setting string in btmgmt

Both PHY configuration and wide band speech are not set in
btmgmt.c.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agoautopair: Fix compiler warning
Sonny Sasaka [Tue, 24 Mar 2020 19:49:42 +0000 (12:49 -0700)]
autopair: Fix compiler warning

With clang, comparing an array with NULL generates a warning because the
value is always non-NULL. With maintainer mode enabled, this becomes a
compilation error.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agoavdtp: Fix crashes in avdtp_abort
Howard Chung [Tue, 24 Mar 2020 03:21:45 +0000 (11:21 +0800)]
avdtp: Fix crashes in avdtp_abort

In avdtp_abort, if setup->stream is NULL, trying to access
stream->lsep will crash.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agoinput: Add LEAutoSecurity setting to input.conf
Luiz Augusto von Dentz [Wed, 11 Mar 2020 18:43:21 +0000 (11:43 -0700)]
input: Add LEAutoSecurity setting to input.conf

LEAutoSecurity can be used to enable/disable automatic upgrades of
security for LE devices, by default it is enabled so existing devices
that did not require security and were not bonded will automatically
upgrade the security.

Note: Platforms disabling this setting would require users to manually
bond the device which may require changes to the user interface to
always force bonding for input devices as APIs such as Device.Connect
will no longer work which maybe perceived as a regression.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agoinput: hog: Attempt to set security level if not bonded
Luiz Augusto von Dentz [Tue, 10 Mar 2020 16:59:07 +0000 (09:59 -0700)]
input: hog: Attempt to set security level if not bonded

This attempts to set the security if the device is not bonded, the
kernel will block any communication on the ATT socket while bumping
the security and if that fails the device will be disconnected which
is better than having the device dangling around without being able to
communicate with it until it is properly bonded.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agoRelease 5.54
Marcel Holtmann [Sun, 15 Mar 2020 06:35:59 +0000 (07:35 +0100)]
Release 5.54

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agobuild: Update library version
Marcel Holtmann [Sun, 15 Mar 2020 06:26:51 +0000 (07:26 +0100)]
build: Update library version

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agolib: Add version number for Bluetooth 5.2
Marcel Holtmann [Sun, 15 Mar 2020 06:25:19 +0000 (07:25 +0100)]
lib: Add version number for Bluetooth 5.2

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agomonitor: Fix for incorrect len in L2CAP Enhanced Reconfigure
Łukasz Rymanowski [Thu, 12 Mar 2020 07:30:45 +0000 (08:30 +0100)]
monitor: Fix for incorrect len in L2CAP Enhanced Reconfigure

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agoa2dp: Fix race when connecting and being connected at the same time
Archie Pusaka [Thu, 12 Mar 2020 05:54:37 +0000 (13:54 +0800)]
a2dp: Fix race when connecting and being connected at the same time

There is a possibility where BlueZ initiate an A2DP connection just
around the same time as the peripheral also initiate it.

One scenario is the peripheral initiate the connection first, so
confirm_cb() on /profiles/audio/a2dp.c is called. However, while we
are waiting for the authentication step, BlueZ initiate a connection
to the peripheral, therefore a2dp_sink_connect() is called, which
from there a2dp_avdtp_get() is called.

If this happens: When calling confirm_cb(), chan for the
corresponding device is created.

Then when calling a2dp_avdtp_get(), chan will be found as it is
created in confirm_cb(), and the value of chan->io is not NULL.
However, a NULL is supplied instead to create a new session and
assigned to chan->session.

Then when calling connect_cb(), chan->session will NOT be NULL, as
it is assigned in a2dp_avdtp_get(). Nevertheless, chan->session is
always assigned a new value.

These cause failure in connection.

Therefore, fixing this by supplying the value of chan->io inside
a2dp_avdtp_get() (it's going to be NULL on the normal case so it is
fine), and check whether chan->session already assigned inside
connect_cb().

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agoHID accepts bonded device connections only.
Alain Michaud [Tue, 10 Mar 2020 02:35:18 +0000 (02:35 +0000)]
HID accepts bonded device connections only.

This change adds a configuration for platforms to choose a more secure
posture for the HID profile.  While some older mice are known to not
support pairing or encryption, some platform may choose a more secure
posture by requiring the device to be bonded  and require the
connection to be encrypted when bonding is required.

Reference:
https://www.intel.com/content/www/us/en/security-center/advisory/intel-sa-00352.html
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agoHOGP must only accept data from bonded devices.
Alain Michaud [Tue, 10 Mar 2020 02:35:16 +0000 (02:35 +0000)]
HOGP must only accept data from bonded devices.

HOGP 1.0 Section 6.1 establishes that the HOGP must require bonding.

Reference:
https://www.intel.com/content/www/us/en/security-center/advisory/intel-sa-00352.htm
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agodoc: Mention the Wideband Speech setting and add new kernel version
Marcel Holtmann [Sun, 8 Mar 2020 08:02:51 +0000 (09:02 +0100)]
doc: Mention the Wideband Speech setting and add new kernel version

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agolib: Adding definitions for Wide Band Speech configuration
Alain Michaud [Wed, 4 Mar 2020 20:31:52 +0000 (20:31 +0000)]
lib: Adding definitions for Wide Band Speech configuration

This change adds the corresponding user space definition for wide band
speech.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agodoc: Add settings and command for Wideband Speech support
Marcel Holtmann [Wed, 4 Mar 2020 07:37:43 +0000 (08:37 +0100)]
doc: Add settings and command for Wideband Speech support

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agodoc: Add another missing PHY Configuration value
Marcel Holtmann [Wed, 4 Mar 2020 07:35:14 +0000 (08:35 +0100)]
doc: Add another missing PHY Configuration value

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agomonitor: Add support for decoding EATT
Luiz Augusto von Dentz [Fri, 17 May 2019 11:13:23 +0000 (14:13 +0300)]
monitor: Add support for decoding EATT

This decodes packets received over EATT PSM.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agocore: Add support for setting the number of GATT bearers
Luiz Augusto von Dentz [Tue, 7 Jan 2020 19:47:49 +0000 (11:47 -0800)]
core: Add support for setting the number of GATT bearers

This adds option to set the numbers of GATT Channels/Bearers to be
connected in main.conf.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agogatt: Add support for Notify Multiple
Luiz Augusto von Dentz [Fri, 6 Sep 2019 11:09:37 +0000 (14:09 +0300)]
gatt: Add support for Notify Multiple

This adds support for Notify Multiple procedure marking its bit as
supported in the Client Features.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agoshared/gatt: Add support for Handle Value Multiple Notifications
Luiz Augusto von Dentz [Thu, 6 Jun 2019 06:22:56 +0000 (09:22 +0300)]
shared/gatt: Add support for Handle Value Multiple Notifications

Handle Value Multiple Notification can be used to notify multiple
values at once.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agoshared/gatt-client: Add support for Read Multiple Variable Length
Luiz Augusto von Dentz [Mon, 3 Jun 2019 13:21:19 +0000 (16:21 +0300)]
shared/gatt-client: Add support for Read Multiple Variable Length

The Read Multiple Variable Length Request is used to request that the
server read two or more values of a set of attributes that have a
variable or unknown value length and return their values in a
Read Multiple Variable Length Response.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agoshared/gatt-server: Add support for Read Multiple Variable Length
Luiz Augusto von Dentz [Mon, 3 Jun 2019 12:42:41 +0000 (15:42 +0300)]
shared/gatt-server: Add support for Read Multiple Variable Length

The Read Multiple Variable Length Request is used to request that the
server read two or more values of a set of attributes that have a
variable or unknown value length and return their values in a
Read Multiple Variable Length Response.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agogatt: Enable EATT bearer support
Luiz Augusto von Dentz [Thu, 26 Dec 2019 22:01:06 +0000 (14:01 -0800)]
gatt: Enable EATT bearer support

This adds support for EATT connections.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agoshared/gatt-client: Add support for EATT features
Luiz Augusto von Dentz [Fri, 10 May 2019 07:35:00 +0000 (10:35 +0300)]
shared/gatt-client: Add support for EATT features

This enables EATT in the Client Features if the EATT characteristic is
present in the database.

Change-Id: I174d644283b8026b2b82e2c1bd2d9aeb5f5bcdbe
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agoshare/att: Add EATT support
Luiz Augusto von Dentz [Thu, 9 May 2019 08:06:25 +0000 (11:06 +0300)]
share/att: Add EATT support

This adds EATT support to bt_att, EATT bearers are handled as
additional channels which auto allocated for queued requests.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agosrc/profile: Ensure class UUID matches before connecting profile
Archie Pusaka [Mon, 2 Mar 2020 04:07:31 +0000 (12:07 +0800)]
src/profile: Ensure class UUID matches before connecting profile

According to bluetooth spec Ver 5.1, Vol 3, Part B, 4.7.2, there
might be multiple service records returned in a SDP Service Search
Attribute Response. Also, according to 2.5.2, the service pattern
can match any UUID contained within the service record, it doesn't
have to match only some specific attributes of the record.

Therefore, before using the service record to connect to any
profile, first we must check that the service class ID of the
service record matches with whatever UUID specified in the service
pattern we are looking for.

This patch checks the service class ID of the records against the
requested UUID whenever bt_search_service() is called and filter
out the ones that don't match. For the alternative where filtering
is not applied, use the method bt_search().

Change-Id: Ia0489fd81e0c6e21d57fe907b36b696d826b18a4
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agodoc: Mention the mgmt API version 1.15 changes
Marcel Holtmann [Fri, 28 Feb 2020 08:18:58 +0000 (09:18 +0100)]
doc: Mention the mgmt API version 1.15 changes

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agodoc: Adding missing Phy Configuration bit description.
Alain Michaud [Thu, 27 Feb 2020 19:19:19 +0000 (19:19 +0000)]
doc: Adding missing Phy Configuration bit description.

This change simply adds the missing Phy Configuration settings bit
description to the Read Controller Information Command documentation.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agoclient: Add scan.pattern command
Luiz Augusto von Dentz [Thu, 20 Feb 2020 00:25:04 +0000 (16:25 -0800)]
client: Add scan.pattern command

This uses the new Pattern filter:

[bluetooth]# scan.pattern Living
[bluetooth]# scan on
SetDiscoveryFilter success
Discovery started
[CHG] Controller XX:XX:XX:XX:XX:XX Discovering: yes
[NEW] Device XX:XX:XX:XX:XX:XX Living Room TV

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agoadapter: Implement Pattern filter
Luiz Augusto von Dentz [Thu, 20 Feb 2020 00:19:29 +0000 (16:19 -0800)]
adapter: Implement Pattern filter

This implements the new Pattern filter as documented in the
adapter-api.txt.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agodoc/adapter-api: Add pattern filter
Luiz Augusto von Dentz [Wed, 19 Feb 2020 22:58:33 +0000 (14:58 -0800)]
doc/adapter-api: Add pattern filter

This adds a pattern filter which can be used to filter devices by
address or name prefix which is quite convenient on a crowded
environment.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agoavdtp: Enable MTU auto tunning
Luiz Augusto von Dentz [Wed, 19 Feb 2020 00:32:22 +0000 (16:32 -0800)]
avdtp: Enable MTU auto tunning

This uses BT_PHY to check if kernel is able to do MTU auto tunning
which is enabled by forcing the input MTU to 0.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agol2test: Add support to BT_PHY
Luiz Augusto von Dentz [Tue, 18 Feb 2020 21:35:57 +0000 (13:35 -0800)]
l2test: Add support to BT_PHY

This makes l2test attempt to read BT_PHY socket option and print out
the supported packet types/PHY:

l2test[7282]: Connected to XX:XX:XX:XX:XX:XX (bredr, psm 4113, dcid 64)
l2test[7282]: Local device XX:XX:XX:XX:XX:XX (bredr, psm 4113, scid 64)
l2test[7282]: Options [imtu 672, omtu 672, flush_to 65535, mode 0, handle 256, class 0x000000, priority 0, rcvbuf 212992]
l2test[7282]: Supported PHY: 0x000001ff
          BR1M1SLOT
          BR1M3SLOT
          BR1M5SLOT
          EDR2M1SLOT
          EDR2M3SLOT
          EDR2M5SLOT
          EDR3M1SLOT
          EDR3M3SLOT
          EDR3M5SLOT

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agobtio: Add BT_IO_PHY option
Luiz Augusto von Dentz [Tue, 18 Feb 2020 19:41:29 +0000 (11:41 -0800)]
btio: Add BT_IO_PHY option

This adds BT_IO_PHY option which can be used to read the underline
packet types/PHY in use by the link layer.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agolib: Add definition to BT_PHY
Luiz Augusto von Dentz [Tue, 18 Feb 2020 19:39:15 +0000 (11:39 -0800)]
lib: Add definition to BT_PHY

This adds the definition to BT_PHY socket options along with the
possible bitfields for the return value.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agocore: Add new policy for Just-Works repairing
howardchung@google.com [Sat, 15 Feb 2020 03:44:33 +0000 (11:44 +0800)]
core: Add new policy for Just-Works repairing

When kernel find out that the incoming Just-Works pairing is
initiated by a paired device, it is user space's responsibility to
decide the next action.

This patch includes the following:
- add JustWorksRepairing policy as an option in main.conf
- handle the confirmation request from kernel

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agoRelease 5.53
Marcel Holtmann [Sat, 15 Feb 2020 18:31:37 +0000 (19:31 +0100)]
Release 5.53

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agobuild: Update library version
Marcel Holtmann [Fri, 14 Feb 2020 22:27:03 +0000 (23:27 +0100)]
build: Update library version

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agobuild: Require at least version 0.28 when building with external ELL
Marcel Holtmann [Fri, 14 Feb 2020 22:24:03 +0000 (23:24 +0100)]
build: Require at least version 0.28 when building with external ELL

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agoobex: report notification status on incoming message
Matt Ranostay [Fri, 7 Feb 2020 05:08:56 +0000 (21:08 -0800)]
obex: report notification status on incoming message

To match doc/obex.txt on incoming message notification the respective
Status field should be set.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agolib: Add company id for The Linux Foundation
Marcel Holtmann [Tue, 11 Feb 2020 02:27:34 +0000 (03:27 +0100)]
lib: Add company id for The Linux Foundation

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agotools/btproxy: Add support for ISO packets
Luiz Augusto von Dentz [Wed, 9 Oct 2019 10:29:07 +0000 (13:29 +0300)]
tools/btproxy: Add support for ISO packets

This enables proxing ISO packets.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agoemulator: Add initial support for BT 5.2
Luiz Augusto von Dentz [Wed, 25 Sep 2019 09:56:00 +0000 (12:56 +0300)]
emulator: Add initial support for BT 5.2

This adds the initial command/event decoding for 5.2.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agomonitor: Add decoding for L2CAP Enhanced Credit Based PDUs
Luiz Augusto von Dentz [Wed, 31 Jul 2019 11:47:40 +0000 (14:47 +0300)]
monitor: Add decoding for L2CAP Enhanced Credit Based PDUs

Enhanced Credit Based Flow Control Mode is used for L2CAP
connection-oriented channels on LE and BR/EDR with flow control using
a credit-based scheme for L2CAP data.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agomonitor: Add support for ISO packets
Luiz Augusto von Dentz [Thu, 3 Oct 2019 13:36:22 +0000 (16:36 +0300)]
monitor: Add support for ISO packets

This enables decoding of ISO packets.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agomonitor: Add decoding of ISO related Link Layer PDUs
Luiz Augusto von Dentz [Fri, 12 Apr 2019 07:23:25 +0000 (10:23 +0300)]
monitor: Add decoding of ISO related Link Layer PDUs

This adds the decoding of ISO related Link Layer PDUs

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agomonitor: Add support for decoding ISO related commands
Luiz Augusto von Dentz [Fri, 12 Apr 2019 07:20:14 +0000 (10:20 +0300)]
monitor: Add support for decoding ISO related commands

This adds parsing of ISO related commands.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agomonitor: Add missing HCI command error code decoding
Szymon Janc [Tue, 28 Jan 2020 11:07:40 +0000 (12:07 +0100)]
monitor: Add missing HCI command error code decoding

Packet Too Long (0x45 ) status code was missing.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agoshared: shell: Only omit consecutive duplicate history lines.
Marijn Suijten [Sat, 18 Jan 2020 20:44:23 +0000 (21:44 +0100)]
shared: shell: Only omit consecutive duplicate history lines.

Change rl_handler to append duplicate history, as long as it isn't
identical to the last line. It prevents consecutive duplicates while
still having an accurate overview of the most recent commands used,
mimicking most modern shells.

This addresses my only major gripe with bluetoothctl: pressing UP does
not retrieve the last typed command when it is a duplicate of something
else written (much) earlier in the history. It is especially noticeable
when needing the same command repeatedly.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agolib: Adding missing op_code string conversion
Alain Michaud [Fri, 17 Jan 2020 04:24:21 +0000 (04:24 +0000)]
lib: Adding missing op_code string conversion

Adding the missing string conversion for MGMG_OP_SET_BLOCKED_KEYS.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agoadapter: Load keys that should be blocked by the kernel
Alain Michaud [Tue, 7 Jan 2020 01:28:22 +0000 (01:28 +0000)]
adapter: Load keys that should be blocked by the kernel

This change accomplishes 2 things:
 1. Drop device security data from previously paired devices
 using blocked keys.
 2. Send the list of known bad keys that should be blocked to the kernel
 if supported.

In particular keys from the Google Titan Security key are being
blocked.

For additional background information, please see
https://security.googleblog.com/2019/05/titan-keys-update.html

Change-Id: Ib854cbae108058f2ecb9822d46d621434a980f19
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agoshared/util: Adding a shared ARRAY_SIZE macro
Alain Michaud [Tue, 7 Jan 2020 01:28:20 +0000 (01:28 +0000)]
shared/util: Adding a shared ARRAY_SIZE macro

This will allow other implementations within src/ to use a single
definition of the ARRAY_SIZE macro.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agolib: MGMT_OP_SET_BLOCKED_KEYS Api definitions
Alain Michaud [Tue, 7 Jan 2020 01:28:18 +0000 (01:28 +0000)]
lib: MGMT_OP_SET_BLOCKED_KEYS Api definitions

Adding the required definitions for the MGMT_OP_SET_BLOCKED_KEYS Api.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agoavctp: Fix EINVAL on uinput creation
Haochen Tong [Sun, 12 Jan 2020 00:42:26 +0000 (01:42 +0100)]
avctp: Fix EINVAL on uinput creation

The struct uinput_dev variable is on stack, so clear its content to
avoid accidentally writing garbage values to kernel. This fixes "Can't
create uinput device: Invalid argument (22)" in some cases.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agoaudio/a2dp - fix crash during recovering process
howardchung [Fri, 10 Jan 2020 07:57:28 +0000 (15:57 +0800)]
audio/a2dp - fix crash during recovering process

The crash with stack trace:

(libc-2.27.so -raise.c:51 )       raise
(libc-2.27.so -abort.c:79 )       abort
(libc-2.27.so -libc_fatal.c:181 )         __libc_message
(libc-2.27.so -malloc.c:5350 )    malloc_printerr
(libc-2.27.so -malloc.c:4157 )    _int_free
(libglib-2.0.so.0.5200.3 -gslist.c:878 )        g_slist_free_full
(bluetoothd -a2dp.c:165 )        setup_unref
(bluetoothd -a2dp.c:2184 )       a2dp_cancel
(bluetoothd -sink.c:317 )        sink_unregister
(bluetoothd -service.c:176 )     service_remove
(bluetoothd -device.c:4678 )     device_remove
(bluetoothd -adapter.c:6573 )    adapter_remove
(bluetoothd -adapter.c:8832 )    index_removed
(bluetoothd -queue.c:220 )       queue_foreach
(bluetoothd -mgmt.c:304 )        can_read_data
(bluetoothd -io-glib.c:170 )     watch_callback
(libglib-2.0.so.0.5200.3 -gmain.c:3234 )        g_main_context_dispatch
(libglib-2.0.so.0.5200.3 -gmain.c:3972 )        g_main_context_iterate
(libglib-2.0.so.0.5200.3 -gmain.c:4168 )        g_main_loop_run
(bluetoothd -main.c:798 )        main
(libc-2.27.so -libc-start.c:308 )         __libc_start_main
(bluetoothd + 0x0000b089 )       _start
(bluetoothd + 0x0000b05f )       _init

triggered when 'usb disconnect' happened during AVDTP_SET_CONFIGURATION
request is sent but haven't received the response.
In this situation, the recovering process goes into sink.c:sink_free and
then a2dp.c:a2dp_cancel, avdtp.c:cancel_request, avdtp.c:connection_lost,
avdtp.c:release_stream.

During recovering, the reference count of setup and avdtp decrease more
than it increase, which ends up causing the crash.

The reference count of setup decreases one more time since
a2dp.c:setconf_cfm(called by cfm->set_configuration in
avdtp.c:cancel_request) was called in the 'error mode', which didn't
reference the setup, but in a2dp.c:abort_cfm(called by cfm->abort in
avdtp.c:release_stream), the reference count decreased by 1.

In this case, abort_cfm shouldn't be called as we already know
setconf_cfm didn't send any request. Setting avdtp_sep_state to
AVDTP_STATE_ABORTING should avoid this issue.

The reference count of avdtp decrease one more time since
both sink.c:sink_free and sink.c:sink_set_state(called from
avdtp.c:connection_lost -> avdtp.c:avdtp_set_state) unreference avdtp
for the session. The changes in sink.c should avoid the issue.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agoAUTHORS: mention Szymon's contributions
Szymon Janc [Thu, 9 Jan 2020 10:37:28 +0000 (11:37 +0100)]
AUTHORS: mention Szymon's contributions

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agomonitor: Decode LE CTE Request Failed event
Szymon Czapracki [Wed, 8 Jan 2020 11:47:52 +0000 (12:47 +0100)]
monitor: Decode LE CTE Request Failed event

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agomonitor: Decode LE Set Default Periodic Adv Sync Transfer Params. command
Szymon Czapracki [Wed, 8 Jan 2020 11:47:51 +0000 (12:47 +0100)]
monitor: Decode LE Set Default Periodic Adv Sync Transfer Params. command

< HCI Command: LE Set Default Periodic Advertisng Sync Transfer Parameters (0x08|0x005d) plen 6
        Mode: Enabled with report events disabled (0x01)
        Skip: 0x00
        Sync timeout: 0 msec (0x0000)
        Sync CTE type: 0x0000
> HCI Event: Command Status (0x0f) plen 4
      LE Set Default Periodic Advertisng Sync Transfer Parameters (0x08|0x005d) ncmd 1
        Status: Unknown HCI Command (0x01)

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agomonitor: Decode LE Set Periodic Adv Sync Transfer Parameterers command
Szymon Czapracki [Wed, 8 Jan 2020 11:47:50 +0000 (12:47 +0100)]
monitor: Decode LE Set Periodic Adv Sync Transfer Parameterers command

< HCI Command: LE Periodic Advertising Sync Transfer Parameters (0x08|0x005c) plen 8
        Connection handle: 1
        Mode: Disabled (0x00)
        Skip: 0x00
        Sync timeout: 0 msec (0x0000)
        Sync CTE type: 0x0000
> HCI Event: Command Status (0x0f) plen 4
      LE Periodic Advertising Sync Transfer Parameters (0x08|0x005c) ncmd 1
        Status: Unknown HCI Command (0x01)

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
3 years agomonitor: Decode LE Periodic Advertising Set Info Transfer command
Szymon Czapracki [Wed, 8 Jan 2020 11:47:49 +0000 (12:47 +0100)]
monitor: Decode LE Periodic Advertising Set Info Transfer command

< HCI Command: LE Periodic Advertising Set Info Transfer (0x08|0x005b) plen 5
       Connection handle: 1
       Service data: 0x0000
       Advertising handle: 0
> HCI Event: Command Status (0x0f) plen 4
     LE Periodic Advertising Set Info Transfer (0x08|0x005b) ncmd 1
       Status: Unknown HCI Command (0x01)

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