Lines Matching +full:- +full:- +full:host
3 # Use of this source code is governed by a BSD-style license that can be
37 Decorator to ignore ControlUnavailableError if servo host is not cros host.
43 def wrapper(self, host): argument
48 func(self, host)
50 if host.is_cros_host():
52 logging.warning("Servo host is not cros host, ignore %s: %s",
59 Verifier to trigger a servo host update, if necessary.
64 up-to-date.
68 def verify(self, host): argument
71 not host.get_dut_host_info()
72 or not host.get_dut_host_info().servo_cros_stable_version):
79 host.run('cgpt repair /dev/mmcblk0', ignore_status=True)
80 host.update_image()
88 def _is_applicable(self, host): argument
89 # Run only for servo_v3 host.
90 if host.is_labstation() or host.is_containerized_servod():
92 # Only run if the host is in the physical lab.
93 return host.is_in_lab()
97 return 'Servo_v3 host software is up-to-date'
101 """First start of servod on the host.
109 def verify(self, host): argument
112 host.restart_servod(quick_startup=True)
125 def verify(self, host): argument
127 topology = host.get_topology()
128 topology.read(host.get_dut_host_info())
132 if host.is_containerized_servod():
133 host.restart_servod()
137 host.request_reboot()
149 if device.get_serial_number() != host.servo_serial:
157 def _is_applicable(self, host): argument
158 if host.is_containerized_servod():
161 if not host.is_labstation():
164 # Only run if the host is in the physical lab.
165 return host.is_in_lab()
178 def verify(self, host): argument
181 present = host.is_servo_board_present_on_servo_v3()
189 def _is_applicable(self, host): argument
190 if host.is_containerized_servod():
194 if host.is_labstation():
197 # Only run if the host is in the physical lab.
198 return host.is_in_lab()
206 """Verifier to check is a servo fw is up-to-date."""
209 def verify(self, host): argument
211 if servo_updater.any_servo_needs_firmware_update(host):
215 # Do not fail as it will trigger re-flash fw on the servo
218 ' Please file a bug agains Fleet Automation team (go/fleet-bug)'
221 def _is_applicable(self, host): argument
222 if host.is_containerized_servod():
226 if not host.is_labstation():
229 # Only run if the host is in the physical lab.
230 return host.is_in_lab()
234 return 'Servo fw is up-to-date'
246 def _get_config_val(host, config_file, attr): argument
248 Get the `attr` for `host` from `config_file`.
250 @param host Host to be checked for `config_file`.
257 getboard = ('CONFIG=%s ; [ -f $CONFIG ] && '
259 attr_val = host.run(getboard, ignore_status=True).stdout
263 def _validate_attr(host, val, expected_val, attr, config_file): argument
265 Check that the attr setting is valid for the host.
274 @param host Host to be checked for `config_file`.
289 def _get_config(self, host): argument
293 @param host Host object.
297 return '%s_%d' % (self.CONFIG_FILE, host.servo_port)
312 def verify(self, host): argument
314 Test whether the `host` has a `SERIAL` setting configured.
323 if not host.is_cros_host():
327 if host.servo_serial is None:
329 config = self._get_config(host)
330 serialval = self._get_config_val(host, config, self.ATTR)
334 % host.servo_serial
337 self._validate_attr(host, serialval, host.servo_serial, self.ATTR,
350 def verify(self, host): argument
352 Test whether the `host` has a `BOARD` setting configured.
363 if not host.is_cros_host():
365 config = self._get_config(host)
366 boardval = self._get_config_val(host, config, self.ATTR)
369 if host.servo_board is not None:
370 msg += '; should be %s' % host.servo_board
373 self._validate_attr(host, boardval, host.servo_board, self.ATTR,
383 def verify(self, host): argument
384 if not host.is_cros_host():
386 status_cmd = 'status servod PORT=%d' % host.servo_port
387 job_status = host.run(status_cmd, ignore_status=True).stdout
391 (host.hostname, host.servo_port))
403 SERVOD_INITIALIZED = 'servodtool instance wait-for-active -p %d --timeout 60'
404 SERVOD_RESPONSIVE = 'dut-control -p %d serialname'
407 def verify(self, host): argument
408 self._verify_servod_initialized(host)
409 self._verify_servod_responsive(host)
411 def _verify_servod_initialized(self, host): argument
413 cmd = self.SERVOD_INITIALIZED % host.servo_port
414 res = host.run(cmd, ignore_status=True, timeout=120)
420 def _verify_servod_responsive(self, host): argument
422 cmd = self.SERVOD_RESPONSIVE % host.servo_port
423 res = host.run(cmd, ignore_status=True, timeout=120)
426 'Servod is not responsive for dut-control commands')
431 return 'Servod is running and responsive to dut-control run.'
440 def verify(self, host): argument
442 host.check_diskspace('/mnt/stateful_partition', 0.5)
448 def _is_applicable(self, host): argument
449 if host.is_containerized_servod():
465 def verify(self, host): argument
466 host.initialize_servo()
478 method call. As a side-effect, all servo signals are initialized to
487 def verify(self, host): argument
489 host.initialize_dut_for_servo()
515 def verify(self, host): argument
518 if host.get_servo().has_control(command):
520 host.get_servo().get(command)
526 def _is_applicable(self, host): argument
529 return host.get_servo() and host.get_servo().main_device_uses_gsc_drv()
543 open. (go/ccd-setup)
547 def verify(self, host): argument
548 if not host.get_servo().has_control('cr50_testlab'):
551 'ccd_*/type-c connection')
553 status = host.get_servo().get('cr50_testlab')
558 if host.get_servo().main_device_uses_gsc_drv():
559 host.get_servo().set_nocheck('cr50_testlab', 'open')
564 'to enable it (go/ccd-setup).')
566 def _is_applicable(self, host): argument
569 return host.get_servo() and host.get_servo().main_device_is_ccd()
580 src -- servo in power delivery mode and passes power to the DUT.
581 snk -- servo in normal mode and not passes power to DUT.
585 def verify(self, host): argument
586 if host.get_servo():
587 self._printControl(host.get_servo(), 'ppdut5_mv')
588 self._printControl(host.get_servo(), 'ppchg5_mv')
589 if host.get_servo().get('servo_pd_role') == 'snk':
597 def _is_applicable(self, host): argument
598 return (host.is_in_lab() and
599 host.get_servo().supports_built_in_pd_control())
610 # - less than 500 - DUT is likely not connected
611 # - between 500 and 4000 - unexpected value
612 # - more than 4000 - DUT is likely connected
616 def _is_usb_hub_connected(self, host): argument
629 val = host.get_servo().get('ppdut5_mv')
638 data = host._get_host_metrics_data()
647 def _is_ribbon_cable_connected(self, host): argument
650 The servo_micro/flex - can be checked by `cold_reset` signal.
659 val = host.get_servo().get('cold_reset')
665 host.get_servo().set('cold_reset', 'off')
673 def _is_dut_power_on(self, host): argument
677 return host.get_servo().get('ec_system_powerstate') == 'S0'
682 def _is_servo_v4_type_a(self, host): argument
683 return host.is_labstation() and host.get_servo().is_servo_v4_type_a()
685 def _is_servo_v4_type_c(self, host): argument
686 return host.is_labstation() and host.get_servo().is_servo_v4_type_c()
688 def _is_servo_v3(self, host): argument
689 return not host.is_labstation()
695 Servo_v4 type-a connected to the DUT by:
696 1) servo_micro - checked by `cold_reset`.
697 Servo_v4 type-c connected to the DUT by:
698 1) ccd - checked by ppdut5_mv.
700 1) legacy servo header - can be checked by `cold_reset`.
705 def verify(self, host): argument
706 if self._is_servo_v4_type_a(host):
707 if not self._is_ribbon_cable_connected(host):
710 elif self._is_servo_v4_type_c(host):
711 if (host.get_servo().supports_built_in_pd_control()
712 and not self._is_usb_hub_connected(host)):
715 elif self._is_servo_v3(host):
716 if not self._is_ribbon_cable_connected(host):
728 Servo_v4 type-a connected to the DUT by:
729 1) USB hub - checked by ppdut5_mv.
734 def verify(self, host): argument
735 if self._is_servo_v4_type_a(host):
736 if (self._is_dut_power_on(host)
737 and not self._is_usb_hub_connected(host)):
741 def _is_applicable(self, host): argument
742 if host.is_ec_supported():
744 logging.info('Host does not support EC.')
755 # Min SBU voltage to detect usb-device
760 def _is_applicable(self, host): argument
761 if host.is_localhost():
765 if not self._is_servo_v4_type_c(host):
766 logging.info('Check support only servo-v4 (type-c),'
771 def _is_sbu_voltage_issue(self, host): argument
774 if host.get_servo().has_control(command):
775 if host.get_servo().get(command) == 'on':
779 def _get_max_sbu_value(self, host): argument
781 servo = host.get_servo()
783 return -1
817 def verify(self, host): argument
818 if self._is_sbu_voltage_issue(host):
819 if self._get_max_sbu_value(host) > self.SBU_THRESHOLD:
838 def verify(self, host): argument
839 if self._is_sbu_voltage_issue(host):
840 v = self._get_max_sbu_value(host)
856 def verify(self, host): argument
857 topology = host.get_topology()
858 topology.read(host.get_dut_host_info())
865 dual_set=host.is_dual_setup(),
872 def _is_applicable(self, host): argument
873 if host.is_localhost():
877 if not host.is_servo_topology_supported():
878 logging.info('Target servo-topology is not supported,'
896 # TODO (crbug.com/646593) - Remove list below once servo has been updated
902 def verify(self, host): argument
903 if host.servo_board in self._BOARDS_WO_PWR_BUTTON:
906 button = host.get_servo().get('pwr_button')
916 def _is_applicable(self, host): argument
917 return (host.get_servo() and host.get_servo().main_device_is_flex())
929 def verify(self, host): argument
931 servo = host.get_servo()
935 level = -1
949 'board': host.servo_board or 'unknown',
950 'model': host.servo_model or 'unknown',
959 def _is_applicable(self, host): argument
960 if not host.is_ec_supported():
963 dut_info = host.get_dut_host_info()
965 host_info = host.get_dut_host_info()
969 servo = host.get_servo()
988 def verify(self, host): argument
990 lid_open = host.get_servo().get('lid_open')
1017 def verify(self, host): argument
1018 if not host.is_ec_supported():
1023 if host.get_servo().has_control(command):
1026 r = host.get_servo().get(command)
1053 def verify(self, host): argument
1055 if host.get_servo().get('dut_controller_missing_fault') == 'on':
1061 def _is_applicable(self, host): argument
1062 if host.is_containerized_servod():
1066 if not host.is_labstation():
1067 logging.debug('ServodDutControllerMissingVerifier: Detected non-labstation.')
1070 return host.is_in_lab()
1079 Ensure the servo host container is up.
1082 def verify(self, host): argument
1083 if host.is_containerized_servod():
1084 # We need start servod container first before check it-is present
1085 host.start_containerized_servod()
1086 return super(_ConnectionVerifier, self).verify(host)
1097 def repair(self, host): argument
1098 if host.is_containerized_servod():
1100 elif not host.is_cros_host():
1105 host.restart_servod()
1119 labstation host multiple servos and need do an synchronized reboot.
1123 def repair(self, host): argument
1124 super(_ServoRebootRepair, self).repair(host)
1126 host.restart_servod()
1128 def _is_applicable(self, host): argument
1129 if host.is_localhost() or not host.is_cros_host():
1134 if host.is_labstation():
1135 host.request_reboot()
1143 return 'Reboot the servo host.'
1157 def repair(self, host): argument
1160 if not host.get_servo().has_control(servo_uart_cmd):
1162 host.get_servo().set_nocheck(servo_uart_cmd, 'cc off')
1168 host.get_servo().set_nocheck('servo_pd_role', 'src')
1169 host.get_servo().set_nocheck('servo_dts_mode', 'on')
1172 host.restart_servod()
1174 def _is_applicable(self, host): argument
1175 if host.is_localhost():
1178 if not host.servo_serial:
1181 if not host.servo_recovery:
1184 if not (host.is_labstation() or host.is_containerized_servod()):
1187 if not host.get_servo():
1190 return self._is_type_c(host)
1192 def _is_type_c(self, host): argument
1193 if host.get_dut_host_info():
1194 servo_type = host.get_dut_host_info().get_label_value(
1217 def repair(self, host): argument
1222 if not host.get_servo().has_control(servo_uart_cmd):
1224 host.get_servo().set_nocheck(servo_uart_cmd, disc_cmd)
1227 host.restart_servod()
1229 def _is_applicable(self, host): argument
1230 if host.is_localhost():
1233 if not host.servo_serial:
1236 if not host.servo_recovery:
1239 if not (host.is_labstation() or host.is_containerized_servod()):
1242 if not host.get_servo():
1245 return self._is_type_c(host)
1247 def _is_type_c(self, host): argument
1248 if host.get_dut_host_info():
1249 servo_type = host.get_dut_host_info().get_label_value(
1264 src -- servo in power delivery mode and passes power to the DUT.
1265 snk -- servo in normal mode and not passes power to DUT.
1272 def repair(self, host): argument
1273 host.get_servo().set_nocheck('servo_pd_role', 'snk')
1279 host.get_servo().set('servo_pd_role', 'src')
1285 if host.get_servo().get('servo_pd_role') == 'src':
1287 if host.get_servo().get('servo_pd_role') == 'snk':
1290 # Restart servod to re-initialize servos.
1293 host.restart_servod()
1295 def _is_type_c(self, host): argument
1296 return (host.is_in_lab() and host.get_servo()
1297 and host.get_servo().supports_built_in_pd_control())
1309 def _is_applicable(self, host): argument
1310 return (not host.is_localhost()) and host.is_ec_supported()
1313 def repair(self, host): argument
1314 host.get_servo().ec_reboot()
1331 def repair(self, host): argument
1332 host.get_servo().get_power_state_controller().reset()
1334 lid_open = host.get_servo().get('lid_open')
1351 '/var/lib/metrics/uma-events', '/var/spool/crash/*',
1357 def repair(self, host): argument
1358 if host.is_localhost():
1363 host.run('/usr/bin/find /var/log/servod_* -mtime +%d -print -delete'
1366 # Remove pre-defined metrics and crash dumps.
1368 host.run('rm %s' % path, ignore_status=True)
1382 def repair(self, host): argument
1384 servo_updater.update_servo_firmware(host,
1393 def _is_applicable(self, host): argument
1395 return host.is_labstation() or host.is_containerized_servod()
1399 return 'Update servo-fw if required.'
1409 def repair(self, host): argument
1410 if not host.is_cros_host():
1415 servo = host.get_servo()
1417 logging.info("Servo-micro is not present on set-up")
1421 servo_updater.update_servo_firmware(host,
1430 dhp = host.get_dut_health_profile()
1432 host.restart_servod()
1435 """Verify that it is time when we can try to re-flash fw on servo_micro.
1437 Re-flashing limited to once per 2 weeks to avoid over-flashing
1447 def _is_applicable(self, host): argument
1448 return (not host.is_localhost() and host.get_dut_health_profile()
1449 and self.is_time_to_try(host.get_dut_health_profile()))
1453 return 'Re-flash servo_micro firmware.'