Sameer Kumar [Mon, 29 Jul 2024 11:41:19 +0000 (17:11 +0530)]
This patch fixes SVACE issue.
Issue ID: 224707
Change-Id: I15d9a20830d2b76214e8847869673715e2c29c34
Signed-off-by: Sameer Kumar <sameer.kumar@samsung.com>
Anuj Jain [Mon, 17 Jun 2024 05:57:22 +0000 (11:27 +0530)]
Fix Crash issue
This patch fixes crash issue occuring due to access of freed
gatt client pointer.
Change-Id: I064ea4bd624373fde9bbb74923eebd2dc1d081d8
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Wootak Jung [Tue, 4 Jun 2024 07:36:12 +0000 (16:36 +0900)]
audio/transport: Disable set_volume functionality in DA product
Change-Id: Ibca427f5f6824878c0a615f6792a90139b59993a
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
Wootak Jung [Tue, 4 Jun 2024 07:15:21 +0000 (16:15 +0900)]
Add new DA model names
AI Home Smart EHS
Smart Oven
Smart AC
AI Vision Refrigerator
Change-Id: Iddcee26408bf55ac9eba816475ce82046c2ae95c
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
Wootak Jung [Tue, 21 May 2024 02:52:31 +0000 (11:52 +0900)]
Fix crash issue
0 0xaae6c8da in notify_io_destroy (data=0xac2cbcb0) at src/gatt-client.c:1698
1698 DBG("notify_io destroyed. length: %d", queue_length(client->chrc->notify_clients));
(gdb) info args
data = 0xac2cbcb0
(gdb) p client
$1 = (struct notify_client *) 0xac2cbcb0
(gdb) p *client
$2 = {chrc = 0x0, ref_count = 0, owner = 0x0, watch = 0, notify_id = 56}
$1 = (struct notify_client *) 0x55a1388d20
(gdb)
$2 = (struct notify_client *) 0x55a1388d20
(gdb) p *client
p *client
$3 = {chrc = 0x1, ref_count = 0, owner = 0x0, watch = 0, notify_id = 0}
Change-Id: Icb84e5995d7a2cd5ce1447d075a30ce1cc1a2f2f
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
Sameer Kumar [Fri, 24 May 2024 10:21:54 +0000 (15:51 +0530)]
Get local IRK value
This patch adds support to get local IRK value.
Change-Id: Iae9293c6d93688d8b9a6672bdaf2261c41668a9f
Signed-off-by: Sameer Kumar <sameer.kumar@samsung.com>
Sohyeon Choi [Sun, 7 Apr 2024 14:11:32 +0000 (23:11 +0900)]
device: Set disconnect timer to zero for fast disconnection
Change-Id: I8d6d3741b05abb9c2f5a18a34eb197f9a924d149
Wootak Jung [Fri, 29 Mar 2024 05:19:06 +0000 (14:19 +0900)]
avdtp: Modify disconnect timer for Buds2
Change-Id: Id5f88e3636b80cd222e9c75469ef7c5cea78cd57
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
Wootak Jung [Thu, 28 Mar 2024 23:53:25 +0000 (08:53 +0900)]
device: Fix issue where the connection was not completely released when coc disconnected
Change-Id: Ia2cbcea8a3a30a14426645b61631d9fea217c185
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
Anuj Jain [Wed, 27 Mar 2024 10:27:52 +0000 (15:57 +0530)]
Add timeout logic for le coc connection request
This patch adds 10 sec timeout upon receiving l2cap_le
connection request.
Change-Id: Id4cf266603e64eab8685325f218b1180c9c5b125
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Wootak Jung [Wed, 20 Mar 2024 23:02:02 +0000 (08:02 +0900)]
device: Modify DA specific logic
Change-Id: Ic8d04b2c3c8e45b2a1c5aa86ae7aab6535f75ecd
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
Wootak Jung [Wed, 17 Apr 2024 02:58:01 +0000 (11:58 +0900)]
Revert "Apply DA model specification"
This reverts commit
d3be6a9404f73ee12f18ed0c0fd778e6808d0e74.
Change-Id: Iac6480ee93d1023d0f7016ecaea528271f966e63
Wootak Jung [Thu, 29 Feb 2024 02:18:14 +0000 (11:18 +0900)]
device: Add DA logic to restrict the connection to only one mobile device
Change-Id: Ibd4e485a594b2644ef5ab89de8e559a766480cf0
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
Wootak Jung [Tue, 13 Feb 2024 00:21:11 +0000 (09:21 +0900)]
Apply DA model specification
Disable A2DP/AVRCP profiles
Change-Id: Ie20002629367c9383973dba6f900425aa0e9a763
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
Wootak Jung [Wed, 17 Jan 2024 04:14:29 +0000 (13:14 +0900)]
main_da.conf: Update ReconnectUUIDs and ReconnectAttempts for the DA model
Change-Id: I4144ccafaa7b3cff83d960c055be81aed06f8798
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
Wootak Jung [Tue, 16 Jan 2024 03:53:35 +0000 (12:53 +0900)]
Fix issue of not reconnecting when disconnected due to timeout
Change-Id: I0f263370df9c22d8fdc98ceb33bc1e364b828ba8
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
Wootak Jung [Thu, 11 Jan 2024 00:09:19 +0000 (09:09 +0900)]
adapter: Fix issue where adv stop request disables unintended instance
Reproduction steps:
1. adv1, adv2 are in progress
2. LE connected and adv2 has stopped for a while and is scheduled(timer) to restart
3. adv1 stop request before restart timer is run
4. timer is removed and adv1 is stopped
5. adv2 is not restarted even though it should
Change-Id: I5d2f7a2ae87d87d180e92f380505e8118fc973b0
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
Wootak Jung [Thu, 28 Dec 2023 00:12:59 +0000 (09:12 +0900)]
adapter: Fix issue where the adv restart logic operates even though adv stop is requested
Fix the adv restart logic to only operate when adv is enabled
Change-Id: I9aebdc393050b6c7b3674281ffd801c6db18f14c
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
Ayush Garg [Fri, 5 Jan 2024 14:15:18 +0000 (19:45 +0530)]
Fix build issue for aarch64
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Ayush Garg [Fri, 5 Jan 2024 13:41:00 +0000 (19:11 +0530)]
Update bluez version to 5.70 in spec file
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Marcel Holtmann [Thu, 28 Sep 2023 19:51:34 +0000 (21:51 +0200)]
Release 5.70
Luiz Augusto von Dentz [Tue, 19 Sep 2023 19:14:01 +0000 (12:14 -0700)]
pbap: Fix not checking Primary/Secundary Counter length
Primary/Secundary Counters are supposed to be 16 bytes values, if the
server has implemented them incorrectly it may lead to the following
crash:
=================================================================
==31860==ERROR: AddressSanitizer: heap-buffer-overflow on address
0x607000001878 at pc 0x7f95a1575638 bp 0x7fff58c6bb80 sp 0x7fff58c6b328
READ of size 48 at 0x607000001878 thread T0
#0 0x7f95a1575637 in MemcmpInterceptorCommon(void*, int (*)(void const*, void const*, unsigned long), void const*, void const*, unsigned long) ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:860
#1 0x7f95a1575ba6 in __interceptor_memcmp ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:892
#2 0x7f95a1575ba6 in __interceptor_memcmp ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:887
#3 0x564df69c77a0 in read_version obexd/client/pbap.c:288
#4 0x564df69c77a0 in read_return_apparam obexd/client/pbap.c:352
#5 0x564df69c77a0 in phonebook_size_callback obexd/client/pbap.c:374
#6 0x564df69bea3c in session_terminate_transfer obexd/client/session.c:921
#7 0x564df69d56b0 in get_xfer_progress_first obexd/client/transfer.c:729
#8 0x564df698b9ee in handle_response gobex/gobex.c:1140
#9 0x564df698cdea in incoming_data gobex/gobex.c:1385
#10 0x7f95a12fdc43 in g_main_context_dispatch (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x55c43)
#11 0x7f95a13526c7 (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0xaa6c7)
#12 0x7f95a12fd2b2 in g_main_loop_run (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x552b2)
#13 0x564df6977d41 in main obexd/src/main.c:307
#14 0x7f95a10a7d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
#15 0x7f95a10a7e3f in __libc_start_main_impl ../csu/libc-start.c:392
#16 0x564df6978704 in _start (/usr/local/libexec/bluetooth/obexd+0x8b704)
0x607000001878 is located 0 bytes to the right of 72-byte region [0x607000001830,0x607000001878)
allocated by thread T0 here:
#0 0x7f95a1595a37 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154
#1 0x564df69c8b6a in pbap_probe obexd/client/pbap.c:1259
Arkadiusz Bokowy [Wed, 20 Sep 2023 18:43:13 +0000 (20:43 +0200)]
vhci: Check whether vhci open setup succeeded
Due to race condition in the vhci kernel driver, we might read not a
vendor response packet, but a HCI reset command. This extra check will
ensure that kernel driver behaves correctly. Otherwise, the HCI setup
process will fail, because our controller will not respond to "missing"
HCI reset command. In result the virtual HCI will be DOWN and without
initialized Bluetooth address, e.g:
> hciconfig
hci2: Type: Primary Bus: Virtual
BD Address: 00:AA:01:01:00:02 ACL MTU: 192:1 SCO MTU: 0:0
UP RUNNING
RX bytes:0 acl:0 sco:0 events:66 errors:0
TX bytes:3086 acl:0 sco:0 commands:66 errors:0
hci1: Type: Primary Bus: Virtual
BD Address: 00:00:00:00:00:00 ACL MTU: 0:0 SCO MTU: 0:0
DOWN
RX bytes:0 acl:0 sco:0 events:0 errors:0
TX bytes:8 acl:0 sco:0 commands:1 errors:0
> dmesg
[1754256.640122] Bluetooth: MGMT ver 1.22
[1754263.023806] Bluetooth: MGMT ver 1.22
[1754265.043775] Bluetooth: hci1: Opcode 0x c03 failed: -110
Luiz Augusto von Dentz [Tue, 19 Sep 2023 20:04:14 +0000 (13:04 -0700)]
media-api: Convert to ReStructuredText format
This converts media-api.txt to media-api.rst.
Arkadiusz Bokowy [Tue, 19 Sep 2023 16:27:45 +0000 (18:27 +0200)]
hciemu: Call btdev_receive_h4 unconditionally
Calling btdev_receive_h4 without prior logic will allow this function
to print some debug logs. E.g.: in case when the received packet type
is not supported.
> Bluetooth emulator ver 5.66
> vhci0: > ff 00 01 00 ....
> vhci0: Unsupported packet 0xff
Arkadiusz Bokowy [Tue, 19 Sep 2023 16:27:44 +0000 (18:27 +0200)]
emulator: Skip new line when using util_debug
The debug callback vhci_debug() already prints new line after each debug
string. Explicit new line in the util_debug call causes double new line
in the output.
Luiz Augusto von Dentz [Mon, 18 Sep 2023 21:10:09 +0000 (14:10 -0700)]
shared/log: Fix not checking vasprintf return
It seems like some implementation of vasprintf set the content of the
str to NULL rather then returning -1 causing the following errors:
=================================================================
==216204==ERROR: AddressSanitizer: attempting free on address which
was not malloc()-ed: 0x55e787722cf0 in thread T0
#0 0x55e784f75872 in __interceptor_free.part.0 asan_malloc_linux.cpp.o
#1 0x55e7850e55f9 in bt_log_vprintf
/usr/src/debug/bluez-git/bluez-git/src/shared/log.c:154:2
#2 0x55e78502db18 in monitor_log
/usr/src/debug/bluez-git/bluez-git/src/log.c:40:2
#3 0x55e78502dab4 in info
/usr/src/debug/bluez-git/bluez-git/src/log.c:52:2
#4 0x55e78502e314 in __btd_log_init
/usr/src/debug/bluez-git/bluez-git/src/log.c:179:2
#5 0x55e78502aa63 in main
/usr/src/debug/bluez-git/bluez-git/src/main.c:1388:2
#6 0x7f1d5fe27ccf (/usr/lib/libc.so.6+0x27ccf) (BuildId:
316d0d3666387f0e8fb98773f51aa1801027c5ab)
#7 0x7f1d5fe27d89 in __libc_start_main
(/usr/lib/libc.so.6+0x27d89) (BuildId:
316d0d3666387f0e8fb98773f51aa1801027c5ab)
#8 0x55e784e88084 in _start
(/usr/lib/bluetooth/bluetoothd+0x36084) (BuildId:
19348ea642303b701c033d773055becb623fe79a)
Address 0x55e787722cf0 is a wild pointer inside of access range of
size 0x000000000001.
SUMMARY: AddressSanitizer: bad-free asan_malloc_linux.cpp.o in
__interceptor_free.part.0
==216204==ABORTING
сен 18 13:10:02 archlinux systemd[1]: bluetooth.service: Main process
exited, code=exited, status=1/FAILURE
Koba Ko [Sun, 17 Sep 2023 17:25:20 +0000 (01:25 +0800)]
configure.ac: Add enable_btpclient and enable_mesh for internal ELL
when checking enable_external_ell != 'yes',
even enable_btpclient and enable_mesh are not enabled.
configure still prompt the error.
Then ELL must be installed to pass the configure.
Luiz Augusto von Dentz [Thu, 14 Sep 2023 20:57:07 +0000 (13:57 -0700)]
l2cap-tester: Add tests for connection timeout
This adds the following tests which attempts to use SO_SNDTIMEO so the
socket times out before the connection completes:
L2CAP BR/EDR Client - Timeout
L2CAP LE Client - Timeout
L2CAP Ext-Flowctl Client - Timeout
Luiz Augusto von Dentz [Thu, 14 Sep 2023 19:44:23 +0000 (12:44 -0700)]
l2cap-tester: Add tests for closing socket before connection completes
This adds the following tests which attempts to close/shutdown the
socket before the connection completes:
L2CAP BR/EDR Client - Close
L2CAP LE Client - Close
L2CAP Ext-Flowctl Client - Close
Vlad Pruteanu [Tue, 12 Sep 2023 07:03:19 +0000 (10:03 +0300)]
monitor: Use proper name for CIS bit
In the Bluetooth Specification the complete name for bit
number 32 is "Connected Isochronous Stream (Host Support)".
Vlad Pruteanu [Tue, 12 Sep 2023 06:55:26 +0000 (09:55 +0300)]
bap: Use defer setup when syncing to a BIS source
This commit uses the newly added bt_io_bcast_accept function from
btio.c to implement the defer setup for the BIS sync process.
Now, information from the BIG Info advertising report can be
used when sending the BIG Create Sync command.
Luiz Augusto von Dentz [Mon, 11 Sep 2023 22:30:01 +0000 (15:30 -0700)]
device: Fix not handling initiator properly
Previously initiator would be set whenever a central key was found
which turns out to be unreliable besides the MGMT New Connection event
does in fact inform if the connection was initiated locally or not.
Fixes: https://github.com/bluez/bluez/issues/598
Luiz Augusto von Dentz [Mon, 11 Sep 2023 20:51:20 +0000 (13:51 -0700)]
main.conf: Fix parsing of uint32_t values
Passing UINT32_MAX as int may overfollow causing errors such as:
bluetoothd[2688495]: src/main.c:parse_config_int()
General.TemporaryTimeout = 60 is out of range (> -1)
Fixes: https://github.com/bluez/bluez/issues/583#issuecomment-
1713447461
Iulia Tanasescu [Thu, 7 Sep 2023 15:12:29 +0000 (18:12 +0300)]
shared/bass: Add Set Broadcast_Code opcode handler
This adds the Set Broadcast_Code opcode handler, enabling a BASS Server
to sync to an encrypted BIG.
Iulia Tanasescu [Thu, 7 Sep 2023 15:12:28 +0000 (18:12 +0300)]
monitor: Fix ATT decoding issue
This fixes the way conn handles are marked as unused in the
conn_list array, so that valid conn entries are not overwritten
by new ones.
Iulia Tanasescu [Thu, 7 Sep 2023 15:12:27 +0000 (18:12 +0300)]
btio: Add support for accepting BIS after defer setup
This adds btio support for accepting BIS connections when defer
setup is enabled on a Broadcast Receiver socket.
Luiz Augusto von Dentz [Thu, 7 Sep 2023 19:39:53 +0000 (12:39 -0700)]
main.conf: Fix documention of CSIS.Encrypt
CSIS.Encrypt is a boolean so it shall only be set with true/false not
yes/no.
Luiz Augusto von Dentz [Thu, 7 Sep 2023 19:36:39 +0000 (12:36 -0700)]
main.conf: Fix printing errors for valid options
This fixes the following errors:
Unknown key RefreshDiscovery for group General
Unknown key Encryption for group CSIS
Fixes: https://github.com/bluez/bluez/issues/583
Claudia Draghicescu [Wed, 6 Sep 2023 11:42:34 +0000 (14:42 +0300)]
btio: Fix BASE copy from getsockopt()
Fix copy of BASE from getsockopt() and update base length.
Nitin Jadhav [Tue, 5 Sep 2023 07:09:11 +0000 (10:09 +0300)]
micp: Add MICP plugin
MICP profile level interface function have been implemented
This adds initial code for MICP plugin.
Nitin Jadhav [Tue, 5 Sep 2023 07:09:10 +0000 (10:09 +0300)]
src/shared/micp.c: To implement MICP profile MICS service
- Implementation of functions related profile and service for MICS and MICP
- Specifications referred for implementation:
MICS - MICS_v1.0.pdf
MICP - MICP_v1.0.pdf
Nitin Jadhav [Tue, 5 Sep 2023 07:09:09 +0000 (10:09 +0300)]
lib/uuid.h: Add UUID(s)
Add MICS characteristic uuid(s)
Luiz Augusto von Dentz [Thu, 31 Aug 2023 21:57:14 +0000 (14:57 -0700)]
bap: Fix not always calling bap_io_close on disconnect
bap_io_disconnected was getting registered for all links while
connecting which prevented bap_io_close to be called when ISO socket is
disconnected thus the cig_active flag will remain set preventing the IO
to be recreated.
Luiz Augusto von Dentz [Thu, 31 Aug 2023 20:43:15 +0000 (13:43 -0700)]
monitor: Fix runtime error
This fixes the following runtime error:
monitor/packet.c:10476:2: runtime error: division by zero
Floating point exception
Luiz Augusto von Dentz [Thu, 24 Aug 2023 21:19:40 +0000 (14:19 -0700)]
media-api: Make QoS a single property
This moves QoS related properties to a single dictionary.
Luiz Augusto von Dentz [Mon, 28 Aug 2023 19:28:32 +0000 (12:28 -0700)]
bap: Remove duplicated code
bap_create_io already handle streams of differents types.
Luiz Augusto von Dentz [Mon, 28 Aug 2023 17:53:55 +0000 (10:53 -0700)]
shared/gatt-client: Fix not sending confirmations
Commit
fde32ff9c9c0 ("shared/gatt-client: Allow registering with NULL
callback") added an early return to the notify_cb function when the
current client's notify_list is empty which prevents sending
confirmations to indications.
Reported-by: Javier de San Pedro <dev.git@javispedro.com>
Marcel Holtmann [Thu, 24 Aug 2023 17:01:09 +0000 (19:01 +0200)]
Release 5.69
Luiz Augusto von Dentz [Thu, 24 Aug 2023 04:54:36 +0000 (21:54 -0700)]
transport: Fix crash with broadcast properties
When connecting a BAP unicast stream the followin crash can be observed:
Access not within mapped region at address 0x1D4C0000000A
at 0x14F759: get_bcode (transport.c:1121)
by 0x1E02E4: append_property.isra.0 (object.c:498)
by 0x1E03B9: append_properties (object.c:527)
by 0x1E2AAB: g_dbus_get_properties (object.c:1811)
by 0x14B9B6: pac_config (media.c:1130)
Marcel Holtmann [Thu, 24 Aug 2023 13:54:03 +0000 (15:54 +0200)]
build: Update library version
Iulia Tanasescu [Wed, 23 Aug 2023 15:11:25 +0000 (18:11 +0300)]
isotest: Add defer setup support for Broadcast Receiver
This adds defer setup support for the Broadcast Receiver scenario.
In order to create a Broadcast Receiver with the defer setup option,
the -W command line parameter should be used, as described in
isotest.rst.
Claudia Draghicescu [Tue, 22 Aug 2023 14:29:35 +0000 (17:29 +0300)]
adapter: Fix UUID name advertised for bcast source
Fix UUID name typo.
Claudia Draghicescu [Tue, 22 Aug 2023 14:29:34 +0000 (17:29 +0300)]
client/player: Remove Broadcast parameter
Remove unused gdbus parameter.
Fix length for Codec Specific Configuration.
Claudia Draghicescu [Tue, 22 Aug 2023 14:29:33 +0000 (17:29 +0300)]
transport: Update transport properties for a broadcast stream
This patch gets the QOS broadcast stream parameters and passes them
to upper layers.
Claudia Draghicescu [Tue, 22 Aug 2023 14:29:32 +0000 (17:29 +0300)]
media: Add broadcast sink media endpoint
This patch adds the possibility to register a broadcast
media endpoint if the controller has support for ISO Sync Receiver.
Claudia Draghicescu [Tue, 22 Aug 2023 14:29:31 +0000 (17:29 +0300)]
bap: Add support for BAP broadcast sink
This adds support for BAP broadcast sink, creates a remote endpoint when a
broadcast source is discovered and synchronizes with the source upon
endpoint configuration.
This feature was tested using bluetoothctl with the following commands:
[bluetooth]# endpoint.register
00001851-0000-1000-8000-
00805f9b34fb 0x06
[bluetooth]# scan on
[NEW] Endpoint /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX/pac_bcast0
[bluetooth]# endpoint.config
/org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX/pac_bcast0
/local/endpoint/ep0 16_2_1
Claudia Draghicescu [Tue, 22 Aug 2023 14:29:30 +0000 (17:29 +0300)]
shared/bap: Add support for BAP broadcast sink
This adds support for BAP broadcast sink, creates a remote endpoint when a
broadcast source is discovered and synchronizes with the source upon
endpoint configuration.
This feature was tested using bluetoothctl with the following commands:
[bluetooth]# endpoint.register
00001851-0000-1000-8000-
00805f9b34fb 0x06
[bluetooth]# scan on
[NEW] Endpoint /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX/pac_bcast0
[bluetooth]# endpoint.config
/org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX/pac_bcast0
/local/endpoint/ep0 16_2_1
Luiz Augusto von Dentz [Wed, 23 Aug 2023 20:31:07 +0000 (13:31 -0700)]
client: Add agent auto argument support
This adds "auto" capability which behaves like "on" but instead of
asking user to confirm/autorize it automatically accepts, which is
not secure to be used thus a warning is printed when user selects it.
Usage:
[bluetoothctl]# agent auto
Warning: setting auto response is not secure, it bypass user
confirmation/authorization, it shall only be used for test automation.
or
client/bluetoothctl -a auto
Lokendra Singh [Fri, 18 Aug 2023 04:45:43 +0000 (10:15 +0530)]
monitor/intel: Add decoding of PPAG Enable command
Add decoding support for Intel PPAG Enable
command.
btmon log:
< HCI Command: Intel PPAG Enable (0x3f|0x020b) plen 4
Enable: 0x00000002 (China)
> HCI Event: Command Complete (0x0e) plen 4
Intel PPAG Enable (0x3f|0x020b) ncmd 1
Status: Success (0x00)
Pauli Virtanen [Sun, 20 Aug 2023 11:47:06 +0000 (14:47 +0300)]
adapter: wait for kernel exp features in adapter initialization
Things like BAP depend on ISO sockets being enabled in kernel. It is
possible the MGMT commands enabling experimental kernel features do not
complete, before BAP etc. initialization and probing starts, in which
case BAP will be mostly nonfunctional.
This was observed to occur always when running BlueZ in a Fedora VM,
requiring bluetoothd restart after every boot for BAP to work,
log containing lines in the order:
bluetoothd[981]: src/adapter.c:read_exp_features_complete()
6fbaf188-05e0-496a-9885-
d6ddfdb4e03e flags 0 action 1
bluetoothd[981]: src/adapter.c:read_info_complete() index 0 status 0x00
bluetoothd[981]: profiles/audio/bap.c:bap_probe() BAP requires ISO Socket which is not enabled
bluetoothd[981]: src/adapter.c:iso_socket_complete() ISO Socket successfully set
Fix by waiting in adapter initialization that all MGMT exp feature
requests are done, before proceeding to read adapter information.
Also fix canceling MGMT_OP_SET_EXP_FEATURE for ISO sockets.
Pauli Virtanen [Sat, 19 Aug 2023 13:31:23 +0000 (16:31 +0300)]
iso-tester: add test for ACL disconnect before ISO created
Simulate ACL being disconnected when connecting ISO, before LE Create
CIS got sent. The kernel shall indicate connection failure for the ISO
socket immediately when the ACL is gone, since connecting the ISO can no
longer proceed.
ISO Connect ACL Disconnect - Failure
Pauli Virtanen [Sat, 19 Aug 2023 13:31:22 +0000 (16:31 +0300)]
sco-tester: add test for ACL disconnect before SCO established
Simulate ACL being disconnected before SCO is established. Kernel shall
not crash.
eSCO ACL Disconnect - Failure
Link: https://lore.kernel.org/linux-bluetooth/00000000000013b93805fbbadc50@google.com/
Pauli Virtanen [Sat, 19 Aug 2023 13:31:21 +0000 (16:31 +0300)]
hciemu: Add hciemu_flush_client_events for ordering VHCI vs bthost
bthost commands execute with a delay because events may be sitting in
the socketpair queues. This makes it difficult to ensure, when writing
tests, that certain bthost commands have been handled, before any new
events from VHCI are processed.
To make event ordering possible, add a function that flushes client
bthost/btdev socketpair queues, before processing any new VHCI events.
This is done by pausing VHCI input processing until the kernel
socketpair queues are empty.
Pauli Virtanen [Sat, 19 Aug 2023 13:31:20 +0000 (16:31 +0300)]
vhci: Add function to pause processing input from vhci
Add function to pause (temporarily) reading data from vhci. This can be
used to synchronously pause handling of btdev commands from the kernel.
Luiz Augusto von Dentz [Thu, 17 Aug 2023 22:31:08 +0000 (15:31 -0700)]
device: Restart temporary timer while connecting
If the device is temporary restart its timer when attempt to connect to
it since it can interrupt the connection attempt prematurely while it
still scanning, etc.
Luiz Augusto von Dentz [Thu, 17 Aug 2023 22:27:24 +0000 (15:27 -0700)]
device: Don't attempt to set auto_connect for devices using RPAs
Device using private address cannot be programmed into the auto_connect
list without them being paired and its IRK being distributed otherwise
there is no way to resolve it address and the command will fail.
Luiz Augusto von Dentz [Thu, 17 Aug 2023 20:06:54 +0000 (13:06 -0700)]
profile: Remove probe_on_discover
The concept of probing not connected devices is already supported when
loading devices from storage, so drivers shall already be capabable of
handling such a thing as there are dedicated callbacks to indicate when
there is a new connection in the form of .accept callback.
Luiz Augusto von Dentz [Thu, 17 Aug 2023 20:11:09 +0000 (13:11 -0700)]
bap: Set auto_connect
Patch
2a4cf63f2152 has reset the flag back to false when it shouldn't
so this revert it to its original behavior.
Iulia Tanasescu [Thu, 17 Aug 2023 06:48:53 +0000 (09:48 +0300)]
iso-tester: Add test for bcast receiver defer setup
This adds the following test to validate defer setup support for the
Broadcast Receiver scenario:
ISO Broadcaster Receiver Defer - Success
Luiz Augusto von Dentz [Wed, 16 Aug 2023 22:28:41 +0000 (15:28 -0700)]
monitor: Detect LE-ACL connections
This enables LE-ACL connections to be detected by processing its events
otherwise they would be assumed to be BR-ACL. Also make sure that LE-ISO
address is set based on its ACL link.
Luiz Augusto von Dentz [Wed, 16 Aug 2023 21:34:34 +0000 (14:34 -0700)]
monitor: Fix not printing latency information with -r
When reading a log from file hci_devba may not work, also store link
information so assign_handle can use use the parent (ACL) destination.
Luiz Augusto von Dentz [Wed, 16 Aug 2023 00:11:02 +0000 (17:11 -0700)]
build: Fix make distcheck
This fixes the following errors:
make[2]: *** No rule to make target 'doc/test-runner.txt',
needed by 'distdir-am'. Stop.
make[1]: *** [Makefile:11708: distdir] Error 2
make: *** [Makefile:11784: dist] Error 2
Luiz Augusto von Dentz [Tue, 15 Aug 2023 22:15:03 +0000 (15:15 -0700)]
iso-tester: Add suspend tests
This adds the following test which attempt to trigger suspend code path
while ISO sockets are connecting or have been connected:
ISO Connect Suspend - Success
ISO Connected Suspend - Success
ISO Connect2 Suspend - Success
ISO Connected2 Suspend - Success
Luiz Augusto von Dentz [Mon, 14 Aug 2023 19:13:12 +0000 (12:13 -0700)]
doc/test-runner: Update documentation using rst format
This updates test-runner documentation with a few examples using rst
format.
Bart Philips [Wed, 9 Aug 2023 20:27:23 +0000 (22:27 +0200)]
shared/gatt-server: Fix not allowing valid attribute writes
The length check shall not consider the command header, just its
payload.
Luiz Augusto von Dentz [Wed, 9 Aug 2023 19:31:25 +0000 (12:31 -0700)]
device: Fix not probing drivers at startup
Patch
67a26abe53bf ("profile: Add probe_on_discover flag") introduced a
regression which prevents drivers to be properly loaded at startup since
at that point they are not connected when code shall testing if
the devide is temporary instead.
Gioele Barabucci [Wed, 9 Aug 2023 06:51:42 +0000 (08:51 +0200)]
configure.ac: Bump minimum D-Bus version to 1.10
D-Bus 1.10, released in 2015, is the first version that supports reading
policy files from `/usr/share/dbus-1` in addition to `/etc/dbus-1`.
The previous minimum version, 1.6, was released in 2012.
Luiz Augusto von Dentz [Tue, 8 Aug 2023 11:50:37 +0000 (14:50 +0300)]
profile: Add probe_on_discover flag
This adds probe_on_discover flag which indicates if profile needs to be
probed when the remote_uuid is discovered and changes device logic to
attempt to probe driver when a new UUID is discovered and
probe_on_discover is set.
Claudia Draghicescu [Tue, 8 Aug 2023 11:50:36 +0000 (14:50 +0300)]
adapter: Do not filter out broadcast advertiser
This allows a broadcast advertiser to be passed up to application,
if the adapter has the capability of being a Synchronized Receiver.
Luiz Augusto von Dentz [Tue, 8 Aug 2023 23:47:55 +0000 (16:47 -0700)]
eir: Add eir_get_service_data
This adds eir_get_service_data function which can be used to get a
specific service data.
Claudia Draghicescu [Tue, 8 Aug 2023 11:50:35 +0000 (14:50 +0300)]
btio: Add support for getsockopt(BT_ISO_BASE)
This adds the posibility for a broadcast sink to retrieve the
BASE information received from a source afeter a PA synchronization,
using the getsockopt(BT_ISO_BASE) function.
This needs the patch from bluetooth-next:
Bluetooth: ISO: Add support for periodic adv reports processing
Claudia Draghicescu [Tue, 8 Aug 2023 11:50:34 +0000 (14:50 +0300)]
client/player: Add broadcast sink endpoint
Added support for broadcast sink registration using the 0x1851 UUID.
Added support for remote endpoint creation when a broadcast source
is discovered.
Added support for creating a local endpoint when the broadcast sink
endpoint was registered from an external application (Pipewire).
To test this feature use the following commands:
[bluetooth]# endpoint.register
00001851-0000-1000-8000-
00805f9b34fb 0x06
[bluetooth]# scan on
[NEW] Endpoint /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX/pac_bcast0
[bluetooth]# endpoint.config
/org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX/pac_bcast0
/local/endpoint/ep0 16_2_1
Pauli Virtanen [Sat, 5 Aug 2023 12:29:07 +0000 (15:29 +0300)]
iso-tester: test busy CIG error does not drop existing connections
A second connection made with same CIG while the CIG is busy, shall not
disconnect the first already existing connection.
Add test for this:
ISO Connect2 Busy CIG 0x01 - Success/Invalid
This was the original intent of "ISO Connect2 CIG 0x01 -
Success/Invalid", but the busy check should not be made synchronously in
connect() (to maintain ordering with Remove CIG etc), but must be done
in hci_sync. So the test needs to check the error async and explictly
that the first conn is not dropped.
Pauli Virtanen [Sat, 5 Aug 2023 12:29:06 +0000 (15:29 +0300)]
btdev: fix CIG ID on Set CIG Parameters error response
Set CIG Parameters shall return correct CIG ID in Command_Complete also
when it errors.
Simon Mikuda [Sun, 6 Aug 2023 08:01:09 +0000 (10:01 +0200)]
a2dp: Expose "Key missing" error
This error is not expected and retries will likely end up with same error.
Simon Mikuda [Sun, 6 Aug 2023 08:01:08 +0000 (10:01 +0200)]
error: Add "Invalid exchange" mapping
This error is returned on this event:
> HCI Event: Auth Complete (0x06) plen 3
Status: PIN or Key Missing (0x06)
Handle: 11 Address: 00:00:00:00:00:00 (OUI 00-00-00)
Luiz Augusto von Dentz [Mon, 7 Aug 2023 21:45:34 +0000 (14:45 -0700)]
monitor: Plot RX information with -a/--analyze
This attempts to plot the RX information just as TX:
Found BR-ACL connection with handle 256
Address: XX:XX:XX:XX:XX:XX
RX packets: 60/60
RX Latency: 0-39040 msec (~20294 msec)
RX size: 6-344 octets (~34 octets)
RX speed: ~0 Kb/s
100 +-+------------------------------------------------------------------+
+| |
+| RX +-----+ |
+| |
+| |
+| |
| |
| |
10 +-| |
+| |
+| |
+| |
+| |
+| |
| |
| |
1 +-| + + + |
+| | | | |
++------------------------------------------------------------------+
+ + + + + + + + +
0 5000 10000 15000 20000 25000 30000 35000 40000
Latency (ms)
TX packets: 22548/22547
TX Latency: 3-73 msec (~11 msec)
TX size: 6-850 octets (~847 octets)
TX speed: ~568 Kb/s
Luiz Augusto von Dentz [Fri, 4 Aug 2023 21:51:54 +0000 (14:51 -0700)]
iso-tester: Fix test ISO Connect2 CIG 0x01 - Success/Invalid
This test shall succeed rather than fail as this appears to be a bug in
the kernel code preventing Set CIG Parameters to work properly when
there are concurrent tasks only one CIS is being programmed.
Pauli Virtanen [Tue, 1 Aug 2023 16:38:42 +0000 (19:38 +0300)]
iso-tester: add tests checking Remove CIG is emitted
Kernel should send LE Remove CIG after all CIS are shut down. Add tests
checking this, closing either immediately or after waiting connection to
complete.
ISO Defer Close - Success
ISO Connect Close - Success
ISO Defer Wait Close - Success
ISO Connect Wait Close - Success
Pauli Virtanen [Tue, 1 Aug 2023 16:38:41 +0000 (19:38 +0300)]
iso-tester: test with large CIS_ID and invalid CIG_ID/CIS_ID
Add test with a large CIS_ID and multiple CIS so it hits an error
condition in current kernels (which is why the AC configuration is
used).
Add tests for invalid configurations with bad or duplicate IDs, and for
trying to connect two CIS in same CIG without BT_DEFER_SETUP.
ISO QoS CIG 0xF0 - Invalid
ISO QoS CIS 0xF0 - Invalid
ISO Connect2 CIG 0x01 - Success/Invalid
ISO AC 6(ii) CIS 0xEF/auto - Success
ISO AC 6(ii) CIS 0xEF/0xEF - Invalid
Pauli Virtanen [Tue, 1 Aug 2023 16:38:40 +0000 (19:38 +0300)]
sco-tester: test local and remote disconnecting simultaneously
Demonstrate a kernel race condition when remote side disconnects at the
same time as local side tries to cancel the connection. I.e.
[controller] > HCI Synchronous Connect Complete
[controller] > HCI Disconnection Complete (from remote)
[user] shutdown(sco_socket)
[kernel] hci_conn_abort(SCO handle)
[kernel] > HCI Create Connection Cancel
[kernel] < HCI Synchronous Connect Complete
[kernel] < HCI Disconnect Complete
[controller] < HCI Create Connection Cancel
[controller] > HCI Command Status (Create Connection Cancel)
[kernel] < HCI Command Status (Create Connection Cancel)
and then we get BUG: KASAN: slab-use-after-free in hci_conn_failed when
hci_conn_abort tries to delete the same connection a second time.
This type of crash is probably not limited to the sequence here, but for
this one it was possible to get the timing right in the emulator.
Add a test that hits this in the emulator environment (pretty narrow
window to hit on real hardware):
eSCO Simultaneous Disconnect - Failure
Pauli Virtanen [Tue, 1 Aug 2023 16:38:39 +0000 (19:38 +0300)]
btdev: fix Command Status command opcodes for Setup Sync Conn
The command opcode should be the CMD, not EVT.
Pauli Virtanen [Tue, 1 Aug 2023 16:38:38 +0000 (19:38 +0300)]
btdev: check error conditions for HCI_Create_Connection_Cancel
Create Connection Cancel shall return Command Complete with error status
when there is no Create Connection that can be canceled. In these
cases, we should not send a (spurious) Connection Complete event.
Fix by keeping a list of pending Create Connection commands, and
returning command errors if there is none pending at the moment.
Luiz Augusto von Dentz [Tue, 1 Aug 2023 23:18:10 +0000 (16:18 -0700)]
monitor/analyze: Inline data to gnuplot
Instead of creating a separate file just to write the x:y axis inline
the data via gnuplot $data variable then use it to plot.
Luiz Augusto von Dentz [Tue, 1 Aug 2023 21:32:48 +0000 (14:32 -0700)]
monitor: Add connection tracking for SCO/ISO with -a/--analyze
This adds proper connection tracking to SCO/ISO connection by handling
the events that establishes them.
Luiz Augusto von Dentz [Mon, 31 Jul 2023 22:13:38 +0000 (15:13 -0700)]
monitor: Print channel latency information with -a/--analyze
This prints channel latency information and use gnuplot when using
-a/--analyze to plot a graph of channels:
Found TX L2CAP channel with CID 68
PSM 25
22490 packets
7-50 msec (~11 msec) TX Latency
850-850 octets TX packet size
~569 Kb/s TX transfer speed
10000 +-+----------------------------------------------------------------+
+| ++ |
+| || + Packets +-----+ |
+| + || | |
1000 +-| | || |+ ++ |
+| | || || || + |
+| | || || ||+ +| |
+| | || || ||| || ++ ++ |
100 +-| | || || ||| || || || + |
+| | || || ||| || || || ++| + + |
+| | || || ||| || || || ||| | | |
+| | || || ||| || || || ||| |+ +| + |
| | || || ||| || || || ||| || || |+ + |
10 +-| | || || ||| || || || ||| || || || |+ |
+| | || || ||| || || || ||| || || || || + |
+| +| || || ||| || || || ||| || || || ||+ ++ |+ ++ + |
| || || || ||| || || || ||| || || || ||| || || || | |
1 +-| || || || ||| || || || ||| || || || ||| || || || | + + |
++----------------------------------------------------------------+
+ + + + + + + + + +
5 10 15 20 25 30 35 40 45 50
Latency (ms)
Luiz Augusto von Dentz [Mon, 31 Jul 2023 21:01:09 +0000 (14:01 -0700)]
monitor/analyze: Use conn_pkt_tx on acl_pkt
This makes use of conn_pkt_tx also on acl_pkt like other connections.
Luiz Augusto von Dentz [Mon, 31 Jul 2023 18:26:19 +0000 (11:26 -0700)]
monitor: Add TX frame number and speed estimation
This adds the frame information while decoding:
> HCI Event: Number of Completed Packets (0x13) plen 5
Num handles: 1
Handle: 256 Address: XX:XX:XX:XX:XX:XX
Count: 1
#188: len 850 (755 Kb/s)
Latency: 9 msec (3-21 msec ~6 msec)
Channel: 68 [PSM 25 mode Basic (0x00)] {chan 4}
Channel Latency: 9 msec (7-21 msec ~9 msec)
Or the speed estimation while analyzing:
Found BR-ACL connection with handle 256
Address: XX:XX:XX:XX:XX:XX
60 RX packets
22548 TX packets
22547 TX completed packets
3-73 msec (~11 msec) TX Latency
6-850 octets (~847 octets) TX packet size
~568 Kb/s TX transfer speed
Luiz Augusto von Dentz [Mon, 24 Jul 2023 20:57:34 +0000 (13:57 -0700)]
gatt: Fix not establishing a socket for each device
AcquireWrite and AcquireNotify shall establish a socket pair for each
device connected otherwise the application cannot distinct the
operations of each client.
Fixes: https://github.com/bluez/bluez/issues/460