diff --git a/boot_diags/src/app.rs b/boot_diags/src/app.rs index bdbf32c..a047505 100644 --- a/boot_diags/src/app.rs +++ b/boot_diags/src/app.rs @@ -108,6 +108,25 @@ impl App { }) } + pub fn inject_driver(&mut self, index: usize) { + if let Some(driver) = self.clone.driver_list.get(index) { + if let Some(disk_index) = self.clone.disk_index_dest { + let disk_list = self.clone.disk_list.lock().unwrap(); + if let Some(disk) = disk_list.get(disk_index) { + if let Some(boot_index) = self.clone.part_index_boot { + if let Ok(task) = boot::inject_driver( + driver, + disk.get_part_letter(boot_index).as_str(), + &self.system32, + ) { + self.tasks.add(task); + } + } + } + } + } + } + pub fn next_mode(&mut self) -> Mode { match self.cur_mode { Mode::Home => Mode::ScanDisks, @@ -306,7 +325,7 @@ impl App { self.action_tx.send(Action::SetMode(new_mode))?; } } - Mode::BootDiags | Mode::BootSetup | Mode::InjectDrivers => { + Mode::BootDiags | Mode::BootSetup => { let new_mode = self.next_mode(); self.action_tx.send(Action::SetMode(new_mode))?; } @@ -316,6 +335,11 @@ impl App { Action::Render => self.render(tui)?, Action::ScanDisks => self.action_tx.send(Action::SetMode(Mode::ScanDisks))?, Action::Select(one, two) => match self.cur_mode { + Mode::InjectDrivers => { + if let Some(index) = one { + self.inject_driver(index); + } + } Mode::InstallDrivers => { if let Some(index) = one { if let Some(driver) = self.clone.driver_list.get(index).cloned() {