diff mbox series

[BlueZ,v1,1/2] client: Add command wake

Message ID 20241217181334.3243011-1-luiz.dentz@gmail.com (mailing list archive)
State Accepted
Commit c0fb6c067e48e1c867d2447a275253bea4d7ec40
Headers show
Series [BlueZ,v1,1/2] client: Add command wake | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/BuildEll success Build ELL PASS
tedd_an/BluezMake success Bluez Make PASS
tedd_an/MakeCheck success Bluez Make Check PASS
tedd_an/MakeDistcheck success Make Distcheck PASS
tedd_an/CheckValgrind success Check Valgrind PASS
tedd_an/CheckSmatch success CheckSparse PASS
tedd_an/bluezmakeextell success Make External ELL PASS
tedd_an/ScanBuild success Scan Build PASS

Commit Message

Luiz Augusto von Dentz Dec. 17, 2024, 6:13 p.m. UTC
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(+)

Comments

bluez.test.bot@gmail.com Dec. 17, 2024, 7:18 p.m. UTC | #1
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
patchwork-bot+bluetooth@kernel.org Dec. 18, 2024, 2:40 p.m. UTC | #2
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!
diff mbox series

Patch

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 },
 	{ } },
 };