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 }