The manual
ginnOS
The reference: libc, the libraries and the kernel
Toggle main menu visibility
Loading...
Searching...
No Matches
input_event.h
Go to the documentation of this file.
1
#pragma once
2
3
/**
4
* @file input_event.h
5
* @brief the events of /dev/input (ABI).
6
*
7
* one event is 12 bytes: a time, a type, a code and a value. the types and
8
* codes are the ones of Linux (linux/input-event-codes.h), so ported
9
* programs know them. a group of events that belong together (a mouse
10
* moving in x and y, and a button) ends with EV_SYN / SYN_REPORT.
11
*
12
* libc has a copy in <sys/input.h>; the two must stay the same.
13
*/
14
15
#include "
common/stdint.h
"
16
17
typedef
struct
18
{
19
uint32_t
time_ms;
// milliseconds since boot
20
uint16_t
type;
// EV_
21
uint16_t
code;
// KEY_, BTN_, REL_ or ABS_
22
int32_t
value;
// keys: 1 down, 0 up, 2 repeat; REL: a change; ABS: a position
23
}
input_event_t
;
24
25
// event types
26
#define EV_SYN 0x00
27
#define EV_KEY 0x01
28
#define EV_REL 0x02
29
#define EV_ABS 0x03
30
31
// EV_SYN codes
32
#define SYN_REPORT 0
// the end of a group of events
33
#define SYN_DROPPED 3
// the reader was too slow: events were lost before this
34
35
// EV_REL codes
36
#define REL_X 0x00
37
#define REL_Y 0x01
// positive is down
38
#define REL_WHEEL 0x08
// positive is up (away from the user)
39
40
// EV_ABS codes: positions from 0 to INPUT_ABS_MAX across the screen
41
#define ABS_X 0x00
42
#define ABS_Y 0x01
43
#define INPUT_ABS_MAX 32767
44
45
// mouse buttons (EV_KEY)
46
#define BTN_LEFT 0x110
47
#define BTN_RIGHT 0x111
48
#define BTN_MIDDLE 0x112
49
50
// ioctl: while a reader holds the grab, key events go only to /dev/input,
51
// not to the text console (the compositor takes the keyboard). int arg: 1
52
// grab, 0 release. closing the reader releases it.
53
#define INPUT_IOC_GRAB 0x40044901u
stdint.h
uint32_t
unsigned int uint32_t
Definition
fb.h:17
uint16_t
unsigned short uint16_t
Definition
stdint.h:13
int32_t
int int32_t
Definition
stdint.h:14
input_event_t
Definition
input.h:19
src
kernel
input
input_event.h
Generated by
1.18.0