1
0
mirror of https://github.com/systemd/systemd synced 2025-12-29 12:24:45 +01:00

Compare commits

..

No commits in common. "8c8932a74151f2138c29d69413424cc6e3ba06a8" and "83f0ff1eda6ea995cd078d54ae5601370dbbd9d2" have entirely different histories.

3 changed files with 7 additions and 16 deletions

View File

@ -547,9 +547,7 @@ evdev:atkbd:dmi:bvn*:bvr*:bd*:svnHP*:pn*[sS][pP][eE][cC][tT][rR][eE]*x360Convert
# Spectre x360 13
evdev:atkbd:dmi:bvn*:bvr*:bd*:svnHP*:pnHPSpectrex360Convertible13*:*
# ENVY x360 13
evdev:atkbd:dmi:bvn*:bvr*:bd*:svnHP*:pnHPENVYx360Convertible13*:*
KEYBOARD_KEY_82=f20 # Microphone mute button, should be micmute
KEYBOARD_KEY_82=f20 # Fn+F12; Microphone mute button, should be micmute
# HP Elite x2 1013 G3
evdev:atkbd:dmi:bvn*:bvr*:svnHP*:pnHPElitex21013G3:*

View File

@ -56,10 +56,7 @@
<literal>pre</literal>, the second either
<literal>suspend</literal>, <literal>hibernate</literal>,
<literal>hybrid-sleep</literal>, or <literal>suspend-then-hibernate</literal>
depending on the chosen action. An environment variable called <literal>SYSTEMD_SLEEP_ACTION</literal>
will be set and contain the sleep action that is processing. This is primarily helpful for
<literal>suspend-then-hibernate</literal> where the value of the variable will be <literal>suspend</literal>, <literal>hibernate</literal>,
or <literal>suspend-after-failed-hibernate</literal> in cases where hibernation has failed.
depending on the chosen action.
Immediately after leaving system suspend and/or hibernation the
same executables are run, but the first argument is now
<literal>post</literal>. All executables in this directory are

View File

@ -169,7 +169,7 @@ static int lock_all_homes(void) {
return log_debug("Successfully requested locking of all home directories.");
}
static int execute(char **modes, char **states, const char *action) {
static int execute(char **modes, char **states) {
char *arguments[] = {
NULL,
(char*) "pre",
@ -211,10 +211,6 @@ static int execute(char **modes, char **states, const char *action) {
return log_error_errno(r, "Failed to write mode to /sys/power/disk: %m");;
}
r = setenv("SYSTEMD_SLEEP_ACTION", action, 1);
if (r != 0)
log_warning_errno(errno, "Error setting SYSTEMD_SLEEP_ACTION=%s: %m", action);
(void) execute_directories(dirs, DEFAULT_TIMEOUT_USEC, NULL, NULL, arguments, NULL, EXEC_DIR_PARALLEL | EXEC_DIR_IGNORE_ERRORS);
(void) lock_all_homes();
@ -262,7 +258,7 @@ static int execute_s2h(const SleepConfig *sleep_config) {
if (r < 0)
return log_error_errno(errno, "Error setting hibernate timer: %m");
r = execute(sleep_config->suspend_modes, sleep_config->suspend_states, "suspend");
r = execute(sleep_config->suspend_modes, sleep_config->suspend_states);
if (r < 0)
return r;
@ -278,11 +274,11 @@ static int execute_s2h(const SleepConfig *sleep_config) {
log_debug("Attempting to hibernate after waking from %s timer",
format_timespan(buf, sizeof(buf), sleep_config->hibernate_delay_sec, USEC_PER_SEC));
r = execute(sleep_config->hibernate_modes, sleep_config->hibernate_states, "hibernate");
r = execute(sleep_config->hibernate_modes, sleep_config->hibernate_states);
if (r < 0) {
log_notice_errno(r, "Couldn't hibernate, will try to suspend again: %m");
r = execute(sleep_config->suspend_modes, sleep_config->suspend_states, "suspend-after-failed-hibernate");
r = execute(sleep_config->suspend_modes, sleep_config->suspend_states);
if (r < 0)
return log_error_errno(r, "Could neither hibernate nor suspend, giving up: %m");
}
@ -391,7 +387,7 @@ static int run(int argc, char *argv[]) {
if (streq(arg_verb, "suspend-then-hibernate"))
return execute_s2h(sleep_config);
else
return execute(modes, states, arg_verb);
return execute(modes, states);
}
DEFINE_MAIN_FUNCTION(run);