Support specifying physical devices via device file instead of device name. (#15)

Fixes https://codeberg.org/annabunches/joyful/issues/2

Reviewed-on: #15
Co-authored-by: Anna Rose Wiggins <annabunches@gmail.com>
Co-committed-by: Anna Rose Wiggins <annabunches@gmail.com>
This commit is contained in:
Anna Rose Wiggins 2025-08-05 20:02:45 +00:00 committed by Anna Rose Wiggins
parent 890c19f1dc
commit 329058b4b5
5 changed files with 64 additions and 10 deletions

View file

@ -19,7 +19,7 @@ type DeviceConfig struct {
Name string `yaml:"name"`
Type string `yaml:"type"`
DeviceName string `yaml:"device_name,omitempty"`
Uuid string `yaml:"uuid,omitempty"`
DevicePath string `yaml:"device_path,omitempty"`
Preset string `yaml:"preset,omitempty"`
NumButtons int `yaml:"num_buttons,omitempty"`
NumAxes int `yaml:"num_axes,omitempty"`
@ -64,7 +64,7 @@ func (dc *DeviceConfig) UnmarshalYAML(unmarshal func(data interface{}) error) er
Name string
Type string
DeviceName string `yaml:"device_name"`
Uuid string
DevicePath string `yaml:"device_path"`
Preset string
NumButtons int `yaml:"num_buttons"`
NumAxes int `yaml:"num_axes"`
@ -85,7 +85,7 @@ func (dc *DeviceConfig) UnmarshalYAML(unmarshal func(data interface{}) error) er
Name: raw.Name,
Type: raw.Type,
DeviceName: raw.DeviceName,
Uuid: raw.Uuid,
DevicePath: raw.DevicePath,
Preset: raw.Preset,
NumButtons: raw.NumButtons,
NumAxes: raw.NumAxes,