forked from g7/mce-plugin-libhybris
-
Notifications
You must be signed in to change notification settings - Fork 1
/
plugin-quirks.h
64 lines (54 loc) · 1.84 KB
/
plugin-quirks.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
/** @file plugin-quirks.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_QUIRKS_H_
# define PLUGIN_QUIRKS_H_
# include "plugin-logging.h"
/* ========================================================================= *
* QUIRKS
* ========================================================================= */
/** Quirk setting IDs */
typedef enum
{
/** Placeholder ID */
QUIRK_INVALID = -1,
/** Override sw breathing desicion made by led backend */
QUIRK_BREATHING,
/** Number of quirks */
QUIRK_COUNT
} quirk_t;
const char *quirk_name(quirk_t id);
int quirk_value(quirk_t id, int def);
/** Helper for caching quirk value locally and logging use for debug purposes
*/
#define QUIRK(id,def) ({\
static bool done = false;\
static int value = 0;\
if( !done ) {\
done = true;\
value = quirk_value((id),(def));\
mce_log(LOG_DEBUG, "use %s = %d",\
quirk_name((id)), value);\
}\
value;\
})
#endif /* PLUGIN_QUIRKS_H_ */