Code cleanup and refactoring.
This commit is contained in:
parent
4b4930ebdc
commit
a876dabe6e
3 changed files with 19 additions and 25 deletions
|
@ -8,13 +8,13 @@ import (
|
|||
"github.com/holoplot/go-evdev"
|
||||
)
|
||||
|
||||
// CreateVirtualDevices will register any configured devices with type = virtual
|
||||
// InitVirtualDevices will register any configured devices with type = virtual
|
||||
// using /dev/uinput, and return a map of those devices.
|
||||
//
|
||||
// This function assumes you have already called Parse() on the config directory.
|
||||
// This function assumes Parse() has been called.
|
||||
//
|
||||
// This function should only be called once, unless you want to create duplicate devices for some reason.
|
||||
func (parser *ConfigParser) CreateVirtualDevices() map[string]*evdev.InputDevice {
|
||||
// This function should only be called once, unless we want to create duplicate devices for some reason.
|
||||
func (parser *ConfigParser) InitVirtualDevices() map[string]*evdev.InputDevice {
|
||||
deviceMap := make(map[string]*evdev.InputDevice)
|
||||
|
||||
for _, deviceConfig := range parser.config.Devices {
|
||||
|
@ -76,13 +76,13 @@ func (parser *ConfigParser) CreateVirtualDevices() map[string]*evdev.InputDevice
|
|||
return deviceMap
|
||||
}
|
||||
|
||||
// ConnectPhysicalDevices will create InputDevices corresponding to any registered
|
||||
// InitPhysicalDevices will create InputDevices corresponding to any registered
|
||||
// devices with type = physical.
|
||||
//
|
||||
// This function assumes you have already called Parse() on the config directory.
|
||||
// This function assumes Parse() has been called.
|
||||
//
|
||||
// This function should only be called once.
|
||||
func (parser *ConfigParser) ConnectPhysicalDevices() map[string]*evdev.InputDevice {
|
||||
func (parser *ConfigParser) InitPhysicalDevices() map[string]*evdev.InputDevice {
|
||||
deviceMap := make(map[string]*evdev.InputDevice)
|
||||
|
||||
for _, deviceConfig := range parser.config.Devices {
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
// This would speed up rule matching by only checking relevant rules for a given input event.
|
||||
// We could take this further and make it a map[<struct of *inputdevice, type, and code>][]rule
|
||||
// For very large rule-bases this may be helpful for staying performant.
|
||||
func (parser *ConfigParser) BuildRules(pInputDevs map[string]*evdev.InputDevice, vInputDevs map[string]*evdev.InputDevice) []mappingrules.MappingRule {
|
||||
func (parser *ConfigParser) InitRules(pInputDevs map[string]*evdev.InputDevice, vInputDevs map[string]*evdev.InputDevice) []mappingrules.MappingRule {
|
||||
rules := make([]mappingrules.MappingRule, 0)
|
||||
modes := parser.GetModes()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue