| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
This adds experimental field to btd_adapter_driver so the plugin can
indicate drivers that depends on experimental to be enabled.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
discovery_filter_to_mgmt_cp() does not add discovery_filter.discoverable
to the created mgmt_cp_start_service_discovery struct.
Instead update_discovery_filter() separately checks
client->discovery_filter->discoverable for all clients.
This means that for discovery-filters which only have the discoverable
flag set, to put the adapter in discoverable mode while discovering,
the created mgmt_cp_start_service_discovery struct is empty.
This empty mgmt_cp_start_service_discovery struct then gets sent
to the kernel as part of a MGMT_OP_START_SERVICE_DISCOVERY msg
by start_discovery_timeout().
This use of an empty filter with MGMT_OP_START_SERVICE_DISCOVERY
causes some bluetooth devices to not get seen with some (most?)
Broadcom bluetooth adapters. This problem has been observed with
the following Broadcom models: BCM4343A0, BCM43430A1, BCM43341B0 .
On these models the following 2 devices were not being discovered
when starting a scan with a filter with just discoverable set
in the filter (as gnome-bluetooth does):
Device 09:02:01:03:0F:87 (public)
Name: Bluetooth 3.0 Keyboard
Alias: Bluetooth 3.0 Keyboard
Class: 0x00000540
Icon: input-keyboard
Paired: yes
Bonded: yes
Trusted: yes
Blocked: no
Connected: yes
WakeAllowed: yes
LegacyPairing: yes
UUID: Service Discovery Serve.. (00001000-0000-1000-8000-00805f9b34fb)
UUID: Human Interface Device... (00001124-0000-1000-8000-00805f9b34fb)
UUID: PnP Information (00001200-0000-1000-8000-00805f9b34fb)
Modalias: bluetooth:v05ACp022Cd011B
Device 00:60:D1:00:00:34 (public)
Name: Bluetooth Mouse
Alias: Bluetooth Mouse
Class: 0x00002580
Icon: input-mouse
Paired: yes
Bonded: yes
Trusted: yes
Blocked: no
Connected: yes
WakeAllowed: yes
LegacyPairing: no
UUID: Human Interface Device... (00001124-0000-1000-8000-00805f9b34fb)
UUID: PnP Information (00001200-0000-1000-8000-00805f9b34fb)
Modalias: usb:v0103p0204d001E
Since setting the discoverable flag on a filter only is a way to
automatically put the adapter in discoverable mode itself while
it is discovering; and since this does not any device filtering
at all; modify merge_discovery_filters() to treat discovery with
such filters as regular unfiltered discovery.
This results in start_discovery_timeout() starting regular
discovery through a MGMT_OP_START_DISCOVERY message and this
fixes these 2 example devices not getting discovered by the
mentioned Broadcom BT adapter models.
Link: https://gitlab.gnome.org/GNOME/gnome-bluetooth/-/merge_requests/163
Reviewed-by: Bastien Nocera <hadess@hadess.net>
|
|
|
|
|
| |
This checks if device is advertising an RSI and if so disregards if it
is not discoverable since other members can be.
|
|
|
|
|
| |
This adds the initial implementation of DeviceSet interface as
documented in doc/set-api.rst.
|
|
|
|
| |
Add function for checking adapter current settings.
|
|
|
|
|
|
|
|
|
|
| |
This introduces SecureConnections option to main.conf that can be used to
configure this on adapter initialization.
This is useful for:
- disable for adapters that have a problems with SecureConnections enabled
- if you want to disable CTKD (cross transport key derivation)
- add option to enable only SecureConnections
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This property should allow any program to show whether an adapter is in
the process of being turned on.
As turning on an adapter isn't instantaneous, it's important that the UI
reflects the transitional state of the adapter's power, and doesn't
assume the device is already turned on but not yet working, or still off
despite having requested for it to be turned on, in both cases making
the UI feel unresponsive.
This can also not be implemented in front-ends directly as, then,
the status of an adapter wouldn't be reflected correctly in the Settings
window if it's turned on in the system menu. Implementing it in the
front-ends would also preclude from having feedback about the state of
the adapter when bluetoothd is the one powering up the adapter after the
rfkill was unblocked.
See https://gitlab.gnome.org/GNOME/gnome-bluetooth/-/issues/121
and the original https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5773
|
|
|
|
|
|
| |
Instead of only replying to D-Bus requests with an error saying the
adapter is blocked, keep track of the rfkill being enabled or disabled
so we know the rfkill state of the adapter at all times.
|
|
|
|
|
| |
This adds btd_adapter_find_device_by_fd that lookup a device by a fd
socket destination address.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We set the pending settings flag when sending MGMT_SETTING_*
commands to the MGMT layer and clear them when receiving a
successful reply, but we don't clear them when receiving an error
reply. This might cause a setting to be stuck in pending state.
Therefore, also clear the pending flag when receiving error.
Furthermore, this patch also postpones setting the pending flag
until we queue the MGMT command in order to avoid setting it too
soon but we return early.
This was caught during power off test, where MGMT_OP_SET_POWERED
returns Authentication Failed because disconnection takes too long.
Future attempts to switch power will then be ignored.
< HCI Command: Disconnect (0x01|0x0006) plen 3 #17916 [hci0] 12.502908
Handle: 512
Reason: Remote Device Terminated due to Power Off (0x15)
> HCI Event: Command Status (0x0f) plen 4 #17917 [hci0] 12.503185
Disconnect (0x01|0x0006) ncmd 1
Status: Success (0x00)
@ MGMT Event: Command Status (0x0002) plen 3 {0x0001} [hci0] 14.519491
Set Powered (0x0005)
Status: Authentication Failed (0x05)
= bluetoothd: Failed to set mode: Authentication Failed (0x05) 14.520042
= bluetoothd: adapter /org/bluez/hci0 set power to 0 14.813533
> HCI Event: Disconnect Complete (0x05) plen 4 #17918 [hci0] 16.509043
Status: Success (0x00)
Handle: 512
Reason: Connection Timeout (0x08)
Reviewed-by: Sonny Sasaka <sonnysasaka@chromium.org>
|
|
|
|
| |
This makes sure the flags are supported before attempting to set it.
|
|
|
|
|
| |
This adds btd_ prefix to device_is_trusted so it can be used by
plugins.
|
|
|
|
|
| |
This adds support for setting ISO Socket experimental UUID which
enables the use of BTPROTO_ISO on the system.
|
|
|
|
|
|
|
|
|
|
|
| |
The existing code assumes that, if a device supports advertising monitor
offload, DEVICE_FOUND events can be ignored since the kernel will send
ADV_MONITOR_DEVICE_FOUND events instead. Unfortunately, these new events
were added in 5.18, but offload was added in 5.12. This patch adds a
check on the MGMT API version so we can process the older DEVICE_FOUND
events when the new events are not supported.
Fixes: https://github.com/bluez/bluez/issues/357
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
bt_uuid_t is defined as a byte array, so it can cause alignment errors
on some architectures, when the two 64 bit halves are treated as u64s.
This patch ensures proper alignment across all architectures.
Fixes:
src/adapter.c: In function ‘bt_uuid_hash’:
src/adapter.c:3617:8: error: cast increases required alignment of
target type [-Werror=cast-align]
val = (uint64_t *)&uuid_128.value.u128;
^
cc1: all warnings being treated as errors
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
[bluetooth]# connect 40:EF:4C:0C:11:F0
Attempting to connect to 40:EF:4C:0C:11:F0
[CHG] Device 40:EF:4C:0C:11:F0 Connected: yes
Connection successful
[CHG] Device 40:EF:4C:0C:11:F0 ServicesResolved: yes
[UFO]# remove 40:EF:4C:0C:11:F0
[CHG] Device 40:EF:4C:0C:11:F0 ServicesResolved: no
Device has been removed
[CHG] Device 40:EF:4C:0C:11:F0 Connected: no
[bluetooth]# info 40:EF:4C:0C:11:F0
Device 40:EF:4C:0C:11:F0 (public)
Name: UFO
Alias: UFO
Class: 0x00240418
Icon: audio-headphones
Paired: yes
Trusted: no
Blocked: no
Connected: no
LegacyPairing: no
UUID: Headset
UUID: Audio Sink
UUID: A/V Remote Control Target
UUID: A/V Remote Control
UUID: Handsfree
UUID: Phonebook Access Server
|
|
|
|
|
| |
This splits kernel experimental UUIDs from D-Bus Experimental interface
so they can be controlled indenpendetly.
|
|
|
|
|
| |
This adds connectable flag to state so it can be used to detect which is
the last seen connectable bearer.
|
|
|
|
|
|
|
|
| |
If device uses RPA it shall only enable wakeup if RPA Resolution has
been enabled otherwise it cannot be programmed in the acceptlist which
can cause suspend to fail.
Link: https://bugzilla.kernel.org/show_bug.cgi?id=215768
|
|
|
|
|
|
|
| |
When running as a systemd service the STATE_DIRECTORY environment
variable maybe set:
https://www.freedesktop.org/software/systemd/man/systemd.exec.html
|
|
|
|
|
|
| |
The test for `DISCOVERABLE` should be done with
`MGMT_SETTING_DISCOVERABLE` instead of `MGMT_OP_SET_DISCOVERABLE`.
Acked-by: Paul Menzel <pmenzel@molgen.mpg.de>
|
|
|
|
|
| |
If mode is set to BT_MODE_LE SDP protocol won't be operational so it is
useless to attempt to add records.
|
|
|
|
|
|
|
| |
mgmt_debug callback is used to print debug strings from mgmt instances
which includes the file and function names so using DBG would add yet
another set of file and function prefixes which makes the logs
confusing.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
This introduces MaxControllers which can be used to limit the number of
adapters exposed in the system.
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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]
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
| |
These files are not longer needed since this functionality has been
moved to gatt-db.{c,h}.
|
|
|
|
|
|
|
| |
When Remote Name Resolve ends with failure, record this occurrence and
prevent remote name resolving for the same device for some time.
Reviewed-by: Miao-chen Chou <mcchou@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch registers callback functions to receive the Advertisement
Monitor Device Found and Device Lost events. It also disables software
based filtering whenever controller offloading support is available.
Test performed:
- Verified by logs that the MSFT Monitor Device is received from the
controller and the bluetoothd is notified whenever the controller
starts/stops monitoring a device.
Reviewed-by: Miao-chen Chou <mcchou@google.com>
|
|
|
|
|
| |
This adds support for setting Device Privacy flag when enabled in
main.conf via Privacy = device,limited-device.
|
|
|
|
|
| |
The entry has been deprecated since 2014 and it's time to remove them
altogether.
|
|
|
|
|
|
|
|
|
| |
Introducing PeripheralLongTermKey group for storing LTK info to
replace the less inclusive term. Currently we still need to write/read
from both to ensure smooth transition, but later we should deprecate
the old term.
Reviewed-by: Sonny Sasaka <sonnysasaka@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When storing an IRK the storage file may not have been created yet
since that uses the device address which is likely changed to the
identity address causing the following trace:
Invalid read of size 8
at 0x196452: store_irk.constprop.0 (adapter.c:8679)
by 0x198C92: new_irk_callback (adapter.c:8737)
by 0x1CF6DC: queue_foreach (queue.c:207)
by 0x1D1394: process_notify (mgmt.c:308)
by 0x1D1394: can_read_data (mgmt.c:374)
by 0x1E0634: watch_callback (io-glib.c:157)
by 0x4954A9E: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.6600.8)
by 0x49A6A97: ??? (in /usr/lib64/libglib-2.0.so.0.6600.8)
by 0x4954162: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.6600.8)
by 0x1E0CD4: mainloop_run (mainloop-glib.c:66)
by 0x1E10B1: mainloop_run_with_signal (mainloop-notify.c:188)
by 0x12E3FC: main (main.c:1210)
Address 0x6534418 is 8 bytes inside a block of size 16 free'd
|
|
|
|
|
| |
This patch fixes the unchecked return value(CWE-252) issues reported by
the Coverity.
|
|
|
|
|
| |
If MGMT MTU cannot accomodate all the existing LTKs only send the ones
that fit in the MTU and leave the remaining as unpaired.
|
|
|
|
|
|
|
|
|
|
|
|
| |
BT core spec 5.3 promotes the usage of inclusive languages.
This CL replaces some terms with the more appropriate counterparts,
such as "central", "peripheral", "accept list", and "reject list".
Note that some suggestions come from
https://specificationrefs.bluetooth.com/language-mapping/Appropriate_Language_Mapping_Table.pdf
Also use "primary" to refer the global mgmt struct.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
|
|
|
|
|
|
|
|
| |
BT core spec 5.3 promotes the usage of inclusive languages.
This CL replaces some terms with the more appropriate counterparts,
such as "central", "peripheral", and "accept list".
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch clears any running Adv Monitor DeviceLost timers on bt power
down. It'll also invoke DeviceLost event if the device is already found
and is being tracked for the DeviceLost event.
Verified this by adding a monitor using bluetoothctl and confirming that
the DeviceLost event is getting triggered for already found device in
case of bt power down.
Reviewed-by: mcchou@google.com
|
|
|
|
|
|
| |
This enables codec offload experimental feature if its UUIDs has been
enabled by main.conf:Experimental or -E has been passed in the command
line.
|
|
|
|
|
|
| |
This allows the user to enable a subset of the experimental features to
be enabled instead of all of them and also change -E to work in the same
way so a list of UUIDs can also be given at the command line.
|
|
|
|
|
| |
This implements ExperimentalFeatures property which indicates the list
of UUIDs that represents the experimental features currently enabled.
|
|
|
|
|
| |
g_hash_table_destroy prints a warning when it is NULL so this checks if
adapter->allowed_uuid_set has actually been set.
|
|
|
|
| |
The action already indicates the value of btd_opts.experimental.
|
|
|
|
|
|
|
|
|
|
| |
This ensures any incoming profile connection will be blocked if its UUID
is not allowed by the following assumption:
1. Each system profile asks adapter authorization when seeing a incoming
connection.
2. Each external profile checks if its UUID is allowed by adapter when
seeing a incoming connection.
|
|
|
|
|
|
|
| |
This implements functions in src/adapter.c and src/device.c for
plugins setting a list of allowed services.
Reviewed-by: Miao-chen Chou <mcchou@chromium.org>
|