servo: micro + ccd on same instance (round 2).
Note:
This is a temporay hack as go/servoarch will provide the same
functionality, however in this case we need this double feature earlier.
Expect this to be gone with servoarch with the rest of postinit.
This change adds a new layer to postinit to allow for servo micro and
ccd on the same servo instance iff both micro and ccd are enumerated and
on the same v4 hub.
In that case, the servo micro is the main device, and all controls route
to it. However, ccd backed controls are also available behind the
ccd_cr50. prefix.
This is off by default and can be enabled by having --allow-dual-v4 in
the cmdline. To that effect the change adds that to the upstart script
used in the lab.
E.g.
dut-control cr50_devid // used servo micro to query the devid
dut-control ccd_cr50.cr50_devid // uses ccd to query the devid
BUG=None
TEST=manual testing
> passes labstation validation
> EC/AP/Cr50 console through micro work
> Cr50 console through ccd works
sudo servod -b atlas --allow-dual-v4
2019-07-15 09:22:15,736 - ServoDeviceWatchdog - INFO - Watchdog setup
for devices: set([(6353, 20507, 'C1709150019'), (6353, 20500,
u'16000062-935CD754'), (6353, 20506, u'SNCQ00098')])
// showing both micro and ccd got pulled in.
sudo servod -b atlas
2019-07-15 09:21:47,961 - ServoDeviceWatchdog - INFO - Watchdog setup
for devices: set([(6353, 20507, 'C1709150019'), (6353, 20506,
u'SNCQ00098')])
// showing only micro got pulled in.
TEST=sudo servod -b atlas // with v4 + micro
>> comes up fine
TEST=sudo servod -b atlas --allow-dual-v4 // with v4 + micro
>> comes up fine, dual role ignored
TEST=sudo servod -b atlas // with v4 + ccd
>> comes up fine
TEST=sudo servod -b atlas --allow-dual-v4 // with v4 + ccd
>> comes up fine, dual role ignored
TEST=sudo servod -b atlas // with v4 + micro + ccd
>> comes up fine
TEST=sudo servod -b atlas --allow-dual-v4 // with v4 + micro + ccd
>> comes up fine, dual role honored
Change-Id: I56aa10128565f6198f2c4c70ed09dd544b94c3a2
Signed-off-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1737187
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
diff --git a/servo/servo_server.py b/servo/servo_server.py
index 7057931..f107dbc 100755
--- a/servo/servo_server.py
+++ b/servo/servo_server.py
@@ -483,7 +483,22 @@
None if even the default is not defined.
"""
candidates = [self._version]
- candidates.extend(reversed(self._version.split('_with_')))
+ if '_with_' in self._version:
+ v4, raw_dut_device = self._version.split('_with_')
+ dut_devices = raw_dut_device.split('_and_')
+ # NOTE(coconutruben): all of this nonsense is going away with the new
+ # servod and is to bridge the time until then. Please forgive the below
+ # until then.
+ if '.' in control_name:
+ # In the current implementation, the only case where a '.' (a prefix)
+ # is in the control name is when there is a dual instance with micro and
+ # ccd on a v4.
+ dut_device = dut_devices[1]
+ else:
+ # In the normal control name, we need to make sure the version used
+ # does not include the potential _and_ portion from a dual instance.
+ dut_device = dut_devices[0]
+ candidates.extend([dut_device, v4])
candidates = ['%s_%s' % (c, param_key) for c in candidates]
candidates.append(param_key)
for c in candidates: