| 5204f17c |
bap: Move default qos to shared/bap
This moves the default BAP QoS structure to shared/bap, to be accessible
from other plugins without involving the BAP plugin. |
Iulia Tanasescu |
10 months ago |
4 files, +41, -41 |
| fd622a5b |
bap: Remove bap_get_session
This removes the bap_get_session API from the BAP plugin interface and
replaces the call inside BASS with the shared/bap API. |
Iulia Tanasescu |
10 months ago |
3 files, +1, -14 |
| 8f280aad |
shared/bap: Make bap_get_session public
This makes bap_get_session public, so that a reference to the bap session
can be obtained and processed from the BASS plugin, for the Broadcast
Assistant implementation.
In case a session is not found, this commit also adds a NULL check for
the new bap that is created, in case the provided db reference is NULL
and therefore a session fails to be added, to avoid any invalid memory
access. |
Iulia Tanasescu |
10 months ago |
2 files, +8, -3 |
| 4d3c721e |
storage: Add support for storing PreferredBearer
This adds support for storing PreferredBearer into device info file. |
Luiz Augusto von Dentz |
10 months ago |
2 files, +51, -17 |
| f2e7c8f9 |
client: Add support get/set PreferredBearer
This adds support for PreferredBearer which is printed with the likes of
info command:
bluetoothctl> info <addr>
...
PreferredBearer: last-seen
It also introduces a new command to get/set the PreferredBearer:
[bluetoothctl]> bearer --help
Get/Set preferred bearer
Usage:
bearer <dev> [last-seen/bredr/le]
[bluetoothctl]> bearer <addr>
PreferredBearer: last-seen
[bluetoothctl]> bearer <addr> le
bluetoothd: @ MGMT Command: Add Device (0x0033) plen 8
LE Address: <addr>
Action: Auto-connect remote device (0x02)
[CHG] Device <addr> PreferredBearer: le
Changing le succeeded
[bluetoothctl]> bearer <addr>
PreferredBearer: le
[bluetoothctl]> bearer <addr> bredr
bluetoothd: @ MGMT Command: Remove Device (0x0034) plen 7
LE Address: <addr>
[CHG] Device <addr> PreferredBearer: bredr
Changing bredr succeeded |
Luiz Augusto von Dentz |
10 months ago |
2 files, +44, -0 |
| 03240630 |
device: Add implementation of PreferredBearer
This adds initial implementation of PreferredBearer. |
Luiz Augusto von Dentz |
10 months ago |
1 file, +96, -3 |
| a22935f9 |
org.bluez.Device: Introduced PreferredBearer
This introduces PreferredBearer property which can be used to indicate
what bearer shall be connected first rather than just using last seen
bearer which may not work always since it seems some devices sometimes
advertises on LE bearer but expects connections over BR/EDR e.g:
https://github.com/bluez/bluez/issues/1092
Also with the introduction of LE Audio this might become even more of a
problem since most likely users would like to select which bearer to use
rather than using the last-seen policy. |
Luiz Augusto von Dentz |
10 months ago |
1 file, +28, -1 |
| 04cd5d2a |
btdev: Fix scan-build warnings
This fixes the following scan-build warnings:
emulator/btdev.c:1126:10: warning: Although the value stored to 'conn' is used in the enclosing expression, the value is never actually read from 'conn' [deadcode.DeadStores]
1126 | while ((conn = queue_find(dev->conns, match_handle,
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1127 | UINT_TO_PTR(handle))))
| ~~~~~~~~~~~~~~~~~~~~
emulator/btdev.c:1413:24: warning: Access to field 'link' results in a dereference of a null pointer (loaded from variable 'conn') [core.NullDereference]
1413 | pending_conn_del(dev, conn->link->dev);
| ^~~~~~~~~~
emulator/btdev.c:1535:13: warning: Access to field 'dev' results in a dereference of a null pointer (loaded from variable 'conn') [core.NullDereference]
1535 | send_event(conn->dev, BT_HCI_EVT_AUTH_COMPLETE, &ev, sizeof(ev));
| ^~~~~~~~~ |
Luiz Augusto von Dentz |
10 months ago |
1 file, +5, -5 |
| 26bc1c9c |
bass: Remove interface
This removes the BASS plugin interface, since plugins should not make
direct calls between each other, but use the shared files instead. |
Iulia Tanasescu |
10 months ago |
5 files, +1, -13 |
| 518d2a7a |
bass: Register broadcast code request callback
This updates BASS to register Broadcast Code request callback with
shared/bap instead of having a public API, to avoid making direct calls
between plugins. The registered handler will be called from the transport
plugin via shared/bap. |
Iulia Tanasescu |
10 months ago |
3 files, +21, -17 |
| 2ca6e521 |
shared/bap: Add APIs to register broadcast code callback
This adds support for registering Broadcast Code request callback with
shared/bap, to be called when a BAP Scan Delegator needs to receive the
Code from peer Broadcast Assistants. |
Iulia Tanasescu |
10 months ago |
2 files, +115, -0 |
| 9a32b614 |
obex: Add messages_get_message() implementation for MAP plugin
GET Message() operation should be supported for passing below PTS
testcases -
1.MAP/MSE/MMB/BV-12-C
Verify that the MSE can return an email message to the MCE.
2.MAP/MSE/MMB/BV-13-C
Verify that the MSE can return a a*n* SMS message in native format
to the MCE.
3.MAP/MSE/MMB/BV-14-C
Verify that the MSE can return a SMS message with text trans-coded
to UTF-8 to the MCE.
Currently get message operation is not implemented, hence above
testcases are failing.
Added code to send the complete bmessage in response to the get() request
for the requested message handle.
As per suggested in previous patch, mmap() is being used
for reading file. |
Amisha Jain |
10 months ago |
2 files, +52, -3 |
| 688f5ee8 |
doc: Fix typo in the copyright header |
Arkadiusz Bokowy |
10 months ago |
31 files, +32, -33 |
| b71c5327 |
configure.ac: check for stdio.h
This fixes a configure failure for readline.h with slibtoolize which
depends on HAVE_STDIO_H being defined. With GNU libtoolize this check is
implicit and with slibtoolize it will fail instead.
error: unknown type name 'FILE'
Since bluez depends on stdio.h itself there is no reason to not check
for it explicitly.
Gentoo-Issue: https://bugs.gentoo.org/950467 |
orbea |
10 months ago |
1 file, +1, -1 |
| 524fa22e |
client: Document connect/disconnect optional profile argument |
Arkadiusz Bokowy |
10 months ago |
1 file, +18, -3 |
| 2f48028a |
client: Support single profile connection/disconnection |
Arkadiusz Bokowy |
10 months ago |
1 file, +80, -13 |
| 7a09d207 |
uuid-helper: Add A2DP to the list of known profiles |
Arkadiusz Bokowy |
10 months ago |
1 file, +17, -15 |
| 8479c279 |
client: add input validation to main()
An error was found during fuzzing testing. When passing Unicode
characters to bluetoothctl the application crashes in dbus:
dbus[5324]: arguments to dbus_message_iter_append_basic() were
incorrect, assertion "_dbus_check_is_valid_utf8 (*string_p)"
failed in file .../dbus-message.c line 2765.
Check that all characters are written in utf8.
Fixes: https://github.com/bluez/bluez/issues/1118 |
Roman Smirnov |
10 months ago |
1 file, +16, -0 |
| 32e2e5a4 |
core: Report error in case of bt_name2string failure |
Arkadiusz Bokowy |
10 months ago |
2 files, +6, -0 |
| f77ed491 |
uuid-helper: Accept any 16-bit HEX value as a valid UUID
The bt_name2string() function restricts HEX values to the list of
predefined service names. This list is very limited, so loosing that
restriction will allow to pass any 16-bit HEX value as a profile to
D-Bus API calls like ConnectProfile or RegisterProfile. |
Arkadiusz Bokowy |
10 months ago |
1 file, +5, -7 |
| 71142431 |
sco-tester: add test for disconnecting SCO
Add test that checks that shutdown(sk) results to
HCI_Disconnection_Complete for the SCO handle:
SCO Disconnect - Success |
Pauli Virtanen |
10 months ago |
1 file, +80, -0 |
| 9efc138e |
shared/bap: Fix state transition of sink for disable operation
This fixes a regression introduced by 173045553c15
("bap: Fix not generating releasing state") where the Disable operation
no long caused the transition to QoS configured for Sink, as per ASCS spec
Table 3.2: ASE state machine transitions that state transition is
required. |
Luiz Augusto von Dentz |
10 months ago |
1 file, +3, -0 |
| 4130fe22 |
shared/bap: Fix not starting released operation
The release operation is intended to release CIS resources:
'Releases resources associated with an ASE, immediately decouples the
ASE from any previously coupled CIS, and tears down any CIS previously
established for the ASE for one or more ASEs.
Valid only if ASE_State field value = 0x01 (Codec Configured),
0x02 (QoS Configured), 0x03 (Enabling), 0x04 (Streaming), or 0x05
(Disabling).'
But as the stated in ASCS specification release can also be used with
the likes of Codec/QoS Configured which may not require the CIS to be
established and in that case released operation shall start
autonomously:
'The Released operation shall be initiated autonomously by the server
if:
The Release operation for an ASE has been completed and the server
controller has indicated that the underlying CIS for the ASE has been
torn down.' |
Luiz Augusto von Dentz |
10 months ago |
1 file, +18, -1 |
| 7f1fa3d7 |
shared/bap: Use a stack variable to notify releasing state
This remove memory allocation in stream_notify_release. |
Luiz Augusto von Dentz |
10 months ago |
1 file, +5, -10 |
| 8d1c5165 |
obex: Add null check for data pointer for PCE
Incase of legacy server, when the 'supported fetures bit' attribute
is NULL, Add the check to avoid any invalid memory access. |
Amisha Jain |
10 months ago |
1 file, +3, -0 |
| 5f901b53 |
org.bluez.Adapter: Fix DuplicateData default value
The default is false not true.
Fixes: https://github.com/bluez/bluez/issues/1113 |
Luiz Augusto von Dentz |
10 months ago |
1 file, +1, -1 |
| d68dc1fd |
bass: Register bis probe/remove callbacks
This removes the BASS add/remove stream APIs and uses shared/bap to
register BIS probe/remove callbacks instead, to avoid making direct
calls between plugins. |
Iulia Tanasescu |
10 months ago |
3 files, +20, -13 |
| f49953d9 |
bass: Create BASS session with Broadcasters
In the BASS plugin, BAP sessions created with scanned Broadcasters are
notified in the bap attached callback. This creates BASS data for these
devices as well, to internally keep information about the sessions. |
Iulia Tanasescu |
10 months ago |
1 file, +42, -0 |
| 4b4c9383 |
shared/bap: Add support to register bis callbacks
This adds support for registering BIS probe/remove calllbacks with
shared/bap. This is needed by the BAP Broadcast Assistant (BASS Client)
implementation, so that the BAP plugin can notify BISes discovered
after parsing the BASE to BASS, avoiding direct function calls
between plugins. |
Iulia Tanasescu |
10 months ago |
2 files, +124, -1 |
| f4617c53 |
adapter: Prepend the new added device to the adapter devices list
When the DUT is paired with a mobile phone using RPA multiple times,
multiple device contexts with the same bdaddr will be cached.
When we query the device context through bdaddr, we always get the
context at the head of adapter->devices, but its status is inactive.
Fixes: https://github.com/bluez/bluez/issues/1095 |
Ye He |
10 months ago |
1 file, +1, -1 |
| 17304555 |
bap: Fix not generating releasing state
CIS sink need caching the Codec Configured when releasing by Pixel,
state machine is releasing -> Codec. If streamming -> idle, CIS sink
was silent after resume music. |
Yang Li |
10 months ago |
1 file, +31, -12 |
| 4465c577 |
shared/gatt-db: Fix incorrect attribute type
As part of BLE GATT Fuzzing testcase,if application sends an invalid
ATT_FIND_BY_TYPE_VALUE_REQ with attribute type as CCC (UUID 0x2902).
However,this request is not valid for descriptors like CCC, as it is
specifically intended for discovering primary services with a given UUID.
When processed in find_by_type(),attempts to access attribute->value
without checking if attribute or attribute->value is NULL,
leading to a segmentation fault.
Added NULL pointer checks before accessing attribute values in multiple
functions to prevent potential crashes due to invalid memory access
Bluetoothd crash dump:
0 0x73fec87ae81e (/lib/x86_64-linux-gnu/libc.so.6+0x1ae81e)
1 0x73fec94942e9 in MemcmpInterceptorCommon(void*, int (*)
(void const*, void const*, unsigned long), void const*,
void const*, unsigned long)
../../../../src/libsanitizer/sanitizer_common/
sanitizer_common_interceptors.inc:881
2 0x73fec9494bc6 in __interceptor_memcmp ../../../../src/
libsanitizer/sanitizer_common
/sanitizer_common_interceptors.inc:892
3 0x73fec9494bc6 in __interceptor_memcmp ../../../../src/
libsanitizer/sanitizer_common
/sanitizer_common_interceptors.inc:887
4 0x5d5c290f2456 in find_by_type src/shared/gatt-db.c:1389
5 0x5d5c290ff855 in foreach_in_range src/shared/gatt-db.c:1549
6 0x5d5c29099752 in queue_foreach src/shared/queue.c:207
7 0x5d5c290fb085 in gatt_db_foreach_in_range src/shared/gatt-db.c:1593
8 0x5d5c290fb4ca in gatt_db_find_by_type_value src/shared/gatt-db.c:1434
9 0x5d5c290e1996 in find_by_type_val_cb src/shared/gatt-server.c:745
10 0x5d5c290c3083 in handle_notify src/shared/att.c:1015
11 0x5d5c290c3083 in can_read_data src/shared/att.c:1100
12 0x5d5c291867c1 in watch_callback src/shared/io-glib.c:157
13 0x73fec931bc43 in g_main_context_dispatch
(/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x55c43)
14 0x73fec93712b7 (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0xab2b7)
15 0x73fec931b2b2 in g_main_loop_run (/lib/x86_64-linux-gnu/
libglib-2.0.so.0+0x552b2)
16 0x5d5c29188518 in mainloop_run src/shared/mainloop-glib.c:66
17 0x5d5c29188e26 in mainloop_run_with_signal src/shared
/mainloop-notify.c:189
18 0x5d5c28d8c6ae in main src/main.c:1544
19 0x73fec8629d8f in __libc_start_call_main ../sysdeps/nptl/
libc_start_call_main.h:58
20 0x73fec8629e3f in __libc_start_main_impl ../csu/libc-start.c:392
21 0x5d5c28d8f4c4 in _start (/root/LE_Audio_Work/Bluez/bluez/
src/bluetoothd+0x6204c4) |
Sarveshwar Bajaj |
10 months ago |
1 file, +13, -0 |
| fc7be1e8 |
tools/avtest: Add AAC configuration
The tests A2DP/SNK/AVP/BI-01-C, A2DP/SNK/AVP/BI-02-C,
A2DP/SNK/AVP/BI-05-C and A2DP/SNK/AVP/BI-07-C expect the IUT to
provide an AAC configuration.
This can be used by adding '--aac' to the avtest command, e.g. for
A2DP/SNK/AVP/BI-01-C test:
tools/avtest --aac --reject setconf --reject-code 214 |
Frédéric Danis |
10 months ago |
1 file, +37, -12 |
| 41431caf |
doc: Add SupportedTypes property to MessageAccess1 |
Frédéric Danis |
10 months ago |
1 file, +30, -0 |
| 1c4f5276 |
obexd/client/map: Add SupportedTypes property to MessageAccess1
This lists the message types supported the remote MSE.
Possible values are: EMAIL, SMS_GSM, SMS_CDMA, MMS and IM.
Those values can be used as message type when sending a message
using PushMessage method. |
Frédéric Danis |
10 months ago |
1 file, +46, -1 |
| fefeb495 |
bass: Add checks for bap user data
This adds checks before parsing bt_bap user data in bap attached/detached,
to avoid accessing NULL pointers in case the user data has been cleared
or has not been set before attaching a BAP session. |
Iulia Tanasescu |
10 months ago |
1 file, +18, -5 |
| cfb233b4 |
bap: Do not set adapter as bt_bap user_data
In case of a BAP Broadcast Source session, it is not necessary to set the
adapter as bt_bap user data. Plus, setting it makes it confusing for
plugins to know the type of pointer to parse, distinguishing between
Broadcast Source sessions and other types of sessions that hold a service
reference as user data.
For a BAP Broadcast Source, the bt_bap user data can remain unset, since
the session is not associated with any remote device/service. |
Iulia Tanasescu |
10 months ago |
1 file, +0, -1 |
| 790a0c5d |
bap: Do not clear user_data before detaching bt_bap
After detaching a bt_bap session, each plugin that registered a bap
detached callback will be notified. The bt_bap user data should be
set when calling these callbacks, so the bt_bap session can be
matched to the associated service and the cleanup is handled
accordingly. |
Iulia Tanasescu |
10 months ago |
1 file, +1, -3 |
| 65fbc471 |
shared/vcp: fix setting volume back to current value
If there is a volume change request in flight, always update pending
volume. Otherwise, setting the value back to old value before
notification arrives, is wrongly ignored.
Fixes: e77884accdb2 ("shared/vcp: have only one volume change in flight at a time") |
Pauli Virtanen |
10 months ago |
1 file, +5, -5 |
| ea3f4047 |
a2dp: Remove Endpoints cache entries on device removal
When a device is removed, currently the endpoints and last used info
are kept in cache:
[General]
Name=Frederic's Phone
[Endpoints]
01=00:00:01:29f50235
02=00:02:01:80010484e200
LastUsed=01:02
This may prevent future connection, after a new pairing, to use the
best codec available. |
Frédéric Danis |
10 months ago |
1 file, +40, -0 |
| 3c62df13 |
bthost: Set advertising intervals to valid value
The range for LE advertising intervals shall be in range between 20 ms
and 10,485,759.375 ms. Requesting other value should result in the
unsupported feature or parameter value error code (0x11).
After the modification in fa4d477, the btdev emulator no longer accepts
uninitialized LE advertising intervals. To fix that, set the default LE
advertising interval to the lowest possible value - 20 ms - in order to
minimize tests delay cause by device discovery.
Also, this commit fixes the detection of the high duty cycle directed
connectable advertising and sets the advertising interval to 3 ms for
such cases in order to be complaint with the spec. |
Arkadiusz Bokowy |
10 months ago |
2 files, +9, -5 |
| fdbfe001 |
monitor: Fix crash due to negative max_len
While calculating the max_len for printing the packet details that can
come out negative, so this discards extra text if that happens otherwise
it can cause the following error:
Process terminating with default action of signal 6 (SIGABRT)
at 0x4A800F4: __pthread_kill_implementation (in /usr/lib64/libc.so.6)
by 0x4A26FDD: raise (in /usr/lib64/libc.so.6)
by 0x4A0E941: abort (in /usr/lib64/libc.so.6)
by 0x4A0F7A6: __libc_message_impl.cold (in /usr/lib64/libc.so.6)
by 0x4B0E3B8: __fortify_fail (in /usr/lib64/libc.so.6)
by 0x4B0DD53: __chk_fail (in /usr/lib64/libc.so.6)
by 0x4B0F544: __snprintf_chk (in /usr/lib64/libc.so.6)
by 0x11F3E6: snprintf (stdio2.h:68) |
Luiz Augusto von Dentz |
10 months ago |
1 file, +8, -0 |
| 264bf951 |
device: Clear pending_flags on error
If setting WakeAllowed, or the device privacy, fails, we may end up in a
situation where `pending_flags` is still set to some `DEVICE_FLAG_*`
values, for example from `device_set_wake_allowed()` or
`adapter_set_device_flags()`.
This can confuse further requests because they'll assume that there is
still a pending request in progress. |
Ludovico de Nittis |
11 months ago |
2 files, +2, -0 |
| af3d67d7 |
test-runner: Allow to use host CPU on demand
The "-cpu host" option for QEMU can not be enabled by default because
our CI system does not have a support for KVM. In order to allow to run
the test-runner on systems where binaries built on the host are not
compatible with QEMU CPU variant, the "--qemu-host-cpu" option will add
the "-cpu host" to the QEMU command line arguments. |
Arkadiusz Bokowy |
11 months ago |
1 file, +13, -3 |
| 4577f50e |
test-runner: Use host CPU when starting VM
When running test-runner on Ubuntu 24.04 with mainline kernel compiled
from Ubuntu default configuration with applied tester.config options,
the QEMU is not able to start the test-runner application due to illegal
instruction. Passing '-cpu host' fixes that issue.
> $ tools/test-runner -k linux/arch/x86/boot/bzImage -- tools/mgmt-tester
> Using QEMU binary /usr/bin/qemu-system-x86_64
> Using kernel image [...]/linux/arch/x86/boot/bzImage
> Found support for Virtual Machine eXtensions
> [...]
> [ 0.000000] Linux version 6.14.0-rc2+ (gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0 [...]
> [...]
> Running command tools/mgmt-tester
> New process 74 created
> Illegal instruction
> Process 74 exited with status 132
> [ 0.881239] reboot: Restarting system
> [ 0.881431] reboot: machine restart
Potential caveat:
In case when the KVM is not available on the host, the QEMU will not
start with the warning:
CPU model 'host' requires KVM or HVF |
Arkadiusz Bokowy |
11 months ago |
1 file, +1, -0 |
| 54210e02 |
test-runner: Do not use short-form of readonly option
qemu-system-x86_64: warning: short-form boolean option 'readonly' deprecated
Please use readonly=on instead |
Arkadiusz Bokowy |
11 months ago |
1 file, +1, -1 |
| 8e76a4d0 |
test-runner: Remove the "-nographic" option passed to QEMU
This option causes QEMU to redirect monitor and serial to the terminal,
but also it modifies the terminal settings and clears it before printing
anything. Such behavior might be annoying because it might clear some
warning messages printed before clearing the screen. Since test-runner
disables QEMU monitor and redirects serial to stdio in an explicit way,
the "-nographic" option can be dropped. |
Arkadiusz Bokowy |
11 months ago |
1 file, +0, -1 |
| 571bc32f |
test-runner: Increase amount of RAM available in VM
When using default kernel configuration from Ubuntu 24.04 patched with
the configuration from tester.config, the kernel image is too big to run
on 192M bytes of RAM. As a result the test-runner exits without any
message (because of the "quite" kernel command line option). |
Arkadiusz Bokowy |
11 months ago |
1 file, +1, -1 |
| f003b90d |
adapter: Emit PropertiesChanged signal for Connectable as well |
Vibhav Pant |
11 months ago |
1 file, +3, -0 |
| fa4d477a |
btdev: Broadcast EXT_ADV packets based on its interval
Real BLE devices transmit LE advertisement report packages in given
intervals (typically in range between 20 ms and 10.24 s). With current
kernel module Bluetooth stack implementation it is possible that the
first LE meta packet just after enabling scanning will be lost. It is
not an issue for real devices, because more advertisement reports will
be delivered later (in given interval time).
This patch changes optimistic implementation of sending only one LE
meta packets just after enabling scanning to sending LE meta packets
every minimal interval thus emulating what a real controller would do
and will work around the issue of dropping the very first LE meta packet
by the kernel. For direct advertising, the 10ms interval is used to
provide high duty cycle advertising. |
Arkadiusz Bokowy |
11 months ago |
1 file, +55, -66 |