/
powerkey.h
136 lines (101 loc) · 5.02 KB
/
powerkey.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/**
* @file powerkey.h
* Headers for the power key logic for the Mode Control Entity
* <p>
* Copyright © 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
* <p>
* @author David Weinehall <david.weinehall@nokia.com>
*
* mce is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License
* version 2.1 as published by the Free Software Foundation.
*
* mce is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with mce. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _POWERKEY_H_
#define _POWERKEY_H_
#include <glib.h>
/** Path to the GConf settings for the powerkey module */
# define MCE_GCONF_POWERKEY_PATH "/system/osso/dsm/powerkey"
/** Powerkey mode setting */
# define MCE_GCONF_POWERKEY_MODE MCE_GCONF_POWERKEY_PATH "/mode"
/** Powerkey blanking mode setting */
# define MCE_GCONF_POWERKEY_BLANKING_MODE MCE_GCONF_POWERKEY_PATH "/blanking_mode"
/** Powerkey press count for proximity sensor override */
# define MCE_GCONF_POWERKEY_PS_OVERRIDE_COUNT MCE_GCONF_POWERKEY_PATH "/ps_override_count"
/** Maximum delay between powerkey presses for ps override */
# define MCE_GCONF_POWERKEY_PS_OVERRIDE_TIMEOUT MCE_GCONF_POWERKEY_PATH "/ps_override_timeout"
/** Long press timeout setting */
# define MCE_GCONF_POWERKEY_LONG_PRESS_DELAY MCE_GCONF_POWERKEY_PATH "/long_press_delay"
/** Double press timeout setting */
# define MCE_GCONF_POWERKEY_DOUBLE_PRESS_DELAY MCE_GCONF_POWERKEY_PATH "/double_press_delay"
/** Setting for single press actions from display on */
# define MCE_GCONF_POWERKEY_ACTIONS_SINGLE_ON MCE_GCONF_POWERKEY_PATH "/actions_single_on"
/** Setting for double press actions from display on */
# define MCE_GCONF_POWERKEY_ACTIONS_DOUBLE_ON MCE_GCONF_POWERKEY_PATH "/actions_double_on"
/** Setting for long press actions from display on */
# define MCE_GCONF_POWERKEY_ACTIONS_LONG_ON MCE_GCONF_POWERKEY_PATH "/actions_long_on"
/** Setting for single press actions from display off */
# define MCE_GCONF_POWERKEY_ACTIONS_SINGLE_OFF MCE_GCONF_POWERKEY_PATH "/actions_single_off"
/** Setting for double press actions from display off */
# define MCE_GCONF_POWERKEY_ACTIONS_DOUBLE_OFF MCE_GCONF_POWERKEY_PATH "/actions_double_off"
/** Setting for long press actions from display off */
# define MCE_GCONF_POWERKEY_ACTIONS_LONG_OFF MCE_GCONF_POWERKEY_PATH "/actions_long_off"
/** Setting for D-Bus action #1 */
# define MCE_GCONF_POWERKEY_DBUS_ACTION1 MCE_GCONF_POWERKEY_PATH "/dbus_action1"
/** Setting for D-Bus action #2 */
# define MCE_GCONF_POWERKEY_DBUS_ACTION2 MCE_GCONF_POWERKEY_PATH "/dbus_action2"
/** Power key action enable modes */
typedef enum
{
/** Power key actions disabled */
PWRKEY_ENABLE_NEVER,
/** Power key actions always enabled */
PWRKEY_ENABLE_ALWAYS,
/** Power key actions enabled if PS is not covered */
PWRKEY_ENABLE_NO_PROXIMITY,
/** Power key actions enabled if PS is not covered or display is on */
PWRKEY_ENABLE_NO_PROXIMITY2,
PWRKEY_ENABLE_DEFAULT = PWRKEY_ENABLE_ALWAYS,
} pwrkey_enable_mode_t;
typedef enum
{
/** Pressing power key turns display off */
PWRKEY_BLANK_TO_OFF,
/** Pressing power key puts display to lpm state */
PWRKEY_BLANK_TO_LPM,
} pwrkey_blanking_mode_t;
/** Long delay for the [power] button in milliseconds */
#define DEFAULT_POWERKEY_LONG_DELAY 1500
/** Double press timeout for the [power] button in milliseconds */
#define DEFAULT_POWERKEY_DOUBLE_DELAY 400
/** Default actions for single press while display is on */
#define DEFAULT_POWERKEY_ACTIONS_SINGLE_ON "blank,tklock"
/** Default actions for double press while display is on */
#define DEFAULT_POWERKEY_ACTIONS_DOUBLE_ON "blank,tklock,devlock"
/** Default actions for long press while display is on */
#define DEFAULT_POWERKEY_ACTIONS_LONG_ON "shutdown"
/** Default actions for single press while display is off */
#define DEFAULT_POWERKEY_ACTIONS_SINGLE_OFF "unblank"
/** Default actions for double press while display is off */
#define DEFAULT_POWERKEY_ACTIONS_DOUBLE_OFF "unblank,tkunlock"
/** Default actions for long press while display is off
*
* Note: If kernel side reports immediately power key press + release
* when device is suspended, detecting long presses might not
* work when display is off -> leave unset by default. */
#define DEFAULT_POWERKEY_ACTIONS_LONG_OFF ""
/** Default argument for signal sent due to dbus1 action */
#define DEFAULT_POWERKEY_DBUS_ACTION1 "event1"
/** Default argument for signal sent due to dbus2 action */
#define DEFAULT_POWERKEY_DBUS_ACTION2 "event2"
/* When MCE is made modular, this will be handled differently */
gboolean mce_powerkey_init(void);
void mce_powerkey_exit(void);
#endif /* _POWERKEY_H_ */