led

Source code: led.py

A factory test for the led function.

Description

Uses ectool to control the onboard LED light, and lets either operator or SMT fixture confirm LED functionality.

Test Procedure

  1. Operator inserts the power to the correct usb_c (if required).

  2. Operator checks the led color and responses the colors in the UI.

  3. Repeats step 1 and 2 for each led.

Dependency

  • Device API cros.factory.device.led.

  • Device API cros.factory.device.usb_c for led controlled by power status.

Examples

An example:

{
  "pytest_name": "led",
  "args": {
    "challenge": true,
    "colors": [
      ["LEFT", "RED"],
      ["LEFT", "OFF"],
      ["RIGHT", "RED"],
      ["RIGHT", "OFF"]
    ]
  }
}

An example for led controlled by power status:

{
  "pytest_name": "led",
  "args": {
    "challenge": true,
    "colors": [
      ["POWER", "BLUE", 0],
      ["POWER", "OFF", 0],
      ["POWER", "BLUE", 1],
      ["POWER", "OFF", 1]
    ]
  }
}

Test Arguments

Name

Type

Description

bft_fixture

dict, None

(optional; default: None) A dictionary with the following items:

class_name

Fully-qualified class name of the BFTFixture implementation to use.

params

A dictionary of parameters for the BFTFixture class’s Init() method.

The default value of None means that no BFT fixture is used.

challenge

bool

(optional; default: False) Show random LED sequence and let the operator select LED number instead of pre-defined sequence.

colors

list

(optional; default: []) List of colors or [index, color, pd_port] to test. color must be in LEDColor or OFF, and index, if specified, must be in LEDIndex. By default, it will automatically detect all supported colors. If pd_port is None, do not care pd status. If pd_port is -1, then wait until no port is sink (SNK). Otherwise, wait until pd_port is the only sink.

group_by_led_id

bool

(optional; default: True) If set, the test groups the subtests of the same led together.

target_leds

list, None

(optional; default: None) List of LEDs to test. If specified, it turns off all LEDs first, and sets them to auto after test.