forked from g7/mce-plugin-libhybris
-
Notifications
You must be signed in to change notification settings - Fork 1
/
plugin-config.h
93 lines (76 loc) · 2.68 KB
/
plugin-config.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
/** @file plugin-config.h
*
* mce-plugin-libhybris - Libhybris plugin for Mode Control Entity
* <p>
* Copyright (C) 2017 Jolla Ltd.
* <p>
* @author Simo Piiroinen <[email protected]>
*
* mce-plugin-libhybris is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License.
*
* mce-plugin-libhybris 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-plugin-libhybris; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef PLUGIN_CONFIG_H_
# define PLUGIN_CONFIG_H_
# include "plugin-logging.h"
# include <stdbool.h>
# include <glib.h>
/* ========================================================================= *
* CONFIG
* ========================================================================= */
/** Configuration group for mce-plugin-libhybris related values */
#define MCE_CONF_LED_CONFIG_HYBRIS_GROUP "LEDConfigHybris"
/** Name of the LED backend to use */
#define MCE_CONF_LED_CONFIG_HYBRIS_BACKEND "BackEnd"
/** Optional enable/disable sw breathing setting */
#define MCE_CONF_LED_CONFIG_HYBRIS_BREATHING "QuirkBreathing"
gchar * plugin_config_get_string(const gchar *group, const gchar *key, const gchar *defaultval);
/** Inifile to object member mapping info */
typedef struct
{
/** Ini-file key */
const char *key;
/** Fallback value in case key is not defined */
const char *def;
/** Offset within object where to store string value */
off_t off;
} objconf_t;
/** Object configuration entry sentinel */
#define OBJCONF_STOP \
{\
.key = 0,\
}
/** Object configuration entry for file path
*
* For object->member matches /sys/dir/member
*/
#define OBJCONF_FILE(obj_,memb_,key_)\
{\
.key = #key_,\
.def = #memb_,\
.off = offsetof(obj_,memb_),\
}
/** Object configuration entry for file path
*
* For object->member does not match /sys/dir/member
*/
#define OBJCONF_FILE_EX(obj_,memb_,key_,def_)\
{\
.key = #key_,\
.def = def_,\
.off = offsetof(obj_,memb_),\
}
void objconf_init(const objconf_t *cfg, void *obj);
void objconf_quit(const objconf_t *cfg, void *obj);
bool objconf_parse(const objconf_t *cfg, void *obj, const char *chn);
#endif /* PLUGIN_CONFIG_H_ */