crossystem: read recovery switch status from chromeos_arm device

The kernel chromeos_arm platform device provides the recovery status
with the consideration of active polarity.
Thus make crossystem to read from chromeos_arm device first. If this
is not available, read directly from gpio pin status.

TEST=ran on kitty,
'crossystem recoverysw_cur' return 0 with recovery switch off
'crossystem recoverysw_cur' return 1 with recovery switch on

Change-Id: Ie20630d7d07aeadf24044cd3ffc495df7cdd8a4a
Signed-off-by: Ken Chang <>
Tested-by: Titan Lee <>
Reviewed-by: Hung-Te Lin <>
Reviewed-by: Randall Spangler <>
Commit-Queue: Titan Lee <>
(cherry picked from commit c93ddb60aae37fc06f614a1b79e6f3fee25b97c4)
Reviewed-by: Andrew Bresticker <>
diff --git a/host/arch/arm/lib/crossystem_arch.c b/host/arch/arm/lib/crossystem_arch.c
index 21e2169..b032ed3 100644
--- a/host/arch/arm/lib/crossystem_arch.c
+++ b/host/arch/arm/lib/crossystem_arch.c
@@ -524,6 +524,11 @@
     return VbGetVarGpio("developer-switch");
   } else if (!strcasecmp(name, "recoverysw_cur")) {
+    int value;
+    value = VbGetPlatformGpioStatus("recovery");
+    if (value != -1)
+      return value;
     return VbGetVarGpio("recovery-switch");
   } else if (!strcasecmp(name, "wpsw_cur")) {
     int value;