servo: update serialname to ignore the control prefix
serialnames get special handling. Ignore the ccd_cr50. prefix, because
it doesn't matter.
ccd_cr50.serialname is still getting the MAIN serialname.
ccd_cr50.ccd_serialname should still return the ccd serialname.
BUG=none
BRANCH=none
TEST=ccd_cr50.ccd_serialname and ccd_cr50.serialname work.
Change-Id: Ie9e216aa78ebc935333b9c51e48ad9dbf5f7979e
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/hdctools/+/1757445
Reviewed-by: Namyoon Woo <namyoon@chromium.org>
diff --git a/servo/servo_server.py b/servo/servo_server.py
index f107dbc..24c7241 100755
--- a/servo/servo_server.py
+++ b/servo/servo_server.py
@@ -721,9 +721,13 @@
Returns:
A string containing the serial number or "unknown".
"""
+ # Remove the prefix from the serialname control. Serialnames are
+ # universal. It doesn't matter what the prefix is.
+ # The prefix is separated from the main control with '.'
+ name = name.split('.', 1)[-1]
+
if not name:
name = 'main'
-
try:
return self._serialnames[name]
except KeyError: