platform/upstream/bluez.git
2 years agosrc/adv_monitor: Remove checking in device lost timeout
Yun-Hao Chung [Mon, 28 Jun 2021 03:35:42 +0000 (11:35 +0800)]
src/adv_monitor: Remove checking in device lost timeout

The time check in device lost timeout could cause DeviceLost never being
reported because of the following reasons:

1. Timer created in timeout_add_seconds, which calls
   g_timeout_add_seconds_full internally, can be fired one second
   earlier than |timeout| seconds.
2. When handle_device_lost_timeout is invoked early, time diff between
   |curr_time| and |last_seen| could be less than |low_rssi_timeout|. In
   this case, since handle_device_lost always returns FALSE, the
   timer will be removed, but DeviceLost has not been reported yet.
3. If we never receives any advertisement from that peer since then,
   DeviceLost will never be reported.

We can remove the checking in handle_device_lost_time because we restart
or remove the timer whenever an advertisement is received.

Reviewed-by: apusaka@chromium.org
Reviewed-by: mcchou@chromium.org
Reviewed-by: mmandlik@chromium.org
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoRelease 5.60
Marcel Holtmann [Wed, 7 Jul 2021 13:42:45 +0000 (15:42 +0200)]
Release 5.60

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoprofile: Fail RegisterProfile if UUID already exists
João Paulo Rechi Vita [Fri, 11 Jun 2021 02:06:49 +0000 (19:06 -0700)]
profile: Fail RegisterProfile if UUID already exists

If a process tries to register a profile implementation that is already
registered, RegisterProfile should fail.

This should help address issues when two instances of PulseAudio are
running at the same time, and the second instance tries to register an
audio profile implementation that has already been registered by the
first instance. Two situations where this may happen is when more than
one user is logged in, or during the transition between the GDM session
and the user session, when PulseAudio gets started on the new session
before the old session has been fully terminated.

https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/303
https://gitlab.gnome.org/GNOME/gdm/-/issues/486
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoemulator/btdev: clean up the queue before closing the test
Tedd Ho-Jeong An [Sat, 26 Jun 2021 06:30:09 +0000 (23:30 -0700)]
emulator/btdev: clean up the queue before closing the test

This patch clean up the queue for connection before closing the test to
prevent the potential memory leak.

==50== 32 bytes in 1 blocks are definitely lost in loss record 18 of 32
==50==    at 0x483A809: malloc (vg_replace_malloc.c:307)
==50==    by 0x14A37E: btd_malloc (util.c:33)
==50==    by 0x149D9D: queue_new (queue.c:47)
==50==    by 0x13B3C0: btdev_create (btdev.c:6042)
==50==    by 0x13178E: create_vhci (hciemu.c:229)
==50==    by 0x13178E: hciemu_new_num (hciemu.c:403)
==50==    by 0x130E2C: read_index_list_callback (mgmt-tester.c:357)
==50==    by 0x14AD91: request_complete (mgmt.c:264)
==50==    by 0x14BD34: can_read_data (mgmt.c:356)
==50==    by 0x14E794: watch_callback (io-glib.c:157)
==50==    by 0x48B578E: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.6400.6)
==50==    by 0x48B5B17: ??? (in /usr/lib64/libglib-2.0.so.0.6400.6)
==50==    by 0x48B5E32: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.6400.6)
==50==
==50== 32 bytes in 1 blocks are definitely lost in loss record 19 of 32
==50==    at 0x483A809: malloc (vg_replace_malloc.c:307)
==50==    by 0x14A37E: btd_malloc (util.c:33)
==50==    by 0x149D9D: queue_new (queue.c:47)
==50==    by 0x13B3C0: btdev_create (btdev.c:6042)
==50==    by 0x1318F7: hciemu_client_new (hciemu.c:332)
==50==    by 0x1318F7: hciemu_new_num (hciemu.c:412)
==50==    by 0x130E2C: read_index_list_callback (mgmt-tester.c:357)
==50==    by 0x14AD91: request_complete (mgmt.c:264)
==50==    by 0x14BD34: can_read_data (mgmt.c:356)
==50==    by 0x14E794: watch_callback (io-glib.c:157)
==50==    by 0x48B578E: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.6400.6)
==50==    by 0x48B5B17: ??? (in /usr/lib64/libglib-2.0.so.0.6400.6)
==50==    by 0x48B5E32: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.6400.6)

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agotest-runner: Use src/main.conf if available
Luiz Augusto von Dentz [Mon, 28 Jun 2021 20:43:03 +0000 (13:43 -0700)]
test-runner: Use src/main.conf if available

This makes use of src/main.conf as configuration file that way custom
options can be applied while running the daemon.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoshared/gatt-client: Fix GATT client attribute read with offset
Howard Chung [Mon, 28 Dec 2020 06:22:36 +0000 (14:22 +0800)]
shared/gatt-client: Fix GATT client attribute read with offset

bluez always replies the whole value despite a user specify the offset.
This patch fixes the issue.

Reviewed-by: sonnysasaka@chromium.org
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoadapter: Fix toggling of experimental features
Luiz Augusto von Dentz [Thu, 24 Jun 2021 22:01:50 +0000 (15:01 -0700)]
adapter: Fix toggling of experimental features

When toggling experimental features it may cause the old value to still
be in effect since it was read after read info which upon completion
would attempt to call adapter_register without first updating the
experimental features which could affect the likes of advertising
instances when LL Privacy is enabled.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agodoc/advmon-api: Clarify Patterns property
David Lechner [Thu, 24 Jun 2021 17:44:01 +0000 (12:44 -0500)]
doc/advmon-api: Clarify Patterns property

The Patterns property description was not as clear as it could be. This
expands the text a bit, replaces the C enum value 0x01 with the D-Bus
property string value "or_patterns" and improves the grammar in a few
places.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoadv_monitor: Avoid skipping non-discoverable dev on Monitor match
Manish Mandlik [Fri, 18 Jun 2021 04:58:06 +0000 (21:58 -0700)]
adv_monitor: Avoid skipping non-discoverable dev on Monitor match

Do no skip a non-discoverable device if it matches any Advertisement
Monitor.

Reviewed-by: mcchou@google.com
Reviewed-by: alainmichaud@google.com
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agomedia: Fix UnregisterApplication
Luiz Augusto von Dentz [Wed, 23 Jun 2021 22:42:39 +0000 (15:42 -0700)]
media: Fix UnregisterApplication

UnregisterApplication is not doing anything since the apps queue is
never initialized which results in not finding any application when
unregistering.

Fixes: https://github.com/bluez/bluez/issues/126
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agorfkill: Fix reading from rfkill socket
Benjamin Berg [Mon, 3 May 2021 13:12:10 +0000 (15:12 +0200)]
rfkill: Fix reading from rfkill socket

The kernel will always send exactly one event, but the size of the
passed struct will depend on the length of the submitted read() and the
kernel version. i.e. the interface can be extended and we need to expect
for a read to be longer than expected if we ask for it.

Fix this by only requesting the needed length and explicitly check the
length against the V1 version of the structure to make the code a bit
more future proof in case the internal copy of the struct is updated to
contain new fields.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agotools/mgmt-tester: Update to support multiple extended adv instances
Tedd Ho-Jeong An [Wed, 23 Jun 2021 04:49:44 +0000 (21:49 -0700)]
tools/mgmt-tester: Update to support multiple extended adv instances

This patch updates to align with the multiple extended advertising
support.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoemulator/bthost: Create ext adv params before setting adv data
Tedd Ho-Jeong An [Wed, 23 Jun 2021 04:49:43 +0000 (21:49 -0700)]
emulator/bthost: Create ext adv params before setting adv data

Based on the SPEC 5.2 Vol 4, Part E, Section 7.8.54, the
LE_Set_Extended_Advertising_Data_Command may be issued after an
advertising set identifed by the Advertising_Handle has been created
using the HCI_LE_Set_Extended_Advertising_Parameters command.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoemulator/btdev: Add support HCI LE Adv Set Terminated event
Luiz Augusto von Dentz [Wed, 23 Jun 2021 04:49:42 +0000 (21:49 -0700)]
emulator/btdev: Add support HCI LE Adv Set Terminated event

This patch adds support the HCI_LE_Advertising_Set_Terminated event in
btdev.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoemulator/btdev: Add support multiple instance of extended advertising
Tedd Ho-Jeong An [Wed, 23 Jun 2021 04:49:41 +0000 (21:49 -0700)]
emulator/btdev: Add support multiple instance of extended advertising

This patch adds support multiple instance of extended advertising.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agotools/mgmt-tester: Enable High-Speed(HS) test cases
Tedd Ho-Jeong An [Wed, 23 Jun 2021 04:49:40 +0000 (21:49 -0700)]
tools/mgmt-tester: Enable High-Speed(HS) test cases

This patch enables the BT High-Speed(HS) test cases by enabling the HS
in the kernel config.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agodevice: Fix enabling temporary timer when TemporaryTimeout=0
Luiz Augusto von Dentz [Fri, 18 Jun 2021 17:09:14 +0000 (10:09 -0700)]
device: Fix enabling temporary timer when TemporaryTimeout=0

When TemporaryTimeout is set to 0 it is supposed to disable the
temporary timeout so devices never desappear.

Fixes: https://github.com/bluez/bluez/issues/146
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoavdtp: Fix parsing capabilities
Archie Pusaka [Thu, 17 Jun 2021 00:53:34 +0000 (08:53 +0800)]
avdtp: Fix parsing capabilities

This patch fixes size comparison and variable misassignment.

Reviewed-by: Alain Michaud <alainm@chromium.org>
Reviewed-by: Michael Sun <michaelfsun@google.com>
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agomonitor: Adding missing device found flag in the parser
Alain Michaud [Wed, 16 Jun 2021 12:42:29 +0000 (12:42 +0000)]
monitor: Adding missing device found flag in the parser

A new flag was added to the kernel implementation of the Device Found
event, but had not been added to the parser leading to an "Unknown device
flag" error in btmon.

Reviewed-by: Yu Liu <yudiliu@google.com>
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agogatt-client: Check length of notify multiple op
Sebastian Urban [Fri, 11 Jun 2021 12:30:21 +0000 (14:30 +0200)]
gatt-client: Check length of notify multiple op

Check that specfied length of value in received data does not exceed
length of PDU. Otherwise data may be read from beyond the end of the
buffer.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agomgmt-tester: Fix typo
Luiz Augusto von Dentz [Wed, 16 Jun 2021 15:18:40 +0000 (08:18 -0700)]
mgmt-tester: Fix typo

This fixes debup typo.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agomonitor: Fix typos
Luiz Augusto von Dentz [Tue, 15 Jun 2021 22:30:15 +0000 (15:30 -0700)]
monitor: Fix typos

This fixes interval typos.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agodoc: Add initial draft of security bugs handling document
Marcel Holtmann [Tue, 15 Jun 2021 20:12:16 +0000 (22:12 +0200)]
doc: Add initial draft of security bugs handling document

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agogatt-database: No multiple calls to AcquireWrite
Sebastian Urban [Sat, 12 Jun 2021 09:56:01 +0000 (11:56 +0200)]
gatt-database: No multiple calls to AcquireWrite

This checks if an outstanding call to AcquireWrite is already in
progress. If so, the write request is placed into the queue, but
AcquireWrite is not called again. When a response to AcquireWrite is
received, acquire_write_reply sends all queued writes over the acquired
socket.

Making multiple simultaneous calls to AcquireWrite makes no sense,
as this would open multiple socket pairs and only the last returned
socket would be used for further writes.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agogatt-server: Flush notify multiple buffer when full and fix overflow
Sebastian Urban [Sun, 13 Jun 2021 10:39:18 +0000 (12:39 +0200)]
gatt-server: Flush notify multiple buffer when full and fix overflow

This fixes the calculation of available buffer space in
bt_gatt_server_send_notification and sends pending notifications
immediately when there is no more room to add a notification.

Previously there was a buffer overflow caused by incorrect calculation
of available buffer space: data->offset can equal data->len
from a previous call to this function, leading
(data->len - data->offset) to underflow after data->offset += 2.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agomgmt-tester: Enable Kernel Debug Experimental Feature
Luiz Augusto von Dentz [Mon, 14 Jun 2021 17:24:01 +0000 (10:24 -0700)]
mgmt-tester: Enable Kernel Debug Experimental Feature

This attempts to enable Kernel Debug Experimental Feature if debug is
enabled.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoRelease 5.59
Marcel Holtmann [Sun, 13 Jun 2021 19:55:15 +0000 (21:55 +0200)]
Release 5.59

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoRevert "doc/mgmt-api - Add a new error code for HCI status 0x3e"
Marcel Holtmann [Sun, 13 Jun 2021 19:53:35 +0000 (21:53 +0200)]
Revert "doc/mgmt-api - Add a new error code for HCI status 0x3e"

This reverts commit 9ad67264d97b882fa58391982ecb5b003368fef0.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agomgmt-tester: Fix adding padding for Ext Adv (Scan Response) Data
Luiz Augusto von Dentz [Wed, 9 Jun 2021 21:22:42 +0000 (14:22 -0700)]
mgmt-tester: Fix adding padding for Ext Adv (Scan Response) Data

These commands are actually of variable size so they don't expect
padding like in the non-extended version.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agobtdev: Check advertising/scanning states when changing Resolving List
Luiz Augusto von Dentz [Mon, 7 Jun 2021 17:43:59 +0000 (10:43 -0700)]
btdev: Check advertising/scanning states when changing Resolving List

Resolving List cannot be changed when advertising/scanning:

• Advertising (other than periodic advertising) is enabled,
• Scanning is enabled, or
• an HCI_LE_Create_Connection, HCI_LE_Extended_Create_Connection, or
HCI_LE_Periodic_Advertising_Create_Sync command is outstanding.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agobtdev: Check advertising/scanning states when changing White List
Luiz Augusto von Dentz [Mon, 7 Jun 2021 17:34:29 +0000 (10:34 -0700)]
btdev: Check advertising/scanning states when changing White List

White List cannot be changed when advertising/scanning:

• any advertising filter policy uses the White List and advertising is
enabled,
• the scanning filter policy uses the White List and scanning is
enabled, or
• the initiator filter policy uses the White List and an
HCI_LE_Create_Connection or HCI_LE_Extended_Create_Connection
command is outstanding.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agobtdev: Remove debugs
Luiz Augusto von Dentz [Fri, 4 Jun 2021 23:26:28 +0000 (16:26 -0700)]
btdev: Remove debugs

Remove left-over util_debugs.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agotools/mgmt-tester: Fix expected HCI command accounting
Inga Stotland [Fri, 4 Jun 2021 17:59:13 +0000 (10:59 -0700)]
tools/mgmt-tester: Fix expected HCI command accounting

This fixes test condition count in the expected HCI command
callback.

When the expected HCI opcode is detected, mark the condition
as done. Any subsequent HCI commands are ignored.

Without this fix, in couple of test cases where the expected HCI
command is detected more than once, the test may be erroneously
reported as a failure or prematurely declared as a success before
waiting on an expected MGMT event condition.

The test cases where this behavior is fixed:
Remove Ext Advertising - Success 1
Remove Ext Advertising - Success 2
Reviewed-by: Tedd Ho-Jeong An <tedd.an@intel.com>
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoshared/mgmt: Fix not processing request queue
Luiz Augusto von Dentz [Fri, 4 Jun 2021 21:28:38 +0000 (14:28 -0700)]
shared/mgmt: Fix not processing request queue

If the kernel returns an invalid opcode like below the request won't
be processed making it unusable:

@ MGMT Command: Read Advertising Features (0x003d) plen 0
{0x0001} [hci0] 14:25:11.096370
@ MGMT Event: Command Status (0x0002) plen 3
{0x0001} [hci0] 14:25:11.096373
      Set Advertising (0x0029)
              Status: Not Supported (0x0c)

In order to fix this attempts to remove the first request pending on the
given index:

= bluetoothd: src/advertising.c:read_adv_features_callback() Failed to
read advertising features: Not Supported (0x0c)

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agobtdev: Fix handling of white/resolving list
Luiz Augusto von Dentz [Fri, 4 Jun 2021 19:16:23 +0000 (12:16 -0700)]
btdev: Fix handling of white/resolving list

le_cig.cis entries was not properly checked which could lead to
overwriting le_wl/le_rl field.

While at it this also makes changes so have proper struct/fields for
le_wl and le_rl so they easier to manage.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agobtdev: Fix crash when generating disconnected event for BIS
Luiz Augusto von Dentz [Fri, 4 Jun 2021 00:07:26 +0000 (17:07 -0700)]
btdev: Fix crash when generating disconnected event for BIS

When generating disconnected event for a BIS it would not have any
link as the ISO is in fact we are broadcasting and don't have an ACL.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agotools/mgmt-tester: Add setup condition to resolve list
Inga Stotland [Thu, 3 Jun 2021 00:04:16 +0000 (17:04 -0700)]
tools/mgmt-tester: Add setup condition to resolve list

This adds expected setup HCI command condition to
"Start Discovery - Disable Resolve List" case.

Check that on setup HCI command Set LE Resolve Enable is complete
with "enable" parameter set to 1.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agotools/mgmt-tester: Adjust test setup complete check
Inga Stotland [Thu, 3 Jun 2021 00:04:15 +0000 (17:04 -0700)]
tools/mgmt-tester: Adjust test setup complete check

This changes check for setup complete in client_cmd_complete() callback
from tester_setup_complete() to test_setup_condition_complete(). This
allows for combining setup conditions when setup_bthost() is called.
Reviewed-by: Tedd Ho-Jeong An <tedd.an@intel.com>
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agotools/mgmt-tester: Add tests for whitelist and resolving list
Tedd Ho-Jeong An [Tue, 1 Jun 2021 20:49:18 +0000 (13:49 -0700)]
tools/mgmt-tester: Add tests for whitelist and resolving list

This patch adds test cases for checking the whitelist and resolving list
HCI commands when the LL Privacy feature is enabled.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agotools/mgmt-tester: Add tests for experimental feature command
Tedd Ho-Jeong An [Tue, 1 Jun 2021 20:49:17 +0000 (13:49 -0700)]
tools/mgmt-tester: Add tests for experimental feature command

This patch adds test cases for Read/Set Experimenal Feature commands.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoemulator/btdev: Enable LE Privacy feature
Tedd Ho-Jeong An [Tue, 1 Jun 2021 20:49:16 +0000 (13:49 -0700)]
emulator/btdev: Enable LE Privacy feature

This patch enables LE Privacy to support LL Privacy feature.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agotools/mgmt-tester: Add test cases for get/set device flags
Tedd Ho-Jeong An [Wed, 26 May 2021 05:13:10 +0000 (22:13 -0700)]
tools/mgmt-tester: Add test cases for get/set device flags

This patch adds test cases for get/set device flags commands.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agotools/mgmt-tester: Print hexdump if mgmt event parameters not match
Tedd Ho-Jeong An [Wed, 26 May 2021 05:13:09 +0000 (22:13 -0700)]
tools/mgmt-tester: Print hexdump if mgmt event parameters not match

This patch displays the hexdump of expected and received mgmt event
parameters.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agolib: Align mgmt header with document
Tedd Ho-Jeong An [Wed, 26 May 2021 05:13:08 +0000 (22:13 -0700)]
lib: Align mgmt header with document

This patch updates the mgmt header to align with the mgmt api document
(doc/mgmt-api.txt)

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agotools/btmgmt: Add device flags commands
Tedd Ho-Jeong An [Wed, 26 May 2021 05:13:07 +0000 (22:13 -0700)]
tools/btmgmt: Add device flags commands

This patch adds commands for get/set device flags mgmt ops.

Usage:

get-flags [-t type] <address>
        -t type    Address Type
                      0 BR/EDR
                      1 LE Public
                      2 LE Random

set-flags [-f flags] [-t type] <address>
        -t type    Address Type
                      0 BR/EDR
                      1 LE Public
                      2 LE Random
        -f flags   Device flag.
                      1 Remote Wake Enable

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agomgmt: Add missing opcodes to mgmt_op
Luiz Augusto von Dentz [Mon, 24 May 2021 23:00:08 +0000 (16:00 -0700)]
mgmt: Add missing opcodes to mgmt_op

This adds the missing opcodes to mgmt_op so they are properly decoded.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agolib/uuid: Fix string to uuid32 conversion
Archie Pusaka [Wed, 19 May 2021 08:21:14 +0000 (16:21 +0800)]
lib/uuid: Fix string to uuid32 conversion

Use strtoul to prevent 32 bit overflow

Reviewed-by: Yun-Hao Chung <howardchung@chromium.org>
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agocore: Add RSSI sampling period in system parameter
Yun-Hao Chung [Mon, 24 May 2021 02:43:37 +0000 (10:43 +0800)]
core: Add RSSI sampling period in system parameter

Add an option in main.conf to configure the default RSSI sampling
period for advertisement monitor.

Reviewed-by: apusaka@chromium.org
Reviewed-by: mmandlik@chromium.org
Reviewed-by: mcchou@chromium.org
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agotools/mgmt-tester: Fix "Remove Ext Advertising" case
Inga Stotland [Wed, 19 May 2021 21:19:07 +0000 (14:19 -0700)]
tools/mgmt-tester: Fix "Remove Ext Advertising" case

This fixes the expected behavior of the following test case:
"Remove Ext Advertising - Success 1", when the fail status
was erroneously overwritten with success:

<log snip>
  New Advertising Removed event received
  Test condition complete, 2 left
  HCI Command 0x2039 length 6
  Invalid parameter size for HCI command
Remove Ext Advertising - Success 1 - test failed
  HCI Command 0x203c length 1
  HCI Command 0x2039 length 2
  Test condition complete, 1 left
  Remove Advertising (0x003f): Success (0x00)
  Test condition complete, 0 left
Remove Ext Advertising - Success 1 - test passed

The expected HCI command to disable extended advertisement for a
non-zero number of sets should contain the specified number the
advertising sets.
In this particular test case, number of sets is set to 1 and,
as a result, the expected HCI command should be:
"00      | 01             | 01 00 00 00"
 disable | number of sets | set info

Also, to avoid false positives/negatives, skip exmination of HCI
commands after the test conditions are met.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoavrcp: Fix unregister AVRCP player
Huang-Huang Bao [Thu, 20 May 2021 09:22:00 +0000 (17:22 +0800)]
avrcp: Fix unregister AVRCP player

'notify_addressed_player_changed()' expected to be called with
'player->changed_id' set to a non-zero value.

    player->changed_id = g_idle_add(notify_addressed_player_changed,
                                    player);

And 'avrcp_player_event()' relies on 'player->changed_id' to perform
Addressed Player Changed notification. However,
'avrcp_unregister_player()' calls 'notify_addressed_player_changed()'
without adding it to the main loop and set 'player->changed_id'. To
indicate addreddsed player changed for both scenarios, we set
'player->changed_id' to 1 at the head of
'notify_addressed_player_changed()'.

Fixes https://github.com/bluez/bluez/issues/142

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agosrc/main: Fix double free str
Tedd Ho-Jeong An [Fri, 21 May 2021 17:04:07 +0000 (10:04 -0700)]
src/main: Fix double free str

This patch fixes the double free the string.
The string variable is always freed within its if statement so no need
to free it again in the end.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agotools/mgmt-tester: Add test cases for remove uuid command
Tedd Ho-Jeong An [Fri, 21 May 2021 06:24:41 +0000 (23:24 -0700)]
tools/mgmt-tester: Add test cases for remove uuid command

This patch adds test cases for the Remove UUID command.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agotools/mgmt-tester: Add test cases for set device id command
Tedd Ho-Jeong An [Fri, 21 May 2021 06:24:40 +0000 (23:24 -0700)]
tools/mgmt-tester: Add test cases for set device id command

This patch adds test cases for the Set Device ID command.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agomonitor: Decode MSFT LE Monitor Advertisement
Marcel Holtmann [Wed, 19 May 2021 22:40:53 +0000 (00:40 +0200)]
monitor: Decode MSFT LE Monitor Advertisement

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agomesh: Fix race condition memory leak
Brian Gix [Wed, 19 May 2021 19:00:45 +0000 (12:00 -0700)]
mesh: Fix race condition memory leak

This is a minor fix of a memory leak triggered on process exit if
proceess has been killed right after requesting an outbound
advertisement be sent.  It is harmless, but will cause an occasional
static analysis failure.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agomesh: Add single threading to prov-acp ob messaging
Brian Gix [Wed, 19 May 2021 18:15:36 +0000 (11:15 -0700)]
mesh: Add single threading to prov-acp ob messaging

Certain IOP and stress testing scenarios can cause additional outbound
messages to be attempted before the prior outbound message completes.
This patch adds queuing if outbpund messages are attempted too quickly
so that the additional message is not sent until the prior message is
ACKed.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agotest/mesh: Add support for testing more OOB auth
Brian Gix [Wed, 19 May 2021 00:03:42 +0000 (17:03 -0700)]
test/mesh: Add support for testing more OOB auth

To pass IOP testing, we need to be able to support Input OOB and Out of
band Public Key exchange,  This patch adds agent methods to support
those capabilities, but are turned off because the test code uses
insecure fixed values instead of randomized values.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agotools/mesh: Add all supported OOB methods to cfgclient
Brian Gix [Tue, 18 May 2021 23:35:32 +0000 (16:35 -0700)]
tools/mesh: Add all supported OOB methods to cfgclient

To support the widest range of mesh devices, we need to support any
possible capability combinations that a remote device may request.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agomesh: Normalize endian of public/private ECC keys
Brian Gix [Tue, 18 May 2021 23:23:39 +0000 (16:23 -0700)]
mesh: Normalize endian of public/private ECC keys

The Mesh profile specification defines a Mesh byte order of Big Endian
for Public keys used to calculate shared secrets. Further the
specification sample data also show this same byte order for Private
keys.  However, our internal ECDH shared secret calculation requires
Little Endian byte ordering. This fixes our DBus interface, and
debugging output to use Mesh Byte Ordering (Big Endian) for all human
readable input/output.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agomesh: Fix delivery of PB-ACK to acceptors
Brian Gix [Tue, 18 May 2021 23:08:14 +0000 (16:08 -0700)]
mesh: Fix delivery of PB-ACK to acceptors

Remove unneeded initialization that prevented the Acceptor roll of ever
recognizing a valid PB-ACK.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agomesh: Add manpage for bluetooth-meshd daemon
Inga Stotland [Mon, 17 May 2021 05:23:57 +0000 (22:23 -0700)]
mesh: Add manpage for bluetooth-meshd daemon

This adds manpage with a brief description of BLuettoth Mesh daemon
command line options.

Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agocore: Fix loading AVDTP options
Yun-Hao Chung [Fri, 7 May 2021 04:32:57 +0000 (12:32 +0800)]
core: Fix loading AVDTP options

Fix misassigned AVDTP StreamMode option, which causes StreamMode not
being set.
Fix AVDTP SessionMode option not freed.

Reviewed-by: mmandlik@chromium.org
Reviewed-by: apusaka@chromium.org
Reviewed-by: Tedd Ho-Jeong An <tedd.an@intel.com>
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoFix memory leaks in obex
Steve Grubb [Sat, 15 May 2021 13:43:07 +0000 (09:43 -0400)]
Fix memory leaks in obex

This patch fixes a couple memory leaks.

In filesystem, g_file_get_contents allocates fresh memory to buf.
It needs to be freed after conversion to a GString object.

Destination was missed on an error path as is mld.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agocore: Enable experimental MGMT when experimental is set
Luiz Augusto von Dentz [Tue, 18 May 2021 21:13:30 +0000 (14:13 -0700)]
core: Enable experimental MGMT when experimental is set

This enables experimental MGMT features when experimental has been set.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agobtmon: Use bt_uuid128_to_str when printing UUIDs of 128 bits
Luiz Augusto von Dentz [Tue, 18 May 2021 18:36:20 +0000 (11:36 -0700)]
btmon: Use bt_uuid128_to_str when printing UUIDs of 128 bits

This ensures that know UUIDs names are printed including those used by
experimental features.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoshared/util: Decode BlueZ experimental UUIDs
Luiz Augusto von Dentz [Tue, 18 May 2021 18:17:07 +0000 (11:17 -0700)]
shared/util: Decode BlueZ experimental UUIDs

This adds BlueZ experimental UUIDs to uuid128_table so they are
decoded by the likes of btmon.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoshared/util: Add bt_uuid128_to_str
Luiz Augusto von Dentz [Tue, 18 May 2021 18:04:25 +0000 (11:04 -0700)]
shared/util: Add bt_uuid128_to_str

This adds bt_uuid128_to_str which can be used to convert UUID 128 bit
binary format into string.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agobtdev: Add resolving list support
Luiz Augusto von Dentz [Mon, 17 May 2021 21:21:33 +0000 (14:21 -0700)]
btdev: Add resolving list support

This adds support for commands related to resolving list.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agobtdev: Add support for Add/Remove White List
Luiz Augusto von Dentz [Mon, 17 May 2021 17:36:51 +0000 (10:36 -0700)]
btdev: Add support for Add/Remove White List

This adds support for Add to/Remove from White List.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoclient: Fix advertise broadcast
Luiz Augusto von Dentz [Fri, 14 May 2021 22:10:26 +0000 (15:10 -0700)]
client: Fix advertise broadcast

When advertising with type broadcast it cannot be discoverable as that
would require setting flags which is not allowed by the spec.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agomain.conf: Add option to enable experimental features
Luiz Augusto von Dentz [Fri, 14 May 2021 21:07:42 +0000 (14:07 -0700)]
main.conf: Add option to enable experimental features

The adds options Experimental which is the equivalent to
-E/--experimental command line option.

Fixes https://github.com/bluez/bluez/issues/132

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agotools: Fix memory leaks
Steve Grubb [Fri, 14 May 2021 14:01:17 +0000 (10:01 -0400)]
tools: Fix memory leaks

req is allocated memory that must be freed. It appears all other error
paths got fail which handles this.

g_new0 allocates memory to data which must be freed.

g_malloc0 allocates memory to comp which must be freed.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agocore: Fix memory leaks
Steve Grubb [Fri, 14 May 2021 14:00:42 +0000 (10:00 -0400)]
core: Fix memory leaks

g_key_file_get_string allocates memory that must be freed.

asprintf allocates memory that must be freed.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoprofile: Fix memory leaks
Steve Grubb [Fri, 14 May 2021 14:00:09 +0000 (10:00 -0400)]
profile: Fix memory leaks

g_new0 allocates memory that must be freed

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoplugin: Fix memory leaks
Steve Grubb [Fri, 14 May 2021 13:59:38 +0000 (09:59 -0400)]
plugin: Fix memory leaks

g_file_get_contents allocates memory. It needs to be freed on any
function exit.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agomesh: Fix memory leaks
Steve Grubb [Fri, 14 May 2021 13:58:07 +0000 (09:58 -0400)]
mesh: Fix memory leaks

The dir variable needs to be closed before leaving.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agomonitor: Fix possible crash of rfcomm packet
Yun-Hao Chung [Wed, 12 May 2021 02:36:06 +0000 (10:36 +0800)]
monitor: Fix possible crash of rfcomm packet

When RFCOMM_TEST_EA returns false, btmon assumes packet data has at
least 5 bytes long. If that assumption fails, btmon could crash when
trying to read the next byte.
This patch fix it by checking the remaining size before reading the last
byte.

Reviewed-by: apusaka@chromium.org
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agobtmgmt: Fix enable adding irk when turining privacy on
Sathish Narasimman [Tue, 4 May 2021 11:14:54 +0000 (16:44 +0530)]
btmgmt: Fix enable adding irk when turining privacy on

Unable to add the IRK in btmgmt when need to be updated. The option is
enabled now.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoshared/shell: Print help info for individual commands
Inga Stotland [Thu, 13 May 2021 00:39:09 +0000 (17:39 -0700)]
shared/shell: Print help info for individual commands

For menus with long list of entries, it is useful to be able invoke
help message for an individual entry to look up command description and
synopsis.
Can be invoked by entering "<command> help" or "<command> --help".

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agobtdev: Fix crashing if ISO link is in fact a BIS
Luiz Augusto von Dentz [Thu, 13 May 2021 16:43:36 +0000 (09:43 -0700)]
btdev: Fix crashing if ISO link is in fact a BIS

BIS doesn't not have necessarily needs a link if there is no sync in
place.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoclient/advertising: Add support for setting min/max intervals
Luiz Augusto von Dentz [Thu, 13 May 2021 00:18:13 +0000 (17:18 -0700)]
client/advertising: Add support for setting min/max intervals

This adds support for setting MinInterval/MaxInterval.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agomesh: Add missing "storage" option to help menu
Inga Stotland [Thu, 13 May 2021 06:15:16 +0000 (23:15 -0700)]
mesh: Add missing "storage" option to help menu

This adds a previously missing entry for "storage" option
when printing the daemon usage info.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agomonitor: Remove Pygments dependency from manpage
Tedd Ho-Jeong An [Fri, 7 May 2021 00:56:30 +0000 (17:56 -0700)]
monitor: Remove Pygments dependency from manpage

This patch removes the Pygments dependency from btmon .rst file.
When the code-block type is specified, the rst2man throws a warning
asking for Pygments package.

Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agobtdev: Mark LE Periodic Advertising bit as supported
Luiz Augusto von Dentz [Mon, 10 May 2021 18:06:19 +0000 (11:06 -0700)]
btdev: Mark LE Periodic Advertising bit as supported

This enables LE Periodic Advertising bit on LE Read Local Supported
Features:

> HCI Event: Command Complete (0x0e) plen 12
      LE Read Local Supported Features (0x08|0x0003) ncmd 1
        Status: Success (0x00)
        Features: 0x00 0x39 0x00 0xf0 0x01 0x00 0x00 0x00
          LE 2M PHY
          LE Coded PHY
          LE Extended Advertising
          LE Periodic Advertising
          Connected Isochronous Stream - Master
          Connected Isochronous Stream - Slave
          Isochronous Broadcaster
          Synchronized Receiver
          Isochronous Channels (Host Support)

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agobuild: Add generated manpages to distribute list
Tedd Ho-Jeong An [Wed, 5 May 2021 18:44:05 +0000 (11:44 -0700)]
build: Add generated manpages to distribute list

This patch adds generated manpages to the distribution list.

Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agobuild: Make test-gobex* depend on OBEX flag
Archie Pusaka [Thu, 6 May 2021 03:42:55 +0000 (11:42 +0800)]
build: Make test-gobex* depend on OBEX flag

If obex is disabled in the config, running gobex test is unnecessary.
This patch skips gobex tests if obex is disabled.

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 agounit/gobex: remove timer only when it's not removed yet
Archie Pusaka [Thu, 6 May 2021 03:42:54 +0000 (11:42 +0800)]
unit/gobex: remove timer only when it's not removed yet

There are instances where timer is removed because timeout has
occurred, yet we still remove it again by the end of the test. This
causes double removal and prints ugly messages which obscures the
real culprit.

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 agodoc/mgmt-api - Add a new error code for HCI status 0x3e
Yu Liu [Thu, 29 Apr 2021 18:15:38 +0000 (11:15 -0700)]
doc/mgmt-api - Add a new error code for HCI status 0x3e

We want to retry the pairing when HCI status 0x3e (Connection failed to
established/Synchronization timeout) is returned from the controller.
This is to add a new MGMT error code so that we can catch this 0x3e
failure and issue a retry in the user space.

Reviewed-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agomonitor/avdtp: Fix decoding of reject type
Luiz Augusto von Dentz [Sat, 1 May 2021 00:25:14 +0000 (17:25 -0700)]
monitor/avdtp: Fix decoding of reject type

Reject type was not being decoded, so this remove the early return and
leave the callback to decode it:

< ACL Data TX: Handle 42 flags 0x00 dlen 8
      Channel: 64 len 4 [PSM 25 mode Basic (0x00)] {chan 1}
      AVDTP: Set Configuration (0x03) Response Reject (0x03) type 0x00 label 2 nosp 0
        Service Category: Reserved (0x00)
        Error code: BAD_ACP_SEID (0x12)

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoavrcp: Fix not checking if params_len match number of received bytes
Luiz Augusto von Dentz [Fri, 30 Apr 2021 01:18:57 +0000 (18:18 -0700)]
avrcp: Fix not checking if params_len match number of received bytes

This makes sure the number of bytes in the params_len matches the
remaining bytes received so the code don't end up accessing invalid
memory.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agoavdtp: Fix accepting invalid/malformed capabilities
Luiz Augusto von Dentz [Fri, 30 Apr 2021 00:10:50 +0000 (17:10 -0700)]
avdtp: Fix accepting invalid/malformed capabilities

Check if capabilities are valid before attempting to copy them.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agocheckpatch: ignore SPDX license header check
Tedd Ho-Jeong An [Tue, 4 May 2021 19:59:53 +0000 (12:59 -0700)]
checkpatch: ignore SPDX license header check

This patch adds the rule to ignore the SPDX license header check.

Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agotools: Convert manpages to rst format
Tedd Ho-Jeong An [Tue, 4 May 2021 05:02:07 +0000 (22:02 -0700)]
tools: Convert manpages to rst format

This patch converts existing manpages in tools into the reStructuredText
format.

Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agosrc: Convert manpage to rst format
Tedd Ho-Jeong An [Tue, 4 May 2021 05:02:06 +0000 (22:02 -0700)]
src: Convert manpage to rst format

This patch converts the existing manpage for bluetoothd into
reStructuredText format.

Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agomonitor: Convert manpage to rst format
Tedd Ho-Jeong An [Tue, 4 May 2021 05:02:05 +0000 (22:02 -0700)]
monitor: Convert manpage to rst format

This patch adds support to convert reStructuredText formatted btmon
manpage to manpage with rst2man tool.

Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agobuild: Fix manpage enable flag
Tedd Ho-Jeong An [Tue, 4 May 2021 05:02:04 +0000 (22:02 -0700)]
build: Fix manpage enable flag

This patch fixes the manpages installation with --enable-manpages option
so the manpages are not installed by default if the option is not set
during the configuration.

Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agobuild: Create directory for ell/useful.h
Marcel Holtmann [Thu, 29 Apr 2021 08:14:28 +0000 (10:14 +0200)]
build: Create directory for ell/useful.h

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agomesh: Fix net_key_confirm parameter declaration
Marcel Holtmann [Tue, 27 Apr 2021 17:12:37 +0000 (19:12 +0200)]
mesh: Fix net_key_confirm parameter declaration

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agomesh: Fix network_id parameter declaration
Marcel Holtmann [Tue, 27 Apr 2021 17:08:15 +0000 (19:08 +0200)]
mesh: Fix network_id parameter declaration

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
2 years agotools/mgmt-tester: Fix to support emulator spec 5.2
Tedd Ho-Jeong An [Fri, 23 Apr 2021 23:53:52 +0000 (16:53 -0700)]
tools/mgmt-tester: Fix to support emulator spec 5.2

This patch updates the check for supported spec by the BT emulator to
support HCI spec 5.2

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