cutoff: Ignore the unexpected output from ectool battery

ectool battery has small chance to return Invalid data.
Ignore the error since it will recovery soon.

BUG=b:466280594
TEST=The factory_installer won't crash after the error log appears.

Change-Id: Ia28a0e3be81a014919e117fce5a4d991674cc2c4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/factory_installer/+/7319865
Auto-Submit: Chih-Yao Chuang <jasonchuang@google.com>
Reviewed-by: Yu-An Wang <wyuang@google.com>
Commit-Queue: Chih-Yao Chuang <jasonchuang@google.com>
Tested-by: Chih-Yao Chuang <jasonchuang@google.com>
diff --git a/rust/src/cutoff/mod.rs b/rust/src/cutoff/mod.rs
index ca187b2..0d026d0 100644
--- a/rust/src/cutoff/mod.rs
+++ b/rust/src/cutoff/mod.rs
@@ -233,7 +233,10 @@
     if !ectool_utils::get_battery_info(context)?.is_ac_connected {
         display_message("connect_ac", context)?;
     }
-    while !ectool_utils::get_battery_info(context)?.is_ac_connected {
+    while !ectool_utils::get_battery_info(context)
+        .map(|info| info.is_ac_connected)
+        .unwrap_or(false)
+    {
         sys_utils::sleep(0.5)?;
     }
     Ok(())
@@ -243,7 +246,10 @@
     if ectool_utils::get_battery_info(context)?.is_ac_connected {
         display_message("remove_ac", context)?;
     }
-    while ectool_utils::get_battery_info(context)?.is_ac_connected {
+    while ectool_utils::get_battery_info(context)
+        .map(|info| info.is_ac_connected)
+        .unwrap_or(true)
+    {
         sys_utils::sleep(0.5)?;
     }
     Ok(())
diff --git a/rust/src/utils/ectool_utils.rs b/rust/src/utils/ectool_utils.rs
index af98eab..2fdddb5 100644
--- a/rust/src/utils/ectool_utils.rs
+++ b/rust/src/utils/ectool_utils.rs
@@ -80,14 +80,17 @@
     let stdout = context.command("ectool").arg("battery").output()?.stdout();
     let mut re = Regex::new(r".*Design capacity:* *([0-9]+) mAh.*")?;
     let Some(design_capacity) = re.captures(&stdout) else {
+        eprintln!("Unexpected output from ectool battery: {}", stdout);
         anyhow::bail!("Design capacity not found.");
     };
     re = Regex::new(r".*Remaining capacity *([0-9]+) mAh.*")?;
     let Some(remaining_capacity) = re.captures(&stdout) else {
+        eprintln!("Unexpected output from ectool battery: {}", stdout);
         anyhow::bail!("Remaining capacity not found.");
     };
     re = Regex::new(r".*Present voltage *([0-9]+) mV.*")?;
     let Some(present_voltage) = re.captures(&stdout) else {
+        eprintln!("Unexpected output from ectool battery: {}", stdout);
         anyhow::bail!("Present voltage not found.");
     };
     Ok(BatteryInfo {