-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathnames.go
43 lines (39 loc) · 918 Bytes
/
names.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
package evdev
var EvCodeNameLookup = map[EvType]map[EvCode]string{
EV_SYN: SYNNames,
EV_KEY: KEYNames,
EV_REL: RELNames,
EV_ABS: ABSNames,
EV_MSC: MSCNames,
EV_SW: SWNames,
EV_LED: LEDNames,
EV_SND: SNDNames,
EV_REP: REPNames,
EV_FF: FFNames,
// EV_PWR:
// EV_FF_STATUS:
}
// TypeName returns the name of an EvType as string, or "UNKNOWN" if the type is not valid
func TypeName(t EvType) string {
name, ok := EVToString[t]
if ok {
return name
}
return "unknown"
}
// PropName returns the name of the given EvProp, or "UNKNOWN" if the property is not valid
func PropName(p EvProp) string {
name, ok := INPUTToString[p]
if ok {
return name
}
return "unknown"
}
// CodeName returns the name of an EvfCode in the given EvType, or "UNKNOWN" of the code is not valid.
func CodeName(t EvType, c EvCode) string {
name, ok := EvCodeNameLookup[t][c]
if !ok {
return "unknown"
}
return name
}