From b6bd76534fffb15c2c603b08d46f9f6660ac261a Mon Sep 17 00:00:00 2001 From: mofeng-git Date: Sun, 31 May 2026 13:46:56 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=20iConfiguration=20?= =?UTF-8?q?=E6=8F=8F=E8=BF=B0=E5=AD=97=E7=AC=A6=E4=B8=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/otg/manager.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/otg/manager.rs b/src/otg/manager.rs index 8f1679dc..4f8bd2f9 100644 --- a/src/otg/manager.rs +++ b/src/otg/manager.rs @@ -300,7 +300,10 @@ impl OtgGadgetManager { let strings_path = self.config_path.join("strings/0x409"); create_dir(&strings_path)?; - write_file(&strings_path.join("configuration"), "Config 1: HID + MSD")?; + write_file( + &strings_path.join("configuration"), + self.configuration_label(), + )?; write_file(&self.config_path.join("MaxPower"), "500")?; @@ -308,6 +311,18 @@ impl OtgGadgetManager { Ok(()) } + fn configuration_label(&self) -> &'static str { + if self + .functions + .iter() + .any(|func| func.name().starts_with("mass_storage.")) + { + "Config 1: HID + MSD" + } else { + "Config 1: HID" + } + } + pub fn gadget_path(&self) -> &PathBuf { &self.gadget_path }