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 fixes the following warnings:
profiles/audio/media.c:1465:6: warning: 8th function call argument
is an uninitialized value
if (media_endpoint_create(adapter, sender, path, uuid, delay_reporting,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
profiles/audio/media.c:3012:3: warning: Use of memory after it is freed
release_endpoint(adapter->endpoints->data);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
profiles/audio/media.c:3015:3: warning: Use of memory after it is freed
media_player_destroy(adapter->players->data);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This fixes the following error:
src/shared/shell.c:1135:19: warning: Null pointer passed to 1st
parameter expecting 'nonnull'
data.timeout = atoi(optarg);
^~~~~~~~~~~~
This fixes the following checkpatch warning:
WARNING:LINE_SPACING: Missing a blank line after declarations
216: FILE: client/player.c:625:
+ GDBusProxy *proxy = l->data;
+ print_player(proxy, NULL);
This was found by checkpatch in previous commit:
WARNING:SPACING: Unnecessary space before function pointer arguments
124: FILE: src/shared/bap.h:123:
+ int (*select) (struct bt_bap_pac *lpac, struct bt_bap_pac *rpac,
Do the same for (*config) and (*clear) for consistence.
This adds the remote endpoint path to the dictionary sent in
SelectProperties.
It allows audio application to know for which remote endpoint the call is
done and so for which it should act as an initiator.
Currently, the Links property is only sent after the first call to the
Acquire method, this cmay result in a rejection if a linked transport tries
to call the Acquire method before receiving the Links update.
Multiple transports can be linked when using LE Audio BAP.
In this case only one transport is used to Acquire the file descriptor
which will be shared by all linked transports.
In the same way, any transport can Release the file descriptor.
This adds SelectProperties which is a more extensible version of
SelectCapability since it takes a dictionary rather than a byte array
and define new Properties for LE Audio.
This allows application to return error codes in the range allowed by
the spec:
'GATT - Section 4.9.5:
Application Error 0x80 – 0x9F Application error code defined by a
higher layer specification.'
This usage of the _message as a completion function is invalid, and
will result in an error if invoked by _arguments when the user has a
format style set for completion messages.
We can just drop this message, since it is not necessary.
Before:
$ zstyle ':completion:*:messages' format '%d'
$ bluetoothctl connect <TAB>
_message:zformat:42: invalid argument: -J
After:
$ zstyle ':completion:*:messages' format '%d'
$ bluetoothctl connect <TAB>
31:41:59:26:53:59 -- Bose QuietComfort 35
11:22:33:44:55:66 -- Pixel 5
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 use of bthost_add_iso_hook to track when an ISO connection
has been disconnected and then set its handle to 0x0000 which is then
checked when the socket HUP to confirm the remote has properly
disconnected (e.g. received Disconnected Complete).
shutdown(SHUT_RDWR) results in socket being HUP immeditaly instead of
waiting for Disconnect Complete event so instead just use SHUT_WR to
start the disconnect procedure without causing the socket to HUP.
This fixes the following errors:
profiles/input/hog-lib.c:600:19: warning: Access to field 'handle'
results in a dereference of a null pointer (loaded from variable 'chr')
report->handle = chr->handle;
^~~~~~~~~~~
profiles/input/hog-lib.c:637:11: warning: Access to field 'value_handle'
results in a dereference of a null pointer (loaded from variable 'chr')
start = chr->value_handle + 1;
^~~~~~~~~~~~~~~~~
profiles/input/hog-lib.c:1240:11: warning: Access to field 'value_handle'
results in a dereference of a null pointer (loaded from variable 'chr')
start = chr->value_handle + 1;
^~~~~~~~~~~~~~~~~
Although HIDS spec is quite clear the Report MAP shall be limited to
512 bytes it doesn't seem OS do enforce that on the profile/client side
and since there isn't any qualification test enforcing it either there
are quite many devices which uses Report MAP bigger that 512 bytes
(e.g.: Brydge W-Touch and Lenovo Duet 3 BT Folio).
https://github.com/bluez/bluez/issues/377
This introduces a test that do use shutdown to disconnect an ISO socket
and then another one that attempts to reconnect it again to emulate
upper profile transitions.