* [PATCH BlueZ v1 1/2] client: Add command wake
@ 2024-12-17 18:13 Luiz Augusto von Dentz
2024-12-17 18:13 ` [PATCH BlueZ v1 2/2] device: Fix not being able to set WakeAllowed Luiz Augusto von Dentz
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2024-12-17 18:13 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This adds command wake which can be used to set WakeAllowed property:
[bluetoothctl]> wake XX:XX:XX:XX:XX:XX off
[bluetoothctl]> Changing wake off succeeded
[bluetoothctl]> [CHG] Device XX:XX:XX:XX:XX:XX WakeAllowed: no
[bluetoothctl]> wake XX:XX:XX:XX:XX:XX on
[bluetoothctl]> Changing wake on succeeded
[bluetoothctl]> [CHG] Device XX:XX:XX:XX:XX:XX WakeAllowed: yes
[bluetoothctl]> wake XX:XX:XX:XX:XX:XX
---
client/main.c | 38 ++++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/client/main.c b/client/main.c
index c4fc49427021..322326ab9b80 100644
--- a/client/main.c
+++ b/client/main.c
@@ -2050,6 +2050,42 @@ static void cmd_disconn(int argc, char *argv[])
proxy_address(proxy));
}
+static void cmd_wake(int argc, char *argv[])
+{
+ GDBusProxy *proxy;
+ dbus_bool_t value;
+ char *str;
+
+ proxy = find_device(argc, argv);
+ if (!proxy)
+ return bt_shell_noninteractive_quit(EXIT_FAILURE);
+
+ if (argc <= 2) {
+ print_property(proxy, "WakeAllowed");
+ return;
+ }
+
+ if (!strcasecmp(argv[2], "on")) {
+ value = TRUE;
+ } else if (!strcasecmp(argv[2], "off")) {
+ value = FALSE;
+ } else {
+ bt_shell_printf("Invalid value %s\n", argv[2]);
+ return bt_shell_noninteractive_quit(EXIT_FAILURE);
+ }
+
+ str = g_strdup_printf("wake %s", value == TRUE ? "on" : "off");
+
+ if (g_dbus_proxy_set_property_basic(proxy, "WakeAllowed",
+ DBUS_TYPE_BOOLEAN, &value,
+ generic_callback, str, g_free))
+ return;
+
+ g_free(str);
+
+ return bt_shell_noninteractive_quit(EXIT_FAILURE);
+}
+
static void cmd_list_attributes(int argc, char *argv[])
{
GDBusProxy *proxy;
@@ -3130,6 +3166,8 @@ static const struct bt_shell_menu main_menu = {
dev_generator },
{ "disconnect", "[dev]", cmd_disconn, "Disconnect device",
dev_generator },
+ { "wake", "[dev] [on/off]", cmd_wake, "Get/Set wake support",
+ dev_generator },
{ } },
};
--
2.47.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH BlueZ v1 2/2] device: Fix not being able to set WakeAllowed
2024-12-17 18:13 [PATCH BlueZ v1 1/2] client: Add command wake Luiz Augusto von Dentz
@ 2024-12-17 18:13 ` Luiz Augusto von Dentz
2024-12-17 19:18 ` [BlueZ,v1,1/2] client: Add command wake bluez.test.bot
2024-12-18 14:40 ` [PATCH BlueZ v1 1/2] " patchwork-bot+bluetooth
2 siblings, 0 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2024-12-17 18:13 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Setting WakeAllowed was not working as intended since
device_set_wake_override was changing the current_flags which
btd_device_flags_changed checks to determine if flags has been changed
to only then call device_set_wake_allowed_complete.
Fixes: https://github.com/bluez/bluez/issues/1045
---
src/device.c | 37 ++++++++++++++++++++++++++-----------
1 file changed, 26 insertions(+), 11 deletions(-)
diff --git a/src/device.c b/src/device.c
index 2d3ac71f6878..24ef3d77948f 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1515,13 +1515,21 @@ void device_set_wake_support(struct btd_device *device, bool wake_support)
device->wake_support = wake_support;
- /* If wake configuration has not been made yet, set the initial
- * configuration.
+ if (device->wake_support)
+ device->supported_flags |= DEVICE_FLAG_REMOTE_WAKEUP;
+ else
+ device->supported_flags &= ~DEVICE_FLAG_REMOTE_WAKEUP;
+
+ /* If there is not override set, set the default the same as
+ * support value.
*/
- if (device->wake_override == WAKE_FLAG_DEFAULT) {
+ if (device->wake_override == WAKE_FLAG_DEFAULT)
device_set_wake_override(device, wake_support);
- device_set_wake_allowed(device, wake_support, -1U);
- }
+
+ /* Set wake_allowed according to the override value. */
+ device_set_wake_allowed(device,
+ device->wake_override == WAKE_FLAG_ENABLED,
+ -1U);
}
static bool device_get_wake_allowed(struct btd_device *device)
@@ -1531,13 +1539,10 @@ static bool device_get_wake_allowed(struct btd_device *device)
void device_set_wake_override(struct btd_device *device, bool wake_override)
{
- if (wake_override) {
+ if (wake_override)
device->wake_override = WAKE_FLAG_ENABLED;
- device->current_flags |= DEVICE_FLAG_REMOTE_WAKEUP;
- } else {
+ else
device->wake_override = WAKE_FLAG_DISABLED;
- device->current_flags &= ~DEVICE_FLAG_REMOTE_WAKEUP;
- }
}
static void device_set_wake_allowed_complete(struct btd_device *device)
@@ -1563,6 +1568,12 @@ static void set_wake_allowed_complete(uint8_t status, uint16_t length,
if (status != MGMT_STATUS_SUCCESS) {
error("Set device flags return status: %s",
mgmt_errstr(status));
+ if (dev->wake_id != -1U) {
+ g_dbus_pending_property_error(dev->wake_id,
+ ERROR_INTERFACE ".Failed",
+ mgmt_errstr(status));
+ dev->wake_id = -1U;
+ }
return;
}
@@ -1583,8 +1594,11 @@ void device_set_wake_allowed(struct btd_device *device, bool wake_allowed,
* progress. Only update wake allowed if pending value doesn't match the
* new value.
*/
- if (wake_allowed == device->pending_wake_allowed)
+ if (device->wake_id != -1U && id != -1U) {
+ g_dbus_pending_property_error(id, ERROR_INTERFACE ".Busy",
+ "Property change in progress");
return;
+ }
device->wake_id = id;
device->pending_wake_allowed = wake_allowed;
@@ -4358,6 +4372,7 @@ static struct btd_device *device_new(struct btd_adapter *adapter,
device->tx_power = 127;
device->volume = -1;
+ device->wake_id = -1U;
device->db = gatt_db_new();
if (!device->db) {
--
2.47.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [BlueZ,v1,1/2] client: Add command wake
2024-12-17 18:13 [PATCH BlueZ v1 1/2] client: Add command wake Luiz Augusto von Dentz
2024-12-17 18:13 ` [PATCH BlueZ v1 2/2] device: Fix not being able to set WakeAllowed Luiz Augusto von Dentz
@ 2024-12-17 19:18 ` bluez.test.bot
2024-12-18 14:40 ` [PATCH BlueZ v1 1/2] " patchwork-bot+bluetooth
2 siblings, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2024-12-17 19:18 UTC (permalink / raw)
To: linux-bluetooth, luiz.dentz
[-- Attachment #1: Type: text/plain, Size: 1260 bytes --]
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=918786
---Test result---
Test Summary:
CheckPatch PENDING 0.22 seconds
GitLint PENDING 0.19 seconds
BuildEll PASS 20.44 seconds
BluezMake PASS 1576.00 seconds
MakeCheck PASS 12.89 seconds
MakeDistcheck PASS 158.77 seconds
CheckValgrind PASS 214.09 seconds
CheckSmatch PASS 273.04 seconds
bluezmakeextell PASS 99.11 seconds
IncrementalBuild PENDING 0.29 seconds
ScanBuild PASS 845.50 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH BlueZ v1 1/2] client: Add command wake
2024-12-17 18:13 [PATCH BlueZ v1 1/2] client: Add command wake Luiz Augusto von Dentz
2024-12-17 18:13 ` [PATCH BlueZ v1 2/2] device: Fix not being able to set WakeAllowed Luiz Augusto von Dentz
2024-12-17 19:18 ` [BlueZ,v1,1/2] client: Add command wake bluez.test.bot
@ 2024-12-18 14:40 ` patchwork-bot+bluetooth
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+bluetooth @ 2024-12-18 14:40 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
Hello:
This series was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Tue, 17 Dec 2024 13:13:33 -0500 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
>
> This adds command wake which can be used to set WakeAllowed property:
>
> [bluetoothctl]> wake XX:XX:XX:XX:XX:XX off
> [bluetoothctl]> Changing wake off succeeded
> [bluetoothctl]> [CHG] Device XX:XX:XX:XX:XX:XX WakeAllowed: no
> [bluetoothctl]> wake XX:XX:XX:XX:XX:XX on
> [bluetoothctl]> Changing wake on succeeded
> [bluetoothctl]> [CHG] Device XX:XX:XX:XX:XX:XX WakeAllowed: yes
> [bluetoothctl]> wake XX:XX:XX:XX:XX:XX
>
> [...]
Here is the summary with links:
- [BlueZ,v1,1/2] client: Add command wake
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=c0fb6c067e48
- [BlueZ,v1,2/2] device: Fix not being able to set WakeAllowed
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=dfb1ffdc95a0
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-12-18 14:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-17 18:13 [PATCH BlueZ v1 1/2] client: Add command wake Luiz Augusto von Dentz
2024-12-17 18:13 ` [PATCH BlueZ v1 2/2] device: Fix not being able to set WakeAllowed Luiz Augusto von Dentz
2024-12-17 19:18 ` [BlueZ,v1,1/2] client: Add command wake bluez.test.bot
2024-12-18 14:40 ` [PATCH BlueZ v1 1/2] " patchwork-bot+bluetooth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).