Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1402192

[RFC PATCH 2/2] logind: Allow lid status remains "closed"

From Lv Zheng <lv.zheng@intel.com>
Newsgroups linux.kernel
Subject [RFC PATCH 2/2] logind: Allow lid status remains "closed"
Date 2016-05-17 10:30 +0200
Message-ID <rzIy6-28V-1@gated-at.bofh.it> (permalink)
References <rzIy6-28V-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


This patch adds an option to allow the lid status to remain closed.
However we are not systemd developers, and this patch may be wrong.
It's just a demo on how the issue can be addressed in systemd.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Cc: Bastien Nocera: <hadess@hadess.net>
---
Index: systemd/src/login/logind-gperf.gperf
===================================================================
--- systemd.orig/src/login/logind-gperf.gperf
+++ systemd/src/login/logind-gperf.gperf
@@ -29,6 +29,7 @@ Login.PowerKeyIgnoreInhibited,     confi
 Login.SuspendKeyIgnoreInhibited,   config_parse_bool,          0, offsetof(Manager, suspend_key_ignore_inhibited)
 Login.HibernateKeyIgnoreInhibited, config_parse_bool,          0, offsetof(Manager, hibernate_key_ignore_inhibited)
 Login.LidSwitchIgnoreInhibited,    config_parse_bool,          0, offsetof(Manager, lid_switch_ignore_inhibited)
+Login.LidSwitchLevelTriggered,     config_parse_bool,          0, offsetof(Manager, lid_switch_level_triggered)
 Login.HoldoffTimeoutSec,           config_parse_sec,           0, offsetof(Manager, holdoff_timeout_usec)
 Login.IdleAction,                  config_parse_handle_action, 0, offsetof(Manager, idle_action)
 Login.IdleActionSec,               config_parse_sec,           0, offsetof(Manager, idle_action_usec)
Index: systemd/src/login/logind.c
===================================================================
--- systemd.orig/src/login/logind.c
+++ systemd/src/login/logind.c
@@ -62,6 +62,7 @@ static Manager *manager_new(void) {
         m->handle_lid_switch = HANDLE_SUSPEND;
         m->handle_lid_switch_docked = HANDLE_IGNORE;
         m->lid_switch_ignore_inhibited = true;
+        m->lid_switch_level_triggered = true;
         m->holdoff_timeout_usec = 30 * USEC_PER_SEC;
 
         m->idle_action_usec = 30 * USEC_PER_MINUTE;
Index: systemd/src/login/logind.h
===================================================================
--- systemd.orig/src/login/logind.h
+++ systemd/src/login/logind.h
@@ -123,6 +123,7 @@ struct Manager {
         bool suspend_key_ignore_inhibited;
         bool hibernate_key_ignore_inhibited;
         bool lid_switch_ignore_inhibited;
+        bool lid_switch_level_triggered;
 
         bool remove_ipc;
 
Index: systemd/src/login/logind-button.c
===================================================================
--- systemd.orig/src/login/logind-button.c
+++ systemd/src/login/logind-button.c
@@ -123,6 +123,9 @@ static int button_install_check_event_so
         int r;
         assert(b);
 
+        if (!b->manager->lid_switch_level_triggered)
+                return 0;
+
         /* Install a post handler, so that we keep rechecking as long as the lid is closed. */
 
         if (b->check_event_source)

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[RFC PATCH 2/2] logind: Allow lid status remains "closed" Lv Zheng <lv.zheng@intel.com> - 2016-05-17 10:30 +0200

csiph-web