faft: Wrap the underlying EC flash write protect command
This CL wraps the underlying flash write protect command into a method.
It makes the write protect more easy to be used without knowing any detail
of the EC command.
BUG=chromium-os:35254
TEST=run_remote_tests.sh --board link --remote dut ECWriteProtect/control$
Change-Id: If36345c5741ed7be9a962fba25fab25b4f2121e9
Reviewed-on: https://gerrit.chromium.org/gerrit/36867
Reviewed-by: Vic Yang <victoryang@chromium.org>
Commit-Ready: Tom Wai-Hong Tam <waihong@chromium.org>
Tested-by: Tom Wai-Hong Tam <waihong@chromium.org>
diff --git a/server/cros/chrome_ec.py b/server/cros/chrome_ec.py
index cc7445f..8ce7c9d 100644
--- a/server/cros/chrome_ec.py
+++ b/server/cros/chrome_ec.py
@@ -166,3 +166,15 @@
raise error.TestError(
'The flag %s of EC reboot command is invalid.' % flag)
self.send_command("reboot %s" % flags)
+
+
+ def set_flash_write_protect(self, enable):
+ """Set the software write protect of EC flash.
+
+ Args:
+ enable: True to enable write protect, False to disable.
+ """
+ if enable:
+ self.send_command("flashwp enable")
+ else:
+ self.send_command("flashwp disable")