diff options
author | Wez Furlong <wez@wezfurlong.org> | 2024-06-09 06:04:45 -0700 |
---|---|---|
committer | Wez Furlong <wez@wezfurlong.org> | 2024-06-09 06:07:53 -0700 |
commit | 9b18364dafd4d35095a9019ed37394ede449e7dc (patch) | |
tree | de51b851a4d125e52658ba8993cb0e50aaee6508 /src/mapping.rs | |
parent | a0e636635f0d8feb23ee377be7987ab34edec35e (diff) |
device_name can now be overridden by cli arguments
The device name is now optional in the config, and a `--device-name` CLI
parameter allows specifying the device name that will be used.
This allows using the same configuration file with multiple devices,
provided that the devices are known up front.
Note that you will need to spawn one evremap process per device
to remap multiple devices at the same time.
Thanks to @innovate-invent for making a first pass at this:
closes: https://github.com/wez/evremap/pull/59
refs: https://github.com/wez/evremap/issues/17
Diffstat (limited to 'src/mapping.rs')
-rw-r--r-- | src/mapping.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/mapping.rs b/src/mapping.rs index 6ffc274..0574273 100644 --- a/src/mapping.rs +++ b/src/mapping.rs @@ -7,7 +7,7 @@ use thiserror::Error; #[derive(Debug, Clone)] pub struct MappingConfig { - pub device_name: String, + pub device_name: Option<String>, pub phys: Option<String>, pub mappings: Vec<Mapping>, } @@ -114,7 +114,9 @@ impl Into<Mapping> for RemapConfig { #[derive(Debug, Deserialize)] struct ConfigFile { - device_name: String, + #[serde(default)] + device_name: Option<String>, + #[serde(default)] phys: Option<String>, |