platform/upstream/bluez.git
14 months agobthost: Add support for BT_H4_ISO_PKT
Luiz Augusto von Dentz [Sat, 5 Mar 2022 01:22:27 +0000 (17:22 -0800)]
bthost: Add support for BT_H4_ISO_PKT

This adds sending and receiving BT_H4_ISO_PKT packets.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agobtdev: Implements BT_HCI_CMD_LE_BIG_TERM_SYNC
Luiz Augusto von Dentz [Sat, 5 Mar 2022 01:22:26 +0000 (17:22 -0800)]
btdev: Implements BT_HCI_CMD_LE_BIG_TERM_SYNC

This sends BT_HCI_EVT_DISCONNECT_COMPLETE when handling
BT_HCI_CMD_LE_BIG_TERM_SYNC.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agobtdev: Implements BT_HCI_CMD_LE_BIG_CREATE_SYNC
Luiz Augusto von Dentz [Sat, 5 Mar 2022 01:22:25 +0000 (17:22 -0800)]
btdev: Implements BT_HCI_CMD_LE_BIG_CREATE_SYNC

This sends BT_HCI_EVT_LE_BIG_SYNC_ESTABLISHED when handling
BT_HCI_CMD_LE_BIG_CREATE_SYNC.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agomonitor: Rename Periodic Advertising terms to PA/pa
Luiz Augusto von Dentz [Sat, 5 Mar 2022 01:22:24 +0000 (17:22 -0800)]
monitor: Rename Periodic Advertising terms to PA/pa

This renames the use of Periodic Advertising in the API to just PA.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agobtdev: Send BT_HCI_EVT_LE_PER_SYNC_ESTABLISHED if remote start pa
Luiz Augusto von Dentz [Sat, 5 Mar 2022 01:22:23 +0000 (17:22 -0800)]
btdev: Send BT_HCI_EVT_LE_PER_SYNC_ESTABLISHED if remote start pa

This sends BT_HCI_EVT_LE_PER_SYNC_ESTABLISHED if remote device start
to periodic advertise when BT_HCI_CMD_LE_PERIODIC_ADV_CREATE_SYNC is
pending.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agobtdev: Send BT_HCI_EVT_LE_PER_SYNC_ESTABLISHED when scan is initiated
Luiz Augusto von Dentz [Sat, 5 Mar 2022 01:22:22 +0000 (17:22 -0800)]
btdev: Send BT_HCI_EVT_LE_PER_SYNC_ESTABLISHED when scan is initiated

This sends BT_HCI_EVT_LE_PER_SYNC_ESTABLISHED if scan is initiated
while BT_HCI_CMD_LE_PERIODIC_ADV_CREATE_SYNC is pending.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agobtdev: Implement BT_HCI_CMD_LE_PERIODIC_ADV_TERM_SYNC
Luiz Augusto von Dentz [Sat, 5 Mar 2022 01:22:21 +0000 (17:22 -0800)]
btdev: Implement BT_HCI_CMD_LE_PERIODIC_ADV_TERM_SYNC

This adds implementation of BT_HCI_CMD_LE_PERIODIC_ADV_TERM_SYNC.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agobtdev: Implement BT_HCI_CMD_LE_PERIODIC_ADV_CREATE_SYNC_CANCEL
Luiz Augusto von Dentz [Sat, 5 Mar 2022 01:22:20 +0000 (17:22 -0800)]
btdev: Implement BT_HCI_CMD_LE_PERIODIC_ADV_CREATE_SYNC_CANCEL

This adds implementation of
BT_HCI_CMD_LE_PERIODIC_ADV_CREATE_SYNC_CANCEL generating
BT_HCI_EVT_LE_PER_SYNC_ESTABLISHED if necessary.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agobtdev: Implement BT_HCI_CMD_LE_PERIODIC_ADV_CREATE_SYNC
Luiz Augusto von Dentz [Sat, 5 Mar 2022 01:22:19 +0000 (17:22 -0800)]
btdev: Implement BT_HCI_CMD_LE_PERIODIC_ADV_CREATE_SYNC

This adds implementation of BT_HCI_CMD_LE_PERIODIC_ADV_CREATE_SYNC
generating BT_HCI_EVT_LE_PER_SYNC_ESTABLISHED and
BT_HCI_EVT_LE_PER_ADV_REPORT.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agomonitor: Fix Create BIG PDU
Luiz Augusto von Dentz [Sat, 5 Mar 2022 01:22:18 +0000 (17:22 -0800)]
monitor: Fix Create BIG PDU

The PDU of Create BIG is actually fixed size as the num_bis is
related to the number of indexes to be connected and not the BIS
parameters.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agodevice: Fix writing out of bounds array
ihsinme [Tue, 1 Mar 2022 06:14:45 +0000 (06:14 +0000)]
device: Fix writing out of bounds array

%32s expect a buffer of at least 33 bytes since it is a string it needs
to be NULL terminated.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agogatt: sanitize input at profile registration
Andreas Kemnade [Sat, 26 Feb 2022 10:08:36 +0000 (11:08 +0100)]
gatt: sanitize input at profile registration

Check whether type of UUIDs property of GattProfile1 object
is correct.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agoclient: Add support for scan <le/bredr>
Luiz Augusto von Dentz [Thu, 3 Mar 2022 00:30:11 +0000 (16:30 -0800)]
client: Add support for scan <le/bredr>

This adds support for entering the transport directly as an scan
argument rather than having to first set it scan.transport.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agotest-runner: Fix parsing of command line
Luiz Augusto von Dentz [Tue, 1 Mar 2022 23:26:14 +0000 (15:26 -0800)]
test-runner: Fix parsing of command line

Instead of parsing the command line, which can contain a shell script,
run using /bin/sh so it allows more complex command line to be tested:

sudo tools/test-runner -l -d -k <pathto/bzImage> --
'client/bluetoothctl power on && sleep 2 && client/bluetoothctl power
off'

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agoshared/shell: Introduce bt_shell_exec
Luiz Augusto von Dentz [Mon, 28 Feb 2022 23:58:29 +0000 (15:58 -0800)]
shared/shell: Introduce bt_shell_exec

This introduces bt_shell_exec which can be used to inject commands into
a bt_shell without using stdin/user input.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agotest-runner: Add option to start emulator
Luiz Augusto von Dentz [Mon, 28 Feb 2022 23:23:37 +0000 (15:23 -0800)]
test-runner: Add option to start emulator

This adds an option (-l/--emulator) to start btvirt before processing
the command which is convenient to runs tools like bluetoothctl:

  sudo tools/test-runner -l -d -k <pathto/bzImage> --
  client/bluetoothctl power on

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agohog-lib: Fix not waiting for UHID_START
Luiz Augusto von Dentz [Fri, 25 Feb 2022 22:18:47 +0000 (14:18 -0800)]
hog-lib: Fix not waiting for UHID_START

With use of UHID_CREATE2 the code needs to wait for UHID_START in order
to know if the reports are numbered or not.

Fixes: https://github.com/bluez/bluez/issues/298
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agobtproxy: Attempt to bind the next index
Luiz Augusto von Dentz [Fri, 25 Feb 2022 21:53:19 +0000 (13:53 -0800)]
btproxy: Attempt to bind the next index

If no specific index is given attempt to bind the next index if the
current one is already in use.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agoneard: Fix reading State message
Nicolas Fella [Wed, 23 Feb 2022 21:56:17 +0000 (22:56 +0100)]
neard: Fix reading State message

dbus_message_iter_recurse only makese sense for container types, this is a string.

Fixes: https://github.com/bluez/bluez/issues/300
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agosrc/shared/util.h: include sys/types.h
Fabrice Fontaine [Thu, 24 Feb 2022 17:31:04 +0000 (18:31 +0100)]
src/shared/util.h: include sys/types.h

Include sys/types.h to avoid the following build failure on musl raised
since commit fb57ad9b9d107856e5f1c8135da04ffa2f7a11ac:

In file included from src/shared/queue.c:15:
./src/shared/util.h:106:1: error: unknown type name 'ssize_t';
did you mean 'size_t'?
  106 | ssize_t util_getrandom(void *buf, size_t buflen, unsigned int flags);
      | ^~~~~~~
      | size_t

Fixes:
 - http://autobuild.buildroot.org/results/83eaeb3863040645409f5787fdbdde79385c5257
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agoerror: Fix typo
Fabrice Delliaux [Sat, 12 Feb 2022 15:21:20 +0000 (16:21 +0100)]
error: Fix typo

s/suuported/supported

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agomonitor: fix division by zero about conn->tx_pkt_med
Joseph Hwang [Wed, 16 Feb 2022 08:15:18 +0000 (16:15 +0800)]
monitor: fix division by zero about conn->tx_pkt_med

In a connection without outgoing traffic, conn->tx_num will remain 0.
In this case, conn->tx_pkt_med should be simply 0 without calculating
"conn->tx_bytes / conn->tx_num".

This was likely to happen, for example, when "btmon -w btsnoop.log"
was launched in the middle of a LE mouse connection, and a number of
incoming ACL Data RX were received as the mouse movements.  When
running "btmon -a btsnoop.log", it would encounter this error.

Reviewed-by: Alain Michaud <alainm@chromium.org>
Reviewed-by: Yun-Hao Chung <howardchung@chromium.org>
Reviewed-by: Shuo-Peng Liao <deanliao@chromium.org>
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agoadapter-api: Document per-client discovery sessions
Bastien Nocera [Wed, 23 Feb 2022 09:00:59 +0000 (10:00 +0100)]
adapter-api: Document per-client discovery sessions

The fact that each client can start its own discovery wasn't clear from
the documentation and only becomes obvious when reading the sources.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agoplayer: Fix Track being emitted with empty metadata
Luiz Augusto von Dentz [Tue, 15 Feb 2022 20:46:47 +0000 (12:46 -0800)]
player: Fix Track being emitted with empty metadata

This sometimes causes the Track to be schedule while some metadata are
still pending, also don't remove the Duration from track when updating
its metadata since Duration is typically updated by player status rather
than metadata.

Fixes: https://github.com/bluez/bluez/issues/291
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agogobex: Fix read from pointer after free
Tedd Ho-Jeong An [Fri, 18 Feb 2022 19:46:17 +0000 (11:46 -0800)]
gobex: Fix read from pointer after free

This patch sets the pointer to null after free since the g_free(p)
doesn't set the pointer to NULL.

This is reported by the Coverity.

Fixes: 7e7d826aa1db ("gobex: Print error if data cannot be written")
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agoMakefile.tools: remove duplicate link entry
Michael Nosthoff [Thu, 17 Feb 2022 09:56:48 +0000 (10:56 +0100)]
Makefile.tools: remove duplicate link entry

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agoshared: Fix the incorrect type with bit shift
Tedd Ho-Jeong An [Thu, 17 Feb 2022 06:31:45 +0000 (22:31 -0800)]
shared: Fix the incorrect type with bit shift

This patch fixes the following runtime error:

$ sudo ./monitor/btmon -w test.btsnoop
  Bluetooth monitor ver 5.63
  src/shared/btsnoop.c:339:18: runtime error: left shift of 65535 by 16 places cannot be represented in type 'int'

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agomain.conf: Fix parsing of mode options
Luiz Augusto von Dentz [Fri, 18 Feb 2022 02:10:50 +0000 (18:10 -0800)]
main.conf: Fix parsing of mode options

This replace the use of g_key_file_get_integer, which is limited to
only decimal values, to g_key_file_get_string and then use strtol to
convert the string value to integer.

Fixes: https://github.com/bluez/bluez/issues/293
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agoadapter: Fix allowing multiple adapters with the same address
Luiz Augusto von Dentz [Fri, 11 Feb 2022 22:00:51 +0000 (14:00 -0800)]
adapter: Fix allowing multiple adapters with the same address

The bdaddr of an adapter is used for its unique storage path so having
multiple adapters with the same address would likely cause problems
with its storage as they would be shared.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agomain.conf: Introduce MaxControllers
Luiz Augusto von Dentz [Fri, 11 Feb 2022 21:48:46 +0000 (13:48 -0800)]
main.conf: Introduce MaxControllers

This introduces MaxControllers which can be used to limit the number of
adapters exposed in the system.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agoadapter: battery provider for non-LE controllers
Daniel Trnka [Sat, 12 Feb 2022 08:45:42 +0000 (09:45 +0100)]
adapter: battery provider for non-LE controllers

Enable battery provider dbus interface BatteryProviderManager1 for
non-LE controllers, so external clients like pipewire can provide
battery information for bluetooth headsets on non-LE controllers.

Reviewed-by: Sonny Sasaka <sonnysasaka@chromium.org>
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agobuild: Fix errors with glibc < 2.25
Fabrice Fontaine [Mon, 14 Feb 2022 20:17:39 +0000 (21:17 +0100)]
build: Fix errors with glibc < 2.25

getrandom and sys/random.h are only available since glibc 2.25:
https://www.gnu.org/software/gnulib/manual/html_node/sys_002frandom_002eh.html
resulting in the following build failures since version 5.63 and
https://git.kernel.org/pub/scm/bluetooth/bluez.git/log/?qt=grep&q=getrandom:

plugins/autopair.c:20:24: fatal error: sys/random.h: No such file or directory
 #include <sys/random.h>
                        ^

To fix this build failure, add util_getrandom and a fallback (borrowed
from pipewire and licensed under MIT):
https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/master/src/pipewire/utils.c

Fixes:
 - http://autobuild.buildroot.org/results/6b8870d12e0804d6154230a7322c49416c1dc0e2
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agolib: fix hci_strtolm crash
Yun-Hao Chung [Mon, 14 Feb 2022 09:13:43 +0000 (17:13 +0800)]
lib: fix hci_strtolm crash

|str| can be NULL in the case of reading lm value. Calling strcasestr
could lead to a crash.

Reviewed-by: Archie Pusaka <apusaka@chromium.org>
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agorfcomm-tester: Increase amount of data from 8k to 32k
Luiz Augusto von Dentz [Tue, 15 Feb 2022 01:47:13 +0000 (17:47 -0800)]
rfcomm-tester: Increase amount of data from 8k to 32k

This forces the behavior where not all data can be written at once so it
is able to reproduce the from [1].

[1]https://bugzilla.kernel.org/show_bug.cgi?id=215594

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agogobex: Print error if data cannot be written
Luiz Augusto von Dentz [Mon, 14 Feb 2022 23:40:40 +0000 (15:40 -0800)]
gobex: Print error if data cannot be written

This makes sure that if the data cannot be written it fails and the
error is properly printed.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agoobexctl: Add optional argument channel to connect command
Luiz Augusto von Dentz [Mon, 14 Feb 2022 18:29:21 +0000 (10:29 -0800)]
obexctl: Add optional argument channel to connect command

This adds a third argument to connect command so a channel can be passed
to CreateSession which is useful since it possible to force a specific
RFCOMM channel.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agoprofiles: Fix the reusing gerror without re-initialization
Tedd Ho-Jeong An [Fri, 11 Feb 2022 02:00:54 +0000 (18:00 -0800)]
profiles: Fix the reusing gerror without re-initialization

When the GError variable is freeed with g_error_free(), it is not set to
NULL and reusing the same variable again can cause the seg_fault because
it is still pointing the old memory address which is freed.

This patch relaces the g_error_free() to g_clear_error() which frees the
variable and set it to NULL if the variable is used in the function
again.

Fixes: 4ad622d592ba5 ("profiles/a2dp: Fix unchecked return value")
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agodevice: Fix the reusing gerror without re-initialization
Tedd Ho-Jeong An [Fri, 11 Feb 2022 02:00:53 +0000 (18:00 -0800)]
device: Fix the reusing gerror without re-initialization

When the GError variable is freeed with g_error_free(), it is not set to
NULL and reusing the same variable again can cause the seg_fault because
it is still pointing the old memory address which is freed.

This patch relaces the g_error_free() to g_clear_error() which frees the
variable and set it to NULL if the variable is used in the function
again.

Fixes: 6a154cd08000b ("device: Fix unchecked return value")
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agoadapter: Fix the reusing gerror without re-initialization
Tedd Ho-Jeong An [Fri, 11 Feb 2022 02:00:52 +0000 (18:00 -0800)]
adapter: Fix the reusing gerror without re-initialization

When the GError variable is freeed with g_error_free(), it is not set to
NULL and reusing the same variable again can cause the seg_fault because
it is still pointing the old memory address which is freed.

This patch relaces the g_error_free() to g_clear_error() which frees the
variable and set it to NULL if the variable is used in the function
again.

Fixes: 2287c517ca1bd ("adapter: Fix unchecked return value")
Fixes: https://github.com/bluez/bluez/issues/276
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agodevice: Fix crash when removing device
Luiz Augusto von Dentz [Thu, 10 Feb 2022 22:11:42 +0000 (14:11 -0800)]
device: Fix crash when removing device

Calling btd_adapter_remove_device from device_remove_connection can
cause a crash, so instead of removing it immediatelly this set a the
temporary timeout to 0.

Fixes: https://github.com/bluez/bluez/issues/290
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agomonitor/sdp: Fixes out-of-bounds array access
Tedd Ho-Jeong An [Thu, 10 Feb 2022 06:09:17 +0000 (22:09 -0800)]
monitor/sdp: Fixes out-of-bounds array access

This patch fixes the out-of-bounds array access caught by the ASAN.

monitor/sdp.c:497:19: runtime error: index 8 out of bounds for type
'cont_data [8]'
=================================================================
==4180==ERROR: AddressSanitizer: global-buffer-overflow on address
0x7fe2d271a542 at pc 0x7fe2d174a57d bp 0x7ffc6dcac1d0 sp 0x7ffc6dcab978
WRITE of size 9 at 0x7fe2d271a542 thread T0
    #0 0x7fe2d174a57c  (/lib/x86_64-linux-gnu/libasan.so.5+0x9b57c)
    #1 0x7fe2d23bae85 in search_attr_rsp monitor/sdp.c:692
    #2 0x7fe2d23be3f1 in sdp_packet monitor/sdp.c:771
    #3 0x7fe2d23b004c in l2cap_frame monitor/l2cap.c:3247
    #4 0x7fe2d23b3d9c in l2cap_packet monitor/l2cap.c:3312
    #5 0x7fe2d237d5c3 in packet_hci_acldata monitor/packet.c:11638
    #6 0x7fe2d2381876 in packet_monitor monitor/packet.c:3967
    #7 0x7fe2d230b285 in data_callback monitor/control.c:973
    #8 0x7fe2d2447029 in mainloop_run src/shared/mainloop.c:106
    #9 0x7fe2d2449306 in mainloop_run_with_signal src/shared/mainloop-notify.c:188
    #10 0x7fe2d230324a in main monitor/main.c:290
    #11 0x7fe2d0b440b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
    #12 0x7fe2d2303b7d in _start (/home/han1/work/dev/bluez/monitor/btmon+0x1dbb7d)

0x7fe2d271a542 is located 30 bytes to the left of global variable 'tid_list'
defined in 'monitor/sdp.c:43:24' (0x7fe2d271a560) of size 384
0x7fe2d271a542 is located 2 bytes to the right of global variable 'cont_list'
defined in 'monitor/sdp.c:424:25' (0x7fe2d271a400) of size 320
SUMMARY: AddressSanitizer: global-buffer-overflow
(/lib/x86_64-linux-gnu/libasan.so.5+0x9b57c)
...
==4180==ABORTING

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agouuid: Fix crashing if a NULL string is passed to bt_string_to_uuid
Luiz Augusto von Dentz [Thu, 10 Feb 2022 00:03:45 +0000 (16:03 -0800)]
uuid: Fix crashing if a NULL string is passed to bt_string_to_uuid

bt_string_to_uuid shall chack if the string is valid before attempting
to access its contents.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agoadapter: Fix crash when storing link key
Luiz Augusto von Dentz [Wed, 9 Feb 2022 23:56:11 +0000 (15:56 -0800)]
adapter: Fix crash when storing link key

The following trace can be observed sometimes when pairing 2 emulator
instances:

 src/adapter.c:store_link_key() Unable to load key file from
 /var/lib/bluetooth/9C:DA:3E:F2:8E:46/9C:B6:D0:8A:A0:0C/info: (No
such file or directory)
 GLib: g_file_set_contents: assertion 'error == NULL ||
*error == NULL' failed
 ++++++++ backtrace ++++++++
 #1  btd_backtrace+0x28a (src/backtrace.c:59) [0x7f65bb5ab53a]
 #2  g_logv+0x21c (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6400.6)
 [0x7f65ba3f955c]
 #3  g_log+0x93 (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6400.6)
 [0x7f65ba3f9743]
 #4  g_file_set_contents+0x68
(/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6400.6) [0x7f65ba3dca68]
 #5  store_link_key+0x30a (src/adapter.c:8235) [0x7f65bb61839a]
 #6  new_link_key_callback+0x474 (src/adapter.c:8285) [0x7f65bb62c904]
 #7  queue_foreach+0x164 (src/shared/queue.c:203) [0x7f65bb722e34]
 #8  can_read_data+0x59f (src/shared/mgmt.c:343) [0x7f65bb72e09f]
 #9  watch_callback+0x112 (src/shared/io-glib.c:162) [0x7f65bb78acb2]
 #10 g_main_context_dispatch+0x14e
(/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6400.6) [0x7f65ba3f204e]

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agorfcomm-tester: Add test to write big chunks of data
Luiz Augusto von Dentz [Wed, 9 Feb 2022 02:09:35 +0000 (18:09 -0800)]
rfcomm-tester: Add test to write big chunks of data

This attempts to test traffic similar to OBEX using big chunk of data.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agobthost: Increase number of credits
Luiz Augusto von Dentz [Wed, 9 Feb 2022 23:41:16 +0000 (15:41 -0800)]
bthost: Increase number of credits

This increase the number of credits so bigger packets can be sent by
the likes of rfcomm-tester.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agobthost: Fix length calculation for RFCOMM header
Luiz Augusto von Dentz [Wed, 9 Feb 2022 21:59:17 +0000 (13:59 -0800)]
bthost: Fix length calculation for RFCOMM header

This fixes the length calculation for large packets that requires more
than 1 byte.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agobthost: Fix not handling ACL fragmentation
Luiz Augusto von Dentz [Wed, 9 Feb 2022 21:57:21 +0000 (13:57 -0800)]
bthost: Fix not handling ACL fragmentation

Large packets requires the support of ACL fragmentation in order to be
properly processed.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agobootstrap-configure: Don't enable admin plugin by default
Luiz Augusto von Dentz [Wed, 9 Feb 2022 19:01:31 +0000 (11:01 -0800)]
bootstrap-configure: Don't enable admin plugin by default

Admin plugin doesn't work properly when there are multiple adapters in
the system.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agoadv_monitor: Fix spamming errors
Luiz Augusto von Dentz [Tue, 8 Feb 2022 21:02:13 +0000 (13:02 -0800)]
adv_monitor: Fix spamming errors

If advertising manager is not enabled don't log any error on
btd_adapter_update_found_device, also change
btd_adv_monitor_offload_supported to btd_adv_monitor_offload_enabled
since that is checking if the features has been enabled rather than it
is just supported.

Fixes: https://github.com/bluez/bluez/issues/286
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agogdbus: Emit InterfacesAdded of parents objects first
Luiz Augusto von Dentz [Fri, 4 Feb 2022 01:29:25 +0000 (17:29 -0800)]
gdbus: Emit InterfacesAdded of parents objects first

This makes InterfacesAdded respect the object hierarchy in case its
parent has pending interfaces to be added.

Fixes: https://github.com/bluez/bluez/issues/272
Fixes: https://github.com/bluez/bluez/issues/284
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1534857
Fixes: https://bugs.archlinux.org/task/57464
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agomesh: Skip unneeded logs
Michał Lowas-Rzechonek [Thu, 3 Feb 2022 14:38:00 +0000 (15:38 +0100)]
mesh: Skip unneeded logs

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agomesh: Make key_aid and net_key_id naming consistent
Michał Lowas-Rzechonek [Thu, 3 Feb 2022 14:38:49 +0000 (15:38 +0100)]
mesh: Make key_aid and net_key_id naming consistent

- key_aid refers to application key AID
- net_key_id refers to unique, internal id of the network key, used in
  net-keys.h

Also, remove unused mesh_frnd_pkt struct.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agomesh: Fix sequence number of message in friend queue
Brian Gix [Wed, 19 Jan 2022 15:44:11 +0000 (07:44 -0800)]
mesh: Fix sequence number of message in friend queue

As pointed out by https://github.com/bluez/bluez/issues/250, the last
segment of a multi-segmented message added to Friend Queue was getting
reset to the seqAuth value incorrectly. The correct sequence was set
within the preceding for loop.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agobtdev: Fix response to BT_HCI_CMD_LE_REMOVE_CIG
Luiz Augusto von Dentz [Tue, 1 Feb 2022 00:35:17 +0000 (16:35 -0800)]
btdev: Fix response to BT_HCI_CMD_LE_REMOVE_CIG

BT_HCI_CMD_LE_REMOVE_CIG should respond with the CIG ID from the
command instead of always responding with 0x00.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agobtdev: Fix command status of BT_HCI_CMD_LE_TERM_BIG
Luiz Augusto von Dentz [Mon, 31 Jan 2022 23:47:49 +0000 (15:47 -0800)]
btdev: Fix command status of BT_HCI_CMD_LE_TERM_BIG

The status was reporting BT_HCI_CMD_DISCONNECT instead of
BT_HCI_CMD_LE_TERM_BIG.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agomonitor: Fix misaligment errors when parsing BIG/CIG events
Luiz Augusto von Dentz [Mon, 31 Jan 2022 23:00:30 +0000 (15:00 -0800)]
monitor: Fix misaligment errors when parsing BIG/CIG events

This fixes erros such as:

  monitor/packet.c:8129:2: runtime error: load of misaligned address
  0x55956a438f2d for type 'const uint16_t', which requires 2 byte
  alignment

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agobuild: Always define confdir and statedir
Bastien Nocera [Wed, 26 Jan 2022 11:36:35 +0000 (12:36 +0100)]
build: Always define confdir and statedir

As we will need those paths to lock down on them.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agoadapter: Remove custom MGMT send/reply timeout
Luiz Augusto von Dentz [Mon, 24 Jan 2022 23:41:03 +0000 (15:41 -0800)]
adapter: Remove custom MGMT send/reply timeout

This removes the custom MGMT send/reply timeout since bt_mgmt itself
can handle them itself and it actually start the timer only when the
command is actually sent to the kernel rather then when it is queued.

Fixes: https://github.com/bluez/bluez/issues/275
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agoshared/mgmt: Add request timeout handling
Luiz Augusto von Dentz [Mon, 24 Jan 2022 23:15:22 +0000 (15:15 -0800)]
shared/mgmt: Add request timeout handling

This adds request timeout handling when using mgmt_send_timeout and
mgmt_reply_timeout, the timeout is applied to the request only when it
is actually transmitted and not while queued.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agobtdev: Add implementation for BT_HCI_CMD_LE_TERM_BIG
Luiz Augusto von Dentz [Wed, 26 Jan 2022 23:03:45 +0000 (15:03 -0800)]
btdev: Add implementation for BT_HCI_CMD_LE_TERM_BIG

This adds handler for BT_HCI_CMD_LE_TERM_BIG and generate
BT_HCI_EVT_LE_BIG_TERMINATE to indicate to the host stack that the
BIG has been terminated.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agogatt: Make use of gatt_db_attribute_notify
Luiz Augusto von Dentz [Fri, 21 Jan 2022 20:52:14 +0000 (12:52 -0800)]
gatt: Make use of gatt_db_attribute_notify

This makes use of gatt_db_attribute_notify to send indications of
Service Changed.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agoshared/gatt-db: Introduce gatt_db_attribute_notify
Luiz Augusto von Dentz [Fri, 21 Jan 2022 20:51:41 +0000 (12:51 -0800)]
shared/gatt-db: Introduce gatt_db_attribute_notify

This introduces gatt_db_attribute_notify which can be used to trigger a
notification using the callback set by gatt_db_ccc_register.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agogatt: Make use of gatt_db_service_add_ccc
Luiz Augusto von Dentz [Thu, 20 Jan 2022 00:07:33 +0000 (16:07 -0800)]
gatt: Make use of gatt_db_service_add_ccc

This uses gatt_db_service_add_ccc and gatt_db_ccc_register so any ccc
registered with the use of the former gets proper state tracking.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agoshared/gatt-db: Introduce gatt_db_service_add_ccc
Luiz Augusto von Dentz [Thu, 20 Jan 2022 00:04:14 +0000 (16:04 -0800)]
shared/gatt-db: Introduce gatt_db_service_add_ccc

This adds gatt_db_service_add_ccc so the likes of plugins can use it
with the defaults callbacks which is useful for tracking their states.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agohog-lib: Make use of UHID_CREATE2
Luiz Augusto von Dentz [Tue, 18 Jan 2022 23:45:17 +0000 (15:45 -0800)]
hog-lib: Make use of UHID_CREATE2

This convert the use of UHID_CREATE to UHID_CREATE2 which gives back
the information of reports being numbered or not thus avoiding the need
to parse the report map in order to check if there are a report number
on them since UHID_START gives that information:

UHID_START:
  This is sent when the HID device is started. Consider this as an
  answer to UHID_CREATE2. This is always the first event that is sent.
  Note that this event might not be available immediately after
  write(UHID_CREATE2) returns.
  Device drivers might require delayed setups.
  This event contains a payload of type uhid_start_req. The "dev_flags"
  field describes special behaviors of a device. The following flags
  are defined:

      - UHID_DEV_NUMBERED_FEATURE_REPORTS
      - UHID_DEV_NUMBERED_OUTPUT_REPORTS
      - UHID_DEV_NUMBERED_INPUT_REPORTS

  Each of these flags defines whether a given report-type uses numbered
  reports. If numbered reports are used for a type, all messages from
  the kernel already have the report-number as prefix. Otherwise, no
  prefix is added by the kernel. For messages sent by user-space to the
  kernel, you must adjust the prefixes according to these flags

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agoavrcp: Fix unaligned access
Luiz Augusto von Dentz [Fri, 14 Jan 2022 22:05:48 +0000 (14:05 -0800)]
avrcp: Fix unaligned access

This fixes the access to struct media_attribute_header which needs to
be packed and it also replaces the use of ntohs/ntohl to byteorder
conversion helpers which are a lot more clear on what byteorder shall
be used.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agomonitor/avctp: Fix parsing of GetElementAttribute
Luiz Augusto von Dentz [Fri, 14 Jan 2022 22:02:05 +0000 (14:02 -0800)]
monitor/avctp: Fix parsing of GetElementAttribute

AVRCP byte order is always big endian:

Audio/Video Remote Control / Profile Specification - Page 20:

 'Transfer Octet Order; Packets shall transfer multiple-octet fields in
 standard network octet order (Big Endian), with more significant
 (high-order) octets being transferred before less-significant (low-order)
 octets.'

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agodevice: Fix device can't be scanned for 5 mins after reboot
Archie Pusaka [Thu, 13 Jan 2022 07:46:52 +0000 (15:46 +0800)]
device: Fix device can't be scanned for 5 mins after reboot

After the patches which limit the attempts of doing remote name
resolving, there's an issue which prevents BlueZ to RNR new devices
for 5 minutes after reboot. It's caused by failed_time is init to 0,
and is then treated as the timestamp when the device failed RNR.
However, actually there is no failure yet.

This patch fixes it by always allowing RNR when failed_time = 0.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agohog: Add input queue while uhid device has not been created
Luiz Augusto von Dentz [Wed, 12 Jan 2022 22:07:36 +0000 (14:07 -0800)]
hog: Add input queue while uhid device has not been created

Since report map is only read after all reports it is possible to start
receiving notifications before uhid has been created, so this adds a
queue to store the events while the report map is pending and once uhid
has been created dequeue the events.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agohog: Fix read order of attributes
Luiz Augusto von Dentz [Tue, 11 Jan 2022 01:35:15 +0000 (17:35 -0800)]
hog: Fix read order of attributes

The Report Map must be read after all other attributes otherwise the
Kernel driver may start using UHID_SET_REPORT which requires the
report->id to be known in order to resolve the attribute to send to.

Fixes: https://github.com/bluez/bluez/issues/220
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agomedia: Fix crash when endpoint replies with an error to SetConfiguration
Luiz Augusto von Dentz [Wed, 12 Jan 2022 15:22:22 +0000 (07:22 -0800)]
media: Fix crash when endpoint replies with an error to SetConfiguration

If endpoint responds to SetConfiguration the transport is being
destroyed without removing it from the list leading a crash.

Fixes: https://github.com/bluez/bluez/issues/269
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agotools/mesh-cfgclient: Fix config menu help message
Inga Stotland [Thu, 6 Jan 2022 19:26:32 +0000 (11:26 -0800)]
tools/mesh-cfgclient: Fix config menu help message

An info message suggesting to request a remote node composition
should reference the correct menu command: "composition-get".

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agotools/mesh-cfgclient: Fix typos in config storage
Inga Stotland [Fri, 7 Jan 2022 21:50:03 +0000 (13:50 -0800)]
tools/mesh-cfgclient: Fix typos in config storage

Fix keyword typos and comments.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agoavdtp: Fix runtime errors passing NULL to memcpy
Luiz Augusto von Dentz [Fri, 7 Jan 2022 21:28:46 +0000 (13:28 -0800)]
avdtp: Fix runtime errors passing NULL to memcpy

Passing NULL to memcpy is considered undefined behavior which leads to
the following runtime errors:

profiles/audio/avdtp.c:2709:2: runtime error: null pointer passed as
argument 1, which is declared to never be null
profiles/audio/avdtp.c:2709:2: runtime error: null pointer passed as
argument 2, which is declared to never be null
profiles/audio/avdtp.c:3326:2: runtime error: null pointer passed as
argument 2, which is declared to never be null
profiles/audio/avdtp.c:500:3: runtime error: null pointer passed as
argument 2, which is declared to never be null

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agoshared/util: Add util_memdup
Luiz Augusto von Dentz [Thu, 6 Jan 2022 19:45:12 +0000 (11:45 -0800)]
shared/util: Add util_memdup

This adds util_memdup which is intended to replace g_memdup since
replacing that with g_memdup2 requires bumping the glib version.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agoshared/util: Rename btd_malloc to util_malloc
Luiz Augusto von Dentz [Wed, 5 Jan 2022 23:53:35 +0000 (15:53 -0800)]
shared/util: Rename btd_malloc to util_malloc

util functions are not limited to daemon only which is normally the case
when using btd prefix.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agoemulator: Add support for vendor commands
Luiz Augusto von Dentz [Tue, 4 Jan 2022 22:43:15 +0000 (14:43 -0800)]
emulator: Add support for vendor commands

This adds support for vendor commands reserving a single opcode (0xfc10)
so it can be extended using subcommands, similar to how MSFT works.

The first subcommand (0x00) enables the emulator to generate arbitrary
events using the commands parameters:

> tools/hcitool cmd 3f 10 00 22 24 d0 d0 d0 d0 d0 d0 ff ff
< HCI Command: Vendor (0x3f|0x0010) plen 11
        00 22 24 d0 d0 d0 d0 d0 d0 ff ff
."$........
Bluetooth: hci0: Malformed HCI Event: 0x22
> HCI Event: Inquiry Result with R.. (0x22) plen 9
        Num responses: 36
        Page scan repetition mode: Reserved (0xff)
        Page period mode: Reserved (0xff)
        Class: 0xffffd0
          Major class: Uncategorized, specific device code not specified
          Minor class: 0x34
          Limited Discoverable Mode
          invalid service class
        Clock offset: 0x6368
        RSSI: 105 dBm (0x69)
> HCI Event: Command Complete (0x0e) plen 4
      Vendor (0x3f|0x0010) ncmd 1
        Status: Success (0x00)

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
14 months agoconfigure: Fix use of obsolete macros
Luiz Augusto von Dentz [Wed, 5 Jan 2022 22:02:05 +0000 (14:02 -0800)]
configure: Fix use of obsolete macros

This fixes the following warnings when using autoconf >= 2.70:

  configure.ac:19: warning: The macro `AC_LANG_C' is obsolete.
  configure.ac:45: warning: The macro `AC_HELP_STRING' is obsolete.
  configure.ac:440: warning: AC_OUTPUT should be used without arguments.

The macros are replacing following the autoconf documentation:

https://www.gnu.org/software/autoconf/manual/autoconf-2.70/html_node/Obsolete-Macros.html

Fixes: https://github.com/bluez/bluez/issues/246
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
15 months agoshared/gatt-server: Fix att length check logic 57/291057/2 accepted/tizen/unified/20230427.155828
Wootak Jung [Fri, 7 Apr 2023 05:50:34 +0000 (14:50 +0900)]
shared/gatt-server: Fix att length check logic

Change-Id: Ia5d5e43d20ad952c5a993398ab8dea42529a6162
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
15 months agoRevert "main_da.conf: Change ExchangeMTU value" 70/290770/1
Wootak Jung [Mon, 3 Apr 2023 04:43:05 +0000 (13:43 +0900)]
Revert "main_da.conf: Change ExchangeMTU value"

This reverts commit aa8431976bb677bf38e50a27d074cae7ff31dccd.

Change-Id: I644958733de7abf0a850d798ced8bd86b725348f

16 months agomain_da.conf: Change ExchangeMTU value 91/289891/1
Wootak Jung [Wed, 15 Mar 2023 06:48:07 +0000 (15:48 +0900)]
main_da.conf: Change ExchangeMTU value

Change-Id: I11a8a199070f6c0a96981fcfe959c7051653aded

16 months agoadapter_le_vsc_features: Do not set adv_inst_max to 1 in DA case 18/289518/2 accepted/tizen/unified/20230313.022904
Wootak Jung [Thu, 9 Mar 2023 06:08:51 +0000 (15:08 +0900)]
adapter_le_vsc_features: Do not set adv_inst_max to 1 in DA case

Change-Id: Iecaf149146e335d04e83c1db25c15ec46431593b
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
17 months agoadapter: Add adv data custom name handling logic 03/288403/2 accepted/tizen/unified/20230303.162748
Wootak Jung [Thu, 16 Feb 2023 06:36:58 +0000 (15:36 +0900)]
adapter: Add adv data custom name handling logic

If the name filed is not empty, custom name is already set

Change-Id: Icf5aac6275fc09a3090a47283c994fbc69c9d7c3
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
17 months agoMerge "Add support for custom advertising flags." into tizen accepted/tizen/unified/20230223.162144
Wootak Jung [Mon, 20 Feb 2023 06:42:39 +0000 (06:42 +0000)]
Merge "Add support for custom advertising flags." into tizen

17 months agoAdd support for custom advertising flags. 49/286849/7
Jakub Latusek [Wed, 1 Feb 2023 06:00:13 +0000 (15:00 +0900)]
Add support for custom advertising flags.

It is required to set proper advertising flags when establishing a
connection using
Bluetooth low energy to properly recognize device type.
Without this, the Linux device cannot recognize the Tizen device
properly and establish a connection.

Change-Id: I2dcbcd053a8de4c4954653ae8a5f55fbed775f66
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
Signed-off-by: Jakub Latusek <j.latusek@samsung.com>
17 months agoadapter: Fix pending_settings value not clear issue 43/288243/1
Wootak Jung [Tue, 14 Feb 2023 05:14:53 +0000 (14:14 +0900)]
adapter: Fix pending_settings value not clear issue

Remove the duplicated connectable mode setting logic

Change-Id: I994a87907394d705a9c20401aff2719845805f7a
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
17 months agoda: Add DA feature newly 28/287428/4 accepted/tizen/unified/20230202.015300
Wootak Jung [Fri, 27 Jan 2023 09:18:32 +0000 (18:18 +0900)]
da: Add DA feature newly

da feature contains many da models as well as fhub

Use da feature for below functions:
set adv data flag, offloading, log

Change-Id: I34f3b4039b421f7c22e1fca1c5d2a296ee1ee5cf
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
17 months agofhub: apply DA feature (offloading) 27/287427/2
Wootak Jung [Fri, 27 Jan 2023 09:14:54 +0000 (18:14 +0900)]
fhub: apply DA feature (offloading)

Change-Id: Iae80e51a7d7180ef3563fb744e58b4d6dc47f64e
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
18 months agoUse HCI error code instead of MGMT disconnection reason 62/286562/1 accepted/tizen/unified/20230111.174532
Dohyun Pyun [Mon, 20 Jun 2022 08:37:27 +0000 (17:37 +0900)]
Use HCI error code instead of MGMT disconnection reason

Change-Id: If715b847372b0be82ebdd8404a8b2a39bca01970
Signed-off-by: Dohyun Pyun <dh79.pyun@samsung.com>
19 months agoRename symbol to prevent redefinition 65/285065/3
Marek Pikuła [Mon, 5 Dec 2022 17:51:10 +0000 (18:51 +0100)]
Rename symbol to prevent redefinition

For Tizen RISC-V build there is a `sync` symbol first declared in
/usr/include/unistd.h:1005:13.

Change-Id: I7d5f96e93d72841196a1aaae52c269736765919c
Signed-off-by: Marek Pikuła <m.pikula@partner.samsung.com>
19 months agoMerge "riscv64: Set ARCH64 on RISC-V" into tizen submit/tizen/20221206.101102
Lukasz Stelmach [Tue, 6 Dec 2022 09:30:57 +0000 (09:30 +0000)]
Merge "riscv64: Set ARCH64 on RISC-V" into tizen

19 months agocore: Use timeout_add_seconds 41/285041/1 accepted/tizen/unified/20221206.170555
Wootak Jung [Mon, 5 Dec 2022 04:20:29 +0000 (13:20 +0900)]
core: Use timeout_add_seconds

Replace calls to g_timeout_add_seconds() by the timeout_add_seconds()
wrapper which takes care of 0 delay.

Change-Id: I9b8cc6d6d3f625eb3a51720446b4aaf720ca65ec
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
20 months agoriscv64: Set ARCH64 on RISC-V 59/284559/1 submit/tizen/20221206.094110
Marek Pikuła [Mon, 14 Nov 2022 11:49:54 +0000 (12:49 +0100)]
riscv64: Set ARCH64 on RISC-V

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

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

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

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

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

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

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

Change-Id: Iea3544fb1a71b9cde9693646b598310777bae66e

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

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

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

Change-Id: I566d1fe5aa1dd0e047a7c6bb5614a6d8fc5e4e2b
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>