Build rules from config.
This commit is contained in:
parent
50474f9fb2
commit
428749a519
7 changed files with 186 additions and 106 deletions
27
internal/mappingrules/types.go
Normal file
27
internal/mappingrules/types.go
Normal file
|
@ -0,0 +1,27 @@
|
|||
package mappingrules
|
||||
|
||||
import "github.com/holoplot/go-evdev"
|
||||
|
||||
type MappingRule interface {
|
||||
MatchEvent(*evdev.InputDevice, *evdev.InputEvent) *evdev.InputEvent
|
||||
}
|
||||
|
||||
// A Simple Mapping Rule can map a button to a button or an axis to an axis.
|
||||
type SimpleMappingRule struct {
|
||||
Input RuleTarget
|
||||
Output RuleTarget
|
||||
}
|
||||
|
||||
// A Combo Mapping Rule can require multiple physical button presses for a single output button
|
||||
type ComboMappingRule struct {
|
||||
Inputs []RuleTarget
|
||||
Output RuleTarget
|
||||
State int
|
||||
}
|
||||
|
||||
type RuleTarget struct {
|
||||
Device *evdev.InputDevice
|
||||
Type evdev.EvType
|
||||
Code evdev.EvCode
|
||||
Inverted bool
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue