Configure per-device locking with default set to true.
This commit is contained in:
parent
e4246dd62e
commit
ff582d864f
3 changed files with 49 additions and 9 deletions
|
@ -75,13 +75,12 @@ func (parser *ConfigParser) CreateVirtualDevices() map[string]*evdev.InputDevice
|
|||
}
|
||||
|
||||
// ConnectPhysicalDevices will create InputDevices corresponding to any registered
|
||||
// devices with type = physical. It will also attempt to acquire exclusive access
|
||||
// to those devices, to prevent the same inputs from being read on multiple devices.
|
||||
// devices with type = physical.
|
||||
//
|
||||
// This function assumes you have already called Parse() on the config directory.
|
||||
//
|
||||
// This function should only be called once.
|
||||
func (parser *ConfigParser) ConnectPhysicalDevices(lock bool) map[string]*evdev.InputDevice {
|
||||
func (parser *ConfigParser) ConnectPhysicalDevices() map[string]*evdev.InputDevice {
|
||||
deviceMap := make(map[string]*evdev.InputDevice)
|
||||
|
||||
for _, deviceConfig := range parser.config.Devices {
|
||||
|
@ -95,7 +94,8 @@ func (parser *ConfigParser) ConnectPhysicalDevices(lock bool) map[string]*evdev.
|
|||
continue
|
||||
}
|
||||
|
||||
if lock {
|
||||
if deviceConfig.Lock {
|
||||
logger.LogDebugf("Locking device '%s'", deviceConfig.DeviceName)
|
||||
err := device.Grab()
|
||||
if err != nil {
|
||||
logger.LogError(err, "Failed to grab device for exclusive access")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue