Code cleanup and refactoring.

This commit is contained in:
Anna Rose Wiggins 2025-08-09 12:32:17 -04:00
parent 4b4930ebdc
commit a876dabe6e
3 changed files with 19 additions and 25 deletions

View file

@ -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 {