diff options
author | Sven Eden <yamakuzure@gmx.net> | 2018-08-29 17:55:22 +0200 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2018-08-29 18:02:35 +0200 |
commit | 564def2927f3ca556724d4777ce29bb59304f28c (patch) | |
tree | 521aa6f6e147234d42bccadb3e1c9662d603b2f3 | |
parent | 40f140beb3f640c0fa6674478f990d57d10704b4 (diff) |
Prep v239: Add support for suspend-then-hibernate to loginctl.
-rw-r--r-- | cb/elogind.cbp | 6 | ||||
-rw-r--r-- | src/login/eloginctl.c | 29 | ||||
-rw-r--r-- | src/login/eloginctl.h | 1 | ||||
-rw-r--r-- | src/login/loginctl.c | 3 |
4 files changed, 31 insertions, 8 deletions
diff --git a/cb/elogind.cbp b/cb/elogind.cbp index 1ace09eee..f612e9176 100644 --- a/cb/elogind.cbp +++ b/cb/elogind.cbp @@ -700,6 +700,10 @@ <Option target="all" /> <Option target="clean" /> </Unit> + <Unit filename="../src/login/70-power-switch.rules" /> + <Unit filename="../src/login/70-uaccess.rules" /> + <Unit filename="../src/login/71-seat.rules.in" /> + <Unit filename="../src/login/73-seat-late.rules.in" /> <Unit filename="../src/login/eloginctl.c"> <Option compilerVar="CC" /> </Unit> @@ -788,6 +792,8 @@ <Option target="all" /> <Option target="clean" /> </Unit> + <Unit filename="../src/login/org.freedesktop.login1.conf" /> + <Unit filename="../src/login/org.freedesktop.login1.policy" /> <Unit filename="../src/login/pam_elogind.c"> <Option compilerVar="CC" /> </Unit> diff --git a/src/login/eloginctl.c b/src/login/eloginctl.c index 111c770b5..644686ad2 100644 --- a/src/login/eloginctl.c +++ b/src/login/eloginctl.c @@ -48,13 +48,14 @@ static const struct { HandleAction action; const char* verb; } action_table[_ACTION_MAX] = { - [ACTION_HALT] = { HANDLE_HALT, "halt" }, - [ACTION_POWEROFF] = { HANDLE_POWEROFF, "poweroff", }, - [ACTION_REBOOT] = { HANDLE_REBOOT, "reboot", }, - [ACTION_KEXEC] = { HANDLE_KEXEC, "kexec", }, - [ACTION_SUSPEND] = { HANDLE_SUSPEND, "suspend", }, - [ACTION_HIBERNATE] = { HANDLE_HIBERNATE, "hibernate", }, - [ACTION_HYBRID_SLEEP] = { HANDLE_HYBRID_SLEEP, "hybrid-sleep" } + [ACTION_HALT] = { HANDLE_HALT, "halt" }, + [ACTION_POWEROFF] = { HANDLE_POWEROFF, "poweroff", }, + [ACTION_REBOOT] = { HANDLE_REBOOT, "reboot", }, + [ACTION_KEXEC] = { HANDLE_KEXEC, "kexec", }, + [ACTION_SUSPEND] = { HANDLE_SUSPEND, "suspend", }, + [ACTION_HIBERNATE] = { HANDLE_HIBERNATE, "hibernate", }, + [ACTION_HYBRID_SLEEP] = { HANDLE_HYBRID_SLEEP, "hybrid-sleep" }, + [ACTION_SUSPEND_THEN_HIBERNATE] = { HANDLE_SUSPEND_THEN_HIBERNATE, "suspend-then-hibernate" } /* ACTION_CANCEL_SHUTDOWN is handled differently */ }; @@ -262,6 +263,12 @@ static void elogind_log_special(enum elogind_action a) { "MESSAGE_ID=" SD_MESSAGE_SLEEP_START_STR, NULL); break; + case ACTION_SUSPEND_THEN_HIBERNATE: + log_struct(LOG_INFO, + LOG_MESSAGE("Suspend-Then-Hibernate action called."), + "MESSAGE_ID=" SD_MESSAGE_SLEEP_START_STR, + NULL); + break; case ACTION_CANCEL_SHUTDOWN: log_struct(LOG_INFO, LOG_MESSAGE("Cancel Shutdown called."), @@ -322,6 +329,11 @@ static int elogind_reboot(sd_bus *bus, enum elogind_action a) { description = "put system into hybrid sleep"; break; + case ACTION_SUSPEND_THEN_HIBERNATE: + method = "SuspendThenHibernate"; + description = "put system into suspend followed by hibernate"; + break; + default: return -EINVAL; } @@ -570,7 +582,8 @@ int start_special(int argc, char *argv[], void *userdata) { ACTION_REBOOT, ACTION_SUSPEND, ACTION_HIBERNATE, - ACTION_HYBRID_SLEEP)) { + ACTION_HYBRID_SLEEP, + ACTION_SUSPEND_THEN_HIBERNATE)) { if (arg_when > 0) return elogind_schedule_shutdown(bus, a); else diff --git a/src/login/eloginctl.h b/src/login/eloginctl.h index cf8ce8334..2c487a880 100644 --- a/src/login/eloginctl.h +++ b/src/login/eloginctl.h @@ -34,6 +34,7 @@ typedef enum elogind_action { ACTION_SUSPEND, ACTION_HIBERNATE, ACTION_HYBRID_SLEEP, + ACTION_SUSPEND_THEN_HIBERNATE, ACTION_CANCEL_SHUTDOWN, _ACTION_MAX } elogind_action; diff --git a/src/login/loginctl.c b/src/login/loginctl.c index 9eef701b0..f74094396 100644 --- a/src/login/loginctl.c +++ b/src/login/loginctl.c @@ -1402,6 +1402,8 @@ static int help(int argc, char *argv[], void *userdata) { " suspend Suspend the machine to memory\n" " hibernate Suspend the machine to disk\n" " hybrid-sleep Suspend the machine to memory and disk\n" + " suspend-then-hibernate Suspend the system, wake after a period of\n" + " time and put it into hibernate\n" #endif // 0 , program_invocation_short_name); @@ -1627,6 +1629,7 @@ static int loginctl_main(int argc, char *argv[], sd_bus *bus) { { "suspend", VERB_ANY, 1, 0, start_special }, { "hibernate", VERB_ANY, 1, 0, start_special }, { "hybrid-sleep", VERB_ANY, 1, 0, start_special }, + { "suspend-then-hibernate", VERB_ANY, 1, 0, start_special }, { "cancel-shutdown", VERB_ANY, 1, 0, start_special }, #endif // 1 {} |