-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.go
128 lines (120 loc) · 2.31 KB
/
init.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
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
package main
import (
"fmt"
)
// Set global values
var maxX int32 = 7679
var maxY int32 = 4319
var isLocked bool = false
var resolX int32
var resolY int32
var halfResolX int32
var halfResolY int32
var halfX, halfY int32
var calibrated bool
var devPath string
var isDebugMode bool
// Rotational direction strings for cases
const inv string = "inverted"
const norm string = "normal"
const left string = "left"
const right string = "right"
// Define multi-point touchstate and
// touch event match structures
type mpts struct {
tapCnt int32
isGesture bool
isDown [10]bool
X, Y [10]uint16
rotation string
}
type tevMatch struct {
Code, Type uint16
Ineq string
Value int32
}
// Declare states and event matches globally
var touchState mpts
var blankState mpts
//Initialize match events
var touchXEv = tevMatch{
Code: 53, Type: 3,
Ineq: "ge", Value: 0,
}
var touchYEv = tevMatch{
Code: 54, Type: 3,
Ineq: "ge", Value: 0,
}
var touchDnEv = tevMatch{
Code: 57, Type: 3,
Ineq: "ge", Value: 0,
}
var touchUpEv = tevMatch{
Code: 57, Type: 3,
Ineq: "eq", Value: -1,
}
var touchIsOvr1 = tevMatch{
Code: 47, Type: 3,
Ineq: "ge", Value: 1,
}
var touchIsOvr2 = tevMatch{
Code: 47, Type: 3,
Ineq: "ge", Value: 2,
}
var touchIs4 = tevMatch{
Code: 47, Type: 3,
Ineq: "eq", Value: 3,
}
var touchIs3 = tevMatch{
Code: 47, Type: 3,
Ineq: "eq", Value: 2,
}
var touchIs5 = tevMatch{
Code: 47, Type: 3,
Ineq: "eq", Value: 4,
}
var touchOvr3 = tevMatch{
Code: 47, Type: 3,
Ineq: "gt", Value: 2,
}
var touchOvr5 = tevMatch{
Code: 47, Type: 3,
Ineq: "gt", Value: 4,
}
var gestureStart = tevMatch{
Code: 330, Type: 1,
Ineq: "eq", Value: 1,
}
var gestureStop = tevMatch{
Code: 330, Type: 1,
Ineq: "eq", Value: 0,
}
var volDnPress = tevMatch{
Code: 114, Type: 1,
Ineq: "eq", Value: 1,
}
var volDnRelease = tevMatch{
Code: 114, Type: 1,
Ineq: "eq", Value: 0,
}
var volUpPress = tevMatch{
Code: 115, Type: 1,
Ineq: "eq", Value: 1,
}
var volUpRelease = tevMatch{
Code: 115, Type: 1,
Ineq: "eq", Value: 0,
}
//var lockMatch [8]tevMatch
func init() {
fmt.Printf("Initializing...")
// Build match array for screen lock/unlock
// for i := 0; i < 2; i++ {
// j := i*4
// lockMatch[j] = volUpRelease
// lockMatch[j+1] = volUpPress
// lockMatch[j+2] = volDnRelease
// lockMatch[j+3] = volDnPress
// }
// ^^deprecated
}