Garry Wang | 11b5e87 | 2020-03-11 15:14:08 -0700 | [diff] [blame] | 1 | # Copyright (c) 2020 The Chromium OS Authors. All rights reserved. |
| 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
| 4 | |
| 5 | |
| 6 | from autotest_lib.client.common_lib import global_config |
| 7 | _CONFIG = global_config.global_config |
| 8 | |
| 9 | # Names of the host attributes in the database that represent the values for |
| 10 | # the servo_host and servo_port for a servo connected to the DUT. |
| 11 | SERVO_HOST_ATTR = 'servo_host' |
Andrew Luo | 4be621d | 2020-03-21 07:01:13 -0700 | [diff] [blame] | 12 | SERVO_HOST_SSH_PORT_ATTR = 'servo_host_ssh_port' |
Garry Wang | 11b5e87 | 2020-03-11 15:14:08 -0700 | [diff] [blame] | 13 | SERVO_PORT_ATTR = 'servo_port' |
| 14 | SERVO_BOARD_ATTR = 'servo_board' |
| 15 | # Model is inferred from host labels. |
| 16 | SERVO_MODEL_ATTR = 'servo_model' |
| 17 | SERVO_SERIAL_ATTR = 'servo_serial' |
Garry Wang | cb06f3b | 2020-10-08 20:56:21 -0700 | [diff] [blame] | 18 | # Indicates what type of servo setup, example value: REGULAR or DUAL_V4. |
| 19 | SERVO_SETUP_ATTR = 'servo_setup' |
Otabek Kasimov | ab4ae22 | 2021-03-06 01:38:47 -0800 | [diff] [blame] | 20 | SERVO_FW_CHANNEL_ATTR = 'servo_fw_channel' |
Garry Wang | cb06f3b | 2020-10-08 20:56:21 -0700 | [diff] [blame] | 21 | SERVO_SETUP_VALUE_DUAL_V4 = 'DUAL_V4' |
Otabek Kasimov | 1b70e8d | 2020-12-30 13:51:00 -0800 | [diff] [blame] | 22 | SERVO_RECOVERY_MODE = 'servo_recovery' |
Garry Wang | 11b5e87 | 2020-03-11 15:14:08 -0700 | [diff] [blame] | 23 | SERVO_ATTR_KEYS = ( |
| 24 | SERVO_BOARD_ATTR, |
| 25 | SERVO_HOST_ATTR, |
Andrew Luo | 4be621d | 2020-03-21 07:01:13 -0700 | [diff] [blame] | 26 | SERVO_HOST_SSH_PORT_ATTR, |
Garry Wang | 11b5e87 | 2020-03-11 15:14:08 -0700 | [diff] [blame] | 27 | SERVO_PORT_ATTR, |
| 28 | SERVO_SERIAL_ATTR, |
Garry Wang | cb06f3b | 2020-10-08 20:56:21 -0700 | [diff] [blame] | 29 | SERVO_SETUP_ATTR, |
Otabek Kasimov | ab4ae22 | 2021-03-06 01:38:47 -0800 | [diff] [blame] | 30 | SERVO_FW_CHANNEL_ATTR, |
Garry Wang | 11b5e87 | 2020-03-11 15:14:08 -0700 | [diff] [blame] | 31 | ) |
| 32 | |
Garry Wang | 6a68006 | 2020-11-03 13:40:29 -0800 | [diff] [blame] | 33 | # Additional args that will be appended to servod start command. |
| 34 | ADDITIONAL_SERVOD_ARGS = 'additional_servod_args' |
| 35 | |
Garry Wang | 11b5e87 | 2020-03-11 15:14:08 -0700 | [diff] [blame] | 36 | # Timeout value for stop/start servod process. |
| 37 | SERVOD_TEARDOWN_TIMEOUT = 3 |
| 38 | SERVOD_QUICK_STARTUP_TIMEOUT = 20 |
| 39 | SERVOD_STARTUP_TIMEOUT = 60 |
| 40 | |
Garry Wang | b5cee3e | 2020-09-16 14:58:13 -0700 | [diff] [blame] | 41 | # Prefix of pools that require servod cr50 config. |
| 42 | CR50_CONFIG_POOL_PREFIX = 'faft-cr50' |
| 43 | |
Garry Wang | 11b5e87 | 2020-03-11 15:14:08 -0700 | [diff] [blame] | 44 | ENABLE_SSH_TUNNEL_FOR_SERVO = _CONFIG.get_config_value( |
| 45 | 'CROS', 'enable_ssh_tunnel_for_servo', type=bool, default=False) |
| 46 | |
Otabek Kasimov | e756528 | 2020-04-14 13:26:12 -0700 | [diff] [blame] | 47 | SERVO_TYPE_LABEL_PREFIX = 'servo_type' |
Garry Wang | 11b5e87 | 2020-03-11 15:14:08 -0700 | [diff] [blame] | 48 | SERVO_STATE_LABEL_PREFIX = 'servo_state' |
Otabek Kasimov | 646812c | 2020-06-23 20:01:36 -0700 | [diff] [blame] | 49 | |
| 50 | # constants to support whole list of states for servo |
Garry Wang | 11b5e87 | 2020-03-11 15:14:08 -0700 | [diff] [blame] | 51 | SERVO_STATE_UNKNOWN = 'UNKNOWN' |
Otabek Kasimov | 646812c | 2020-06-23 20:01:36 -0700 | [diff] [blame] | 52 | SERVO_STATE_MISSING_CONFIG = 'MISSING_CONFIG' |
| 53 | SERVO_STATE_WRONG_CONFIG = 'WRONG_CONFIG' |
| 54 | SERVO_STATE_NO_SSH = 'NO_SSH' |
Otabek Kasimov | 29f4bb4 | 2021-04-23 19:28:52 -0700 | [diff] [blame^] | 55 | SERVO_STATE_SERVO_HOST_ISSUE = 'SERVO_HOST_ISSUE' |
Otabek Kasimov | 646812c | 2020-06-23 20:01:36 -0700 | [diff] [blame] | 56 | SERVO_STATE_NOT_CONNECTED = 'NOT_CONNECTED' |
| 57 | SERVO_STATE_NEED_REPLACEMENT = 'NEED_REPLACEMENT' |
Otabek Kasimov | bb3bc46 | 2020-11-03 16:40:33 -0800 | [diff] [blame] | 58 | SERVO_STATE_CR50_CONSOLE_MISSING = 'CR50_CONSOLE_MISSING' |
Otabek Kasimov | 646812c | 2020-06-23 20:01:36 -0700 | [diff] [blame] | 59 | SERVO_STATE_CCD_TESTLAB_ISSUE = 'CCD_TESTLAB_ISSUE' |
| 60 | SERVO_STATE_SERVOD_ISSUE = 'SERVOD_ISSUE' |
| 61 | SERVO_STATE_LID_OPEN_FAILED = 'LID_OPEN_FAILED' |
| 62 | SERVO_STATE_BAD_RIBBON_CABLE = 'BAD_RIBBON_CABLE' |
Otabek Kasimov | 01bceb3 | 2020-10-28 15:40:28 -0700 | [diff] [blame] | 63 | SERVO_STATE_TOPOLOGY_ISSUE = 'TOPOLOGY_ISSUE' |
Otabek Kasimov | 8e88a74 | 2021-01-11 18:03:13 -0800 | [diff] [blame] | 64 | SERVO_STATE_SBU_LOW_VOLTAGE = 'SBU_LOW_VOLTAGE' |
| 65 | SERVO_STATE_CR50_NOT_ENUMERATED = 'CR50_NOT_ENUMERATED' |
Otabek Kasimov | a7eb4dc | 2020-09-16 10:25:17 -0700 | [diff] [blame] | 66 | SERVO_STATE_DUT_NOT_CONNECTED = 'DUT_NOT_CONNECTED' |
Otabek Kasimov | 646812c | 2020-06-23 20:01:36 -0700 | [diff] [blame] | 67 | SERVO_STATE_EC_BROKEN = 'EC_BROKEN' |
| 68 | SERVO_STATE_BROKEN = 'BROKEN' |
| 69 | SERVO_STATE_WORKING = 'WORKING' |
Garry Wang | ffbd216 | 2020-04-17 16:13:48 -0700 | [diff] [blame] | 70 | |
| 71 | # constants to support reset servo via smart usbhub. |
Garry Wang | 000c6c0 | 2020-05-11 21:27:23 -0700 | [diff] [blame] | 72 | SMART_USBHUB_LABEL = 'smart_usbhub' |
Garry Wang | ffbd216 | 2020-04-17 16:13:48 -0700 | [diff] [blame] | 73 | SERVO_RESET_TIMEOUT_SECONDS = 20 |
Garry Wang | ad24500 | 2020-05-15 15:20:23 -0700 | [diff] [blame] | 74 | ERROR_MESSAGE_USB_HUB_NOT_COMPATIBLE = ('Be sure the hub is a supported' |
| 75 | ' smart hub') |
Garry Wang | ffbd216 | 2020-04-17 16:13:48 -0700 | [diff] [blame] | 76 | # a servo serial number should be fed to this constant |
| 77 | ERROR_MESSAGE_DEVICE_NOT_FOUND = 'Device with serial \'%s\' not found.' |