forked from kexecboot/kexecboot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
evdevs.h
93 lines (79 loc) · 1.8 KB
/
evdevs.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
/*
* kexecboot - A kexec based bootloader
*
* Copyright (c) 2008-2011 Yuri Bushmelev <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program 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 General Public License for more details.
*
*/
#ifndef _HAVE_EVDEVS_H_
#define _HAVE_EVDEVS_H_
#include "util.h"
#include "config.h"
/* Menu/keyboard/TS actions */
enum actions_t {
A_ERROR = -1,
A_EXIT = 0,
A_NONE,
A_UP,
A_DOWN,
A_PARENTMENU,
A_SUBMENU,
A_REBOOT,
A_SHUTDOWN,
A_RESCAN,
A_DEBUG,
A_SELECT,
#ifdef USE_TIMEOUT
A_TIMEOUT,
#endif
#ifdef USE_NUMKEYS
A_KEY0,
A_KEY1,
A_KEY2,
A_KEY3,
A_KEY4,
A_KEY5,
A_KEY6,
A_KEY7,
A_KEY8,
A_KEY9,
#endif
A_DEVICES
};
typedef enum {
KX_IT_EVDEV,
KX_IT_TTY,
KX_IT_SOCKET
} kx_input_type;
typedef struct {
unsigned int size;
unsigned int count;
int *fds;
kx_input_type *fdtypes;
fd_set fdset;
int maxfd;
} kx_inputs;
/* Initialize inputs structure */
int inputs_init(kx_inputs *inputs, unsigned int size);
/* Cleanup inputs structure */
void inputs_clean(kx_inputs *inputs);
/* Add input */
int inputs_add_fd(kx_inputs *inputs, int fd, kx_input_type type);
/* Scan for possible inputs and open them */
int inputs_open(kx_inputs *inputs);
/* Close opened inputs */
void inputs_close(kx_inputs *inputs);
/* Prepare inputs for processing */
int inputs_preprocess(kx_inputs *inputs);
/* Read and process events */
enum actions_t inputs_process(kx_inputs *inputs);
#endif //_HAVE_EVDEVS_H_