servo: add main device query functions

servo.py can now answer whether the main device on servod (the device
without any sort of prefix to their controls) is a ccd device or a
flex device. This is then used throughout the code-base where
previously the question was running-through-ccd.

BUG=chromium:1009616

Note: all tests below are done by adding three logging statements into
initialize_dut() and subsequently asseting False to speed debug.

TEST=sudo servod -b atlas // v2
     test_that --autotest_dir . $AIP power_Monitoring -b atlas

12:13:12 INFO | autoserv| TYPE: servo_v2
12:13:12 INFO | autoserv| IS FLEX: True
12:13:12 INFO | autoserv| IS CCD: False

TEST=sudo servod -b atlas // v4 (type-c) + ccd
     test_that --autotest_dir . $AIP power_Monitoring -b atlas

12:14:24 INFO | autoserv| TYPE: servo_v4_with_ccd_cr50
12:14:24 INFO | autoserv| IS FLEX: False
12:14:24 INFO | autoserv| IS CCD: True

TEST=sudo servod -b atlas // v4 (type-c) + micro
     test_that --autotest_dir . $AIP power_Monitoring -b atlas

12:15:59 INFO | autoserv| TYPE: servo_v4_with_servo_micro
12:15:59 INFO | autoserv| IS FLEX: True
12:15:59 INFO | autoserv| IS CCD: False

Change-Id: I79f2194d39d05c779b06499be0db2a4e4f2a5e01
Signed-off-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/1835912
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
diff --git a/server/cros/servo/servo.py b/server/cros/servo/servo.py
index 5f82cb3..a2da497 100644
--- a/server/cros/servo/servo.py
+++ b/server/cros/servo/servo.py
@@ -1059,12 +1059,16 @@
         self.set('active_v4_device', self.get_main_servo_device())
 
 
-    def running_through_ccd(self):
-        """Returns True if the setup is using ccd to run."""
+    def main_device_is_ccd(self):
+        """Whether the main servo device (no prefixes) is a ccd device."""
         servo = self._server.get_version()
         return 'ccd_cr50' in servo and 'servo_micro' not in servo
 
 
+    def main_device_is_flex(self):
+        """Whether the main servo device (no prefixes) is a legacy device."""
+        return not self.main_device_is_ccd()
+
     def _initialize_programmer(self, rw_only=False):
         """Initialize the firmware programmer.