From f33417573f377304f2cc2f40028d95f36f231ba6 Mon Sep 17 00:00:00 2001 From: Hector Martin Date: Fri, 13 Oct 2023 13:35:38 +0900 Subject: [PATCH] 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 --- conf/{ => apple}/j314.conf | 0 conf/{ => apple}/j413.conf | 0 src/main.rs | 11 +++++++---- 3 files changed, 7 insertions(+), 4 deletions(-) rename conf/{ => apple}/j314.conf (100%) rename conf/{ => apple}/j413.conf (100%) diff --git a/conf/j314.conf b/conf/apple/j314.conf similarity index 100% rename from conf/j314.conf rename to conf/apple/j314.conf diff --git a/conf/j413.conf b/conf/apple/j413.conf similarity index 100% rename from conf/j413.conf rename to conf/apple/j413.conf diff --git a/src/main.rs b/src/main.rs index e463a2c..7f9b12d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -47,8 +47,6 @@ struct Options { fn get_machine() -> String { fs::read_to_string("/proc/device-tree/compatible") .expect("Could not read device tree compatible") - .strip_prefix("apple,") - .expect("Unexpected compatible format") .split_once("\0") .expect("Unexpected compatible format") .0 @@ -97,9 +95,14 @@ fn main() { }); info!("Config base: {:?}", config_path); - let model: String = get_machine(); - info!("Model: {}", model); + let machine: String = get_machine(); + info!("Machine: {}", machine); + let (maker, model) = machine + .split_once(",") + .expect("Unexpected machine name format"); + + config_path.push(&maker); config_path.push(&model); config_path.set_extension("conf"); info!("Config file: {:?}", config_path);