summaryrefslogtreecommitdiff
blob: e48b970c3191ab63d9c75407d2dd6725b3e39c2d (plain)
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
#ifndef RELABSD_INPUT_H
#define RELABSD_INPUT_H

#include <libevdev/libevdev.h>

#include "config.h"

struct relabsd_input
{
   struct libevdev * dev;
   int fd;
};

/*
 * Returns -1 on (fatal) error,
 *         0  on success.
 *
 * 'input' does not need to be initialized, as the function will to that for
 * you (on success).
 * On success, 'input' will need to be closed.
 */
int relabsd_input_open
(
   struct relabsd_input * const input,
   const struct relabsd_config * const conf
);

void relabsd_input_close (const struct relabsd_input * const input);

/*
 * Returns -1 on (warning) error,
 *         0 on successful read.
 *
 * The 'input_*' parameters do not need to be initialized, as the function will
 * do that for you (on success).
 * Requires 'input' to be open.
 */
int relabsd_input_read
(
   const struct relabsd_input * const input,
   unsigned int * const input_type,
   unsigned int * const input_code,
   int * const input_value
);

int relabsd_input_wait_for_next_event
(
   const struct relabsd_input * const input,
   const struct relabsd_config * const config
);

#endif