forked from bendahl/uinput
-
Notifications
You must be signed in to change notification settings - Fork 0
/
uinputdefs.go
62 lines (55 loc) · 1.09 KB
/
uinputdefs.go
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
package uinput
import "syscall"
// types needed from uinput.h
const (
uinputMaxNameSize = 80
uiDevCreate = 0x5501
uiDevDestroy = 0x5502
uiSetEvBit = 0x40045564
uiSetKeyBit = 0x40045565
uiSetRelBit = 0x40045566
uiSetAbsBit = 0x40045567
busUsb = 0x03
)
// input event codes as specified in input-event-codes.h
const (
evSyn = 0x00
evKey = 0x01
evRel = 0x02
evAbs = 0x03
relX = 0x0
relY = 0x1
absX = 0x0
absY = 0x1
synReport = 0
evBtnLeft = 0x110
evBtnRight = 0x111
)
const (
btnStateReleased = 0
btnStatePressed = 1
absSize = 64
)
type inputID struct {
Bustype uint16
Vendor uint16
Product uint16
Version uint16
}
// translated to go from uinput.h
type uinputUserDev struct {
Name [uinputMaxNameSize]byte
ID inputID
EffectsMax uint32
Absmax [absSize]int32
Absmin [absSize]int32
Absfuzz [absSize]int32
Absflat [absSize]int32
}
// translated to go from input.h
type inputEvent struct {
Time syscall.Timeval
Type uint16
Code uint16
Value int32
}