factory_device_data

Reads some fields from the device data.

Function Arguments

Name

Type

Description

device_data_keys

list

A list of the field names of the device data field probe.

probed_result_keys

list, None

(optional; default: None) A list of output field names corresponding to each probed device data field. Each element can be either a string of the new field name or None to use the original field name. Leaving this argument empty is a syntax-sugar for [None, None, ...].

Description

This probe function is essentially an adapter for the probe-tool user to access the factory device data. It loads the data via the cros.factory.test.device_data module and outputs the specified fields as the probed results.

Examples

The following probe statement probes the serial numbers from the device:

{
  "serial_number": {
    "from_device_data": {
      "eval": {
        "factory_device_data": {
          "device_data_keys": [
            "serials.serial_number",
            "serials.mlb_serial_number"
          ],
          "probed_result_keys": [
            "device_sn",
            "mlb_sn"
          ]
        }
      }
    }
  }
}

The statement instructs the probe framework to load serials.serial_number and serials.mlb_serial_number and output them as the value of the fields device_sn and mlb_sn correspondingly. Therefore, assume the device data contains the following fields:

serials.serial_number: "aabbcc"
serials.mlb_serial_number: "ddeeff"

Then the corresponding output will be:

{
  "serial_number": [
    {
      "name": "from_device_data",
      "values": {
        "device_sn": "aabbcc",
        "mlb_sn": "ddeeff"
      }
    }
  ],
}