3 Commits

Author SHA1 Message Date
eebd03bb4e change default config file name
All checks were successful
CI / build (amd64, usbmakroboard-amd64, linux_amd64) (pull_request) Successful in 1m9s
CI / build (arm64, usbmakroboard-arm64, linux_arm64) (pull_request) Successful in 4m23s
2025-12-27 13:05:47 +01:00
65bc8e9b18 docs: regarding config 2025-12-27 13:05:47 +01:00
6021ec89f5 feat: add default config path 2025-12-27 13:05:47 +01:00
2 changed files with 7 additions and 9 deletions

View File

@@ -12,7 +12,9 @@ For info that with "EVIOCGRAB" the keyboard events can be consumed exclusively b
## Configuration ## Configuration
The configuration can be The configuration can be provided by either specifying a config file path via the `-c` parameter. If no parameter is provided, the default config path under `$HOME/.config/usbMakroBoard.yaml` is used.
Find the config schema in [schemas/config.schema.json](./schemas/config.schema.json) as well as a default config in [config.yaml](./config.yaml).
## Allowing non-root access to the device ## Allowing non-root access to the device

View File

@@ -57,7 +57,7 @@ std::pair<int, int> mapKeyEventToRowColumn(int keyEventNumber, const std::unorde
std::string getConfigPathFromCliArguments(int argc, char *argv[]) std::string getConfigPathFromCliArguments(int argc, char *argv[])
{ {
std::string configPath = "config.yaml"; std::string configPath = "";
int opt; int opt;
while ((opt = getopt(argc, argv, "c:")) != -1) while ((opt = getopt(argc, argv, "c:")) != -1)
{ {
@@ -67,16 +67,12 @@ std::string getConfigPathFromCliArguments(int argc, char *argv[])
configPath = optarg; configPath = optarg;
break; break;
default: default:
std::cerr << "Usage: " << argv[0] << " [-c config_file_path]\n"; std::cout << "No config path provided. Using default config path: $HOME/.config/usbMakroBoard.yaml\n";
exit(EXIT_FAILURE); configPath = "$HOME/.config/usbMakroBoard.yaml";
} }
} }
return configPath;
}
YAML::Node loadConfig(const std::string &configPath) return configPath;
{
return YAML::LoadFile(configPath);
} }
int openDevice(const std::string &devicePath) int openDevice(const std::string &devicePath)