utils: Allow ectool temps all to show units

To reduce potential confusion, ectool temps all now includes
temperature unit. Adjust get_ec_temperatures to handle that.

BUG=chromium:783845
TEST=python
     >>> pattern = re.compile('.*: (\d+)')
     >>> line='0: 300'
     >>> matched = pattern.match(line)
     >>> int(matched.group(1)) - 273
     27
     >>> line='0: 300 K'
     >>> matched = pattern.match(line)
     >>> int(matched.group(1)) - 273
     27

Change-Id: Ia8bd34dbef18ccdc23d58729eb45b0ab4edd002b
Reviewed-on: https://chromium-review.googlesource.com/763578
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Wai-Hong Tam <waihong@google.com>
diff --git a/client/bin/utils.py b/client/bin/utils.py
index f82484f..b8acf16 100644
--- a/client/bin/utils.py
+++ b/client/bin/utils.py
@@ -1832,13 +1832,18 @@
 def get_ec_temperatures():
     """
     Uses ectool to return a list of all sensor temperatures in Celsius.
+
+    Output from ectool is either '0: 300' or '0: 300 K' (newer ectool
+    includes the unit).
     """
     temperatures = []
     try:
         full_cmd = 'ectool temps all'
         lines = utils.run(full_cmd, verbose=False).stdout.splitlines()
+        pattern = re.compile('.*: (\d+)')
         for line in lines:
-            temperature = int(line.split(': ')[1]) - 273
+            matched = pattern.match(line)
+            temperature = int(matched.group(1)) - 273
             temperatures.append(temperature)
     except Exception:
         logging.warning('Unable to read temperature sensors using ectool.')