mirror of
https://github.com/ivabus/speakersafetyd
synced 2024-11-22 16:25:06 +03:00
Move config files under apple/
Take the vendor from the DT compatible, since in principle other manufacturers could use this code too. Signed-off-by: Hector Martin <marcan@marcan.st>
This commit is contained in:
parent
c43b8b752b
commit
f33417573f
3 changed files with 7 additions and 4 deletions
11
src/main.rs
11
src/main.rs
|
@ -47,8 +47,6 @@ struct Options {
|
||||||
fn get_machine() -> String {
|
fn get_machine() -> String {
|
||||||
fs::read_to_string("/proc/device-tree/compatible")
|
fs::read_to_string("/proc/device-tree/compatible")
|
||||||
.expect("Could not read device tree compatible")
|
.expect("Could not read device tree compatible")
|
||||||
.strip_prefix("apple,")
|
|
||||||
.expect("Unexpected compatible format")
|
|
||||||
.split_once("\0")
|
.split_once("\0")
|
||||||
.expect("Unexpected compatible format")
|
.expect("Unexpected compatible format")
|
||||||
.0
|
.0
|
||||||
|
@ -97,9 +95,14 @@ fn main() {
|
||||||
});
|
});
|
||||||
info!("Config base: {:?}", config_path);
|
info!("Config base: {:?}", config_path);
|
||||||
|
|
||||||
let model: String = get_machine();
|
let machine: String = get_machine();
|
||||||
info!("Model: {}", model);
|
info!("Machine: {}", machine);
|
||||||
|
|
||||||
|
let (maker, model) = machine
|
||||||
|
.split_once(",")
|
||||||
|
.expect("Unexpected machine name format");
|
||||||
|
|
||||||
|
config_path.push(&maker);
|
||||||
config_path.push(&model);
|
config_path.push(&model);
|
||||||
config_path.set_extension("conf");
|
config_path.set_extension("conf");
|
||||||
info!("Config file: {:?}", config_path);
|
info!("Config file: {:?}", config_path);
|
||||||
|
|
Loading…
Reference in a new issue