chromium/chromeos/crosapi/mojom/probe_service.mojom

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// API and definitions exposed by the Telemetry Services. This API is normally
// consumed by the Telemetry Extension APIs implementation.

// Note: this is a subset of the cros_healthd probe service interface which is
// located in
// //chromeos/ash/services/cros_healthd/public/mojom/cros_healthd.mojom.
// This interface serves as PII filtering and data post-processing service
// between the source (cros_healthd) and the clients
// (third-party telemetry extensions).

// The subset is not as is but has the following differences:
//   1) Make all fields in the following structures optional in case we want to
//      filter them out later:
//           - ProbeNonRemovableBlockDeviceInfo
//           - ProbeCpuCStateInfo
//           - ProbeLogicalCpuInfo
//           - ProbePhysicalCpuInfo
//           - ProbeCpuInfo
//           - ProbeTimezoneInfo
//           - ProbeMemoryInfo
//           - ProbeBacklightInfo
//           - ProbeFanInfo
//           - ProbeStatefulPartitionInfo
//           - ProbeBluetoothAdapterInfo
//   2) ProbeNonRemovableBlockDeviceInfo:
//      2.1) use uint32 to store manufacturer_id instead of uint8 in case we
//           want to extend manufacturer range.
//      2.2) use string to store serial in a decimal numeral system instead
//           of uint32 in case we want to extend serial number range.
//   3) ProbeLogicalCpuInfo:
//      3.1) rename idle_time_user_hz to idle_time_ms and use milliseconds
//           instead of USER_HZ units, because USER_HZ system constant is not
//           available in the web.
//      3.2) use uint64 to store idle_time_ms instead of uint32, idle_time_ms
//           can easily be more than uint32 range.
//   4) ProbeMemoryInfo: use uint64 to store page_faults_since_last_boot instead
//      of uint32, it can be more than uint32 range.
//   5) ProbeBusResult: Holds a list of ProbeBusInfo.
//      This is a subset of DeviceInfo containing the fields that can be exposed
//      to third party code. Note: DeviceInfo is used by cros_healthd.

module crosapi.mojom;

import "chromeos/crosapi/mojom/nullable_primitives.mojom";
import "chromeos/services/network_health/public/mojom/network_health_types.mojom";

// Interface for getting device telemetry information. Implemented in
// ash-chrome.
[Stable, Uuid="f3dbbe3b-a810-43a9-889e-b130b4f94869"]
interface TelemetryProbeService {
  // Returns telemetry information for the desired categories.
  //
  // The request:
  // * |categories| - list of each of the categories that ProbeTelemetryInfo
  //                  should return information for.
  //
  // The response:
  // * |telemetry_info| - information for each of the requested categories. Only
  //                      the fields corresponding to the requested categories
  //                      will be non-null.
  ProbeTelemetryInfo@0(array<ProbeCategoryEnum> categories)
      => (ProbeTelemetryInfo telemetry_info);

  // Returns OEM data.
  //
  // The response:
  // * |oem_data| - OEM data.
  GetOemData@1() => (ProbeOemData oem_data);
};

// An enumeration of each category of information that cros_healthd can report.
//
// Next ID: 18
// Next Version: 3
[Stable, Extensible]
enum ProbeCategoryEnum {
  [Default] kUnknown = 11,
  kBattery = 0,
  kNonRemovableBlockDevices = 1,
  kCachedVpdData = 2,
  kCpu = 3,
  kTimezone = 4,
  kMemory = 5,
  kBacklight = 6,
  kFan = 7,
  kStatefulPartition = 8,
  kBluetooth = 9,
  kSystem = 10,
  kNetwork = 12,
  kTpm = 13,
  kAudio = 14,
  kBus = 15,
  [MinVersion=1] kDisplay = 16,
  [MinVersion=2] kThermal = 17,
};

// An enumeration of the different categories of errors that can occur when
// probing telemetry information.
//
// Next ID: 5
[Stable, Extensible]
enum ProbeErrorType {
  // Default value.
  [Default] kUnknown = 4,
  // An error reading a system file.
  kFileReadError = 0,
  // An error parsing data into a consumable form.
  kParseError = 1,
  // An error using a system utility.
  kSystemUtilityError = 2,
  // The external service used to probe the information is not available.
  kServiceUnavailable = 3,
};

// Structure that contains error information for a telemetry probe.
//
// Next ID: 2
[Stable]
struct ProbeError {
  // The type of error that occurred.
  ProbeErrorType type@0;
  // A debug message with more information about the error. This string is not
  // intended to be shown to the user.
  string msg@1;
};

// Information related to the main battery.
//
// Next ID: 14
[Stable]
struct ProbeBatteryInfo {
  // Cycle count.
  Int64Value? cycle_count@0;
  // Current battery voltage (V)
  DoubleValue? voltage_now@1;
  // Manufacturer of the battery
  string? vendor@2;
  // Serial number of the battery
  string? serial_number@3;
  // Design capacity (Ah)
  DoubleValue? charge_full_design@4;
  // Full capacity (Ah)
  DoubleValue? charge_full@5;
  // Desired minimum output voltage (V)
  DoubleValue? voltage_min_design@6;
  // Model name.
  string? model_name@7;
  // Current battery charge (Ah)
  DoubleValue? charge_now@8;
  // Current battery current (A)
  DoubleValue? current_now@9;
  // Technology of the battery
  string? technology@10;
  // Status of the battery
  string? status@11;

  // The fields below are optionally included if the main battery is a Smart
  // Battery as defined in http://sbs-forum.org/specs/sbdat110.pdf.

  // Manufacture date converted to yyyy-mm-dd format.
  string? manufacture_date@12;
  // Temperature in 0.1K. Included when the main battery is a Smart Battery.
  UInt64Value? temperature@13;
};

// Battery probe result. Can either be populated with the BatteryInfo or an
// error retrieving the information.
[Stable]
union ProbeBatteryResult {
  // Valid BatteryInfo. Null value if a battery is not present.
  ProbeBatteryInfo? battery_info;
  // The error that occurred attempting to retrieve the BatteryInfo.
  ProbeError error;
};

// The info related to usb interfaces.
//
// NextMinVersion: 1, NextIndex: 5
[Stable]
struct ProbeUsbBusInterfaceInfo {
  // The zero-based number (index) of the interface.
  UInt8Value? interface_number@0;
  // These fields can be used to classify / identify the usb interfaces. See the
  // usb.ids database for the values, e.g. https://github.com/gentoo/hwids.
  UInt8Value? class_id@1;
  UInt8Value? subclass_id@2;
  UInt8Value? protocol_id@3;
  // The driver used by the device. This is the name of the matched driver which
  // is registered in the kernel. See "{kernel root}/drivers/" for the list of
  // the built in drivers.
  string? driver@4;
};

// An enumeration of the formats of firmware version in fwpud. See the fwupd
// repo for the values. (https://github.com/fwupd/fwupd)
//
// NextMinVersion: 1, NextIndex: 14
[Stable, Extensible]
enum ProbeFwupdVersionFormat {
  // Unknown version format.
  [Default] kUnknown = 0,
  // An unidentified format text string.
  kPlain = 1,
  // A single integer version number.
  kNumber = 2,
  // Two AABB.CCDD version numbers.
  kPair = 3,
  // Microsoft-style AA.BB.CCDD version numbers.
  kTriplet = 4,
  // UEFI-style AA.BB.CC.DD version numbers.
  kQuad = 5,
  // Binary coded decimal notation.
  kBcd = 6,
  // Intel ME-style bitshifted notation.
  kIntelMe = 7,
  // Intel ME-style A.B.CC.DDDD notation.
  kIntelMe2 = 8,
  // Legacy Microsoft Surface 10b.12b.10b.
  kSurfaceLegacy = 9,
  // Microsoft Surface 8b.16b.8b.
  kSurface = 10,
  // Dell BIOS BB.CC.DD style.
  kDellBios = 11,
  // Hexadecimal 0xAABCCDD style.
  kHex = 12,
};

// The info related to a firmware version obtained from fwupd.
//
// NextMinVersion: 1, NextIndex: 2
[Stable]
struct ProbeFwupdFirmwareVersionInfo {
  // The string form of the firmware version.
  string? version@0;
  // The format for parsing the version string.
  ProbeFwupdVersionFormat version_format@1;
};

// An enumeration of the usb version.
//
// NextMinVersion: 1, NextIndex: 5
[Stable, Extensible]
enum ProbeUsbVersion {
  // Can't determine the usb version.
  [Default] kUnknown = 0,
  // Usb 1.
  kUsb1 = 1,
  // Usb 2.
  kUsb2 = 2,
  // Usb 3.
  kUsb3 = 3,
};

// An enumeration of the usb spec speed in Mbps.
// Source:
//   - https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-bus-usb
//   - https://www.kernel.org/doc/Documentation/ABI/stable/sysfs-bus-usb
//   - https://en.wikipedia.org/wiki/USB
//
// NextMinVersion: 1, NextIndex: 8
[Stable, Extensible]
enum ProbeUsbSpecSpeed {
  // Unknown speed.
  [Default] kUnknown = 0,
  // Low speed.
  k1_5Mbps = 1,
  // Full speed.
  k12Mbps = 2,
  // High Speed.
  k480Mbps = 3,
  // Super Speed.
  k5Gbps = 4,
  // Super Speed+.
  k10Gbps = 5,
  // Super Speed+ Gen 2x2.
  k20Gbps = 6,
};

// The info related to usb.
//
// NextMinVersion: 1, NextIndex: 9
[Stable]
struct ProbeUsbBusInfo {
  // These fields can be used to classify / identify the usb devices. See the
  // usb.ids database for the values. (https://github.com/gentoo/hwids)
  UInt8Value? class_id@0;
  UInt8Value? subclass_id@1;
  UInt8Value? protocol_id@2;
  UInt16Value? vendor_id@3;
  UInt16Value product_id@4;
  // The usb interfaces belonging to the device. A usb device has at least one
  // interface. Each interface may or may not work independently, based on each
  // device. This allows a usb device to provide multiple features.
  // The interfaces are sorted by the |interface_number| field.
  array<ProbeUsbBusInterfaceInfo>? interfaces@5;
  // The firmware version obtained from fwupd.
  ProbeFwupdFirmwareVersionInfo? fwupd_firmware_version_info@6;
  // The recognized usb version. It may not be the highest USB version supported
  // by the hardware.
  ProbeUsbVersion version@7;
  // The spec usb speed.
  ProbeUsbSpecSpeed spec_speed@8;
};

// The info related to a specific bus type.
//
// NextMinVersion: 1, NextIndex: 2
[Stable, Extensible]
union ProbeBusInfo {
  // Do not use, exists for forwards compatibility.
  [Default] bool unmapped_field@0;
  // The info related to usb.
  ProbeUsbBusInfo usb_bus_info@1;
};

// Bus probe result. Can either be populated with the ProbeBusInfo or an error
// retrieving the information.
[Stable]
union ProbeBusResult {
  // Valid ProbeBusInfo.
  array<ProbeBusInfo> bus_devices_info;
  // The error that occurred attempting to retrieve the ProbeBusInfo.
  ProbeError error;
};

// Information related to a specific non-removable block device.
//
// Next ID: 12
[Stable]
struct ProbeNonRemovableBlockDeviceInfo {
  // The path of this storage on the system. It is useful if caller needs to
  // correlate with other information.
  string? path@0;
  // Exact size of this storage, reported in bytes.
  UInt64Value? size@1;
  // Storage type, could be MMC / NVMe / ATA, based on udev subsystem.
  string? type@2;
  // Manufacturer ID, 8 bits.
  UInt32Value? manufacturer_id@3;
  // PNM: Product name, ASCII characters for 6 bytes.
  string? name@4;
  // PSN: Product serial number, encoded unsigned integer in decimal numeral
  // system.
  string? serial@5;
  // Bytes read since last boot.
  UInt64Value? bytes_read_since_last_boot@6;
  // Bytes written since last boot.
  UInt64Value? bytes_written_since_last_boot@7;
  // Time spent reading since last boot.
  UInt64Value? read_time_seconds_since_last_boot@8;
  // Time spent writing since last boot.
  UInt64Value? write_time_seconds_since_last_boot@9;
  // Time spent doing I/O since last boot. Counts the time the disk and queue
  // were busy, so unlike the fields above, parallel requests are not counted
  // multiple times.
  UInt64Value? io_time_seconds_since_last_boot@10;
  // Time spent discarding since last boot. Discarding is writing to clear
  // blocks which are no longer in use. Supported on kernels 4.18+.
  UInt64Value? discard_time_seconds_since_last_boot@11;
};

// Non-removable block device probe result. Can either be populated with the
// NonRemovableBlockDeviceInfo or an error retrieving the information.
[Stable]
union ProbeNonRemovableBlockDeviceResult {
  // Valid NonRemovableBlockDeviceInfo.
  array<ProbeNonRemovableBlockDeviceInfo> block_device_info;
  // The error that occurred attempting to retrieve the
  // NonRemovableBlockDeviceInfo.
  ProbeError error;
};

// Cached VPD read from sysfs.
//
// Next ID: 4
[Stable]
struct ProbeCachedVpdInfo {
  // Contents of /sys/firmware/vpd/rw/ActivateDate, if the device supports it.
  string? first_power_date@0;
  // Contents of /sys/firmware/vpd/ro/sku_number, if the device supports it.
  string? sku_number@1;
  // Contents of /sys/firmware/vpd/ro/serial_number, if the device supports it.
  string? serial_number@2;
  // Contents of /sys/firmware/vpd/ro/model_name, if the device supports it.
  string? model_name@3;
};

// Cached VPD probe result. Can either be populated with the CachedVpdInfo or an
// error retrieving the information.
[Stable]
union ProbeCachedVpdResult {
  // Valid CachedVpdInfo.
  ProbeCachedVpdInfo vpd_info;
  // The error that occurred attempting to retrieve the CachedVpdInfo.
  ProbeError error;
};

// Information about a CPU's C-states.
//
// Next ID: 2
[Stable]
struct ProbeCpuCStateInfo {
  // Name of the state.
  string? name@0;
  // Time spent in the state since the last reboot, in microseconds.
  UInt64Value? time_in_state_since_last_boot_us@1;
};

// Information related to a particular logical CPU.
//
// Next ID: 6
// Next MinVersion: 2
[Stable]
struct ProbeLogicalCpuInfo {
  // The max CPU clock speed in kHz.
  UInt32Value? max_clock_speed_khz@0;
  // Maximum frequency the CPU is allowed to run at, by policy.
  UInt32Value? scaling_max_frequency_khz@1;
  // Current frequency the CPU is running at.
  UInt32Value? scaling_current_frequency_khz@2;
  // Idle time since last boot, in milliseconds.
  UInt64Value? idle_time_ms@3;
  // Information about the logical CPU's time in various C-states.
  array<ProbeCpuCStateInfo> c_states@4;
  // The core number this logical CPU corresponds to.
  [MinVersion=1] UInt32Value? core_id@5;
};

// Information related to a particular physical CPU.
//
// Next ID: 2
[Stable]
struct ProbePhysicalCpuInfo {
  // The CPU model name.
  string? model_name@0;
  // Logical CPUs corresponding to this physical CPU.
  array<ProbeLogicalCpuInfo> logical_cpus@1;
};

// An enumeration of CPU architectures.
//
// Next ID: 4
[Stable, Extensible]
enum ProbeCpuArchitectureEnum {
  [Default] kUnknown = 3,
  kX86_64 = 0,
  kAArch64 = 1,
  kArmv7l = 2,
};

// Information about the device's CPUs.
//
// Next ID: 3
[Stable]
struct ProbeCpuInfo {
  // Number of total threads available.
  UInt32Value? num_total_threads@0;
  // The CPU architecture - it's assumed all of a device's CPUs share an
  // architecture.
  ProbeCpuArchitectureEnum architecture@1;
  // Information about the device's physical CPUs.
  array<ProbePhysicalCpuInfo> physical_cpus@2;
};

// CPU probe result. Can either be populated with the CpuInfo or an error
// retrieving the information.
[Stable]
union ProbeCpuResult {
  // Valid CpuInfo.
  ProbeCpuInfo cpu_info;
  // The error that occurred attempting to retrieve the CpuInfo.
  ProbeError error;
};

// Timezone information.
//
// Next ID: 2
[Stable]
struct ProbeTimezoneInfo {
  // The timezone of the device in POSIX standard.
  string? posix@0;
  // The timezone region of the device.
  string? region@1;
};

// Timezone probe result. Can either be populated with the TimezoneInfo or an
// error retrieving the information.
[Stable]
union ProbeTimezoneResult {
  // Valid TimezoneInfo.
  ProbeTimezoneInfo timezone_info;
  // The error that occurred attempting to retrieve the TimezoneInfo.
  ProbeError error;
};

// Memory information.
//
// Next ID: 4
[Stable]
struct ProbeMemoryInfo {
  // Total memory, in KiB.
  UInt32Value? total_memory_kib@0;
  // Free memory, in KiB.
  UInt32Value? free_memory_kib@1;
  // Available memory, in KiB.
  UInt32Value? available_memory_kib@2;
  // Number of page faults since the last boot.
  UInt64Value? page_faults_since_last_boot@3;
};

// Memory probe result. Can either be populated with the MemoryInfo or an
// error retrieving the information.
[Stable]
union ProbeMemoryResult {
  // Valid MemoryInfo.
  ProbeMemoryInfo memory_info;
  // The error that occurred attempting to retrieve the MemoryInfo.
  ProbeError error;
};

// Backlight information.
//
// Next ID: 3
[Stable]
struct ProbeBacklightInfo {
  // Path to this backlight on the system. Useful if the caller needs to
  // correlate with other information.
  string? path@0;
  // Maximum brightness for the backlight.
  UInt32Value? max_brightness@1;
  // Current brightness of the backlight, between 0 and max_brightness.
  UInt32Value? brightness@2;
};

// Backlight probe result. Can either be populated with the BacklightInfo or an
// error retrieving the information.
[Stable]
union ProbeBacklightResult {
  // Valid BacklightInfo.
  array<ProbeBacklightInfo> backlight_info;
  // The error that occurred attempting to retrieve the BacklightInfo.
  ProbeError error;
};

// Fan information.
[Stable]
struct ProbeFanInfo {
  // Fan speed in RPM.
  UInt32Value? speed_rpm@0;
};

// Fan probe result. Can either be populated with the FanInfo or an error
// retrieving the information.
[Stable]
union ProbeFanResult {
  // A list of valid FanInfo.
  array<ProbeFanInfo> fan_info;
  // The error that occurred attempting to retrieve the FanInfo.
  ProbeError error;
};

// Stateful partition info
//
// Next ID: 2
[Stable]
struct ProbeStatefulPartitionInfo {
  // Available space for user data storage in the device in bytes. Rounded down
  // to multiples of 100MiB (100 * 1024 * 1024 bytes).
  UInt64Value? available_space@0;
  // Total space for user data storage in the device in bytes.
  UInt64Value? total_space@1;
};

// Stateful partition probe result. Can either be populated with a valid
// StatefulPartitionInfo or an error retrieving the information.
[Stable]
union ProbeStatefulPartitionResult {
  // A valid StatefulPartitionInfo.
  ProbeStatefulPartitionInfo partition_info;
  // The error that occurred attempting to retrieve the StatefulPartitionInfo.
  ProbeError error;
};

// The version of Google security chip(GSC).
//
// Next ID: 3
[Stable, Extensible]
enum ProbeTpmGSCVersion {
  // For the devices which cannot be classified.
  [Default] kNotGSC = 0,
  // Devices with Cr50 firmware.
  kCr50 = 1,
  // Devices with Ti50 firmware.
  kTi50 = 2,
};

// TPM version related information.
//
// Next ID: 7
[Stable]
struct ProbeTpmVersion {
  // GSC version.
  ProbeTpmGSCVersion gsc_version@0;
  // TPM family. We use the TPM 2.0 style encoding, e.g.:
  //  * TPM 1.2: "1.2" -> 0x312e3200
  //  * TPM 2.0: "2.0" -> 0x322e3000
  UInt32Value? family@1;
  // TPM spec level.
  UInt64Value? spec_level@2;
  // Manufacturer code.
  UInt32Value? manufacturer@3;
  // TPM model number.
  UInt32Value? tpm_model@4;
  // Firmware version.
  UInt64Value? firmware_version@5;
  // Vendor specific information.
  string? vendor_specific@6;
};

// TPM status related information.
//
// Next ID: 3
[Stable]
struct ProbeTpmStatus {
  // Whether a TPM is enabled on the system.
  BoolValue? enabled@0;
  // Whether the TPM has been owned.
  BoolValue? owned@1;
  // Whether the owner password is still retained.
  BoolValue? owner_password_is_present@2;
};

// TPM dictionary attack (DA) related information.
//
// Next ID: 4
[Stable]
struct ProbeTpmDictionaryAttack {
  // The current dictionary attack counter value.
  UInt32Value? counter@0;
  // The current dictionary attack counter threshold.
  UInt32Value? threshold@1;
  // Whether the TPM is in some form of dictionary attack lockout.
  BoolValue? lockout_in_effect@2;
  // The number of seconds remaining in the lockout.
  UInt32Value? lockout_seconds_remaining@3;
};

// Information of the Trusted Platform Module (TPM).
// For more information on TPM and this struct, visit:
//   - go/cros-tdm-tpm-telemetry
//   - https://www.chromium.org/developers/design-documents/tpm-usage
//
// Next ID: 3
[Stable]
struct ProbeTpmInfo {
  // TPM version related information.
  ProbeTpmVersion? version@0;
  // TPM status related information.
  ProbeTpmStatus? status@1;
  // TPM dictionary attack (DA) related information.
  ProbeTpmDictionaryAttack? dictionary_attack@2;
};

// TPM probe result. Can either be populated with the TpmInfo or an error
// retrieving the information.
[Stable]
union ProbeTpmResult {
  // Valid TpmInfo.
  ProbeTpmInfo tpm_info;
  // The error that occurred attempting to retrieve the TpmInfo.
  ProbeError error;
};

// Information related to one of a device's Bluetooth adapters.
//
// Next ID: 4
[Stable]
struct ProbeBluetoothAdapterInfo {
  // The name of the adapter.
  string? name@0;
  // The MAC address of the adapter.
  string? address@1;
  // Indicates whether the adapter is on or off.
  BoolValue? powered@2;
  // The number of devices connected to this adapter.
  UInt32Value? num_connected_devices@3;
};

// Bluetooth probe result. Can either be populated with the BluetoothAdapterInfo
// or an error retrieving the information.
[Stable]
union ProbeBluetoothResult {
  // Valid BluetoothAdapterInfo.
  array<ProbeBluetoothAdapterInfo> bluetooth_adapter_info;
  // The error that occurred attempting to retrieve the BluetoothAdapterInfo.
  ProbeError error;
};

// OS Version information.
// This structure decomposes a full version string
// (e.g. "87.13544.59.0") into its parts.
[Stable]
struct ProbeOsVersion {
  // The OS version release milestone (e.g. "87").
  string? release_milestone@0;
  // The OS version build number (e.g. "13544").
  string? build_number@1;
  // The OS version patch number (e.g. "59.0").
  string? patch_number@2;
  // The OS release channel (e.g. "stable-channel").
  string? release_channel@3;
};

// The OS information.
//
// Next ID: 3
// Next Version: 3
[Stable]
struct ProbeOsInfo {
  // Contents of CrosConfig in /branding/oem-name.
  string? oem_name@0;
  // OS Version information.
  [MinVersion=1] ProbeOsVersion? os_version@1;
  // Contents of CrosConfig in /branding/marketing-name.
  [MinVersion=2] string? marketing_name@2;
};

// System Information.
[Stable]
struct ProbeSystemInfo {
  // The info related to the OS.
  ProbeOsInfo os_info@0;
};

// System probe result. Can either be populated with the SystemInfo or an
// error retrieving the information.
[Stable]
union ProbeSystemResult {
  // Valid SystemInfo.
  ProbeSystemInfo system_info;
  // The error that occurred attempting to retrieve SystemInfo.
  ProbeError error;
};

// Network probe result. Can either be populated with the NetworkHealthState
// or an error retrieving the information.
[Stable]
union ProbeNetworkResult {
  // Valid NetworkHealthState.
  chromeos.network_health.mojom.NetworkHealthState network_health;
  // The error that occurred attempting to retrieve the NetworkHealthState.
  ProbeError error;
};

// Audio input node information.
//
// NextID: 5
[Stable]
struct ProbeAudioInputNodeInfo {
  // Node id.
  UInt64Value? id@0;
  // The name of this node. For example, "Internal Mic".
  string? name@1;
  // The name of the device that this node belongs to. For example,
  // "HDA Intel PCH: CA0132 Analog:0,0"
  string? device_name@2;
  // Whether this node is currently used for input. There is one active
  // node for input.
  BoolValue? active@3;
  // The input node gain set by UI, the value is in [0, 100].
  UInt8Value? node_gain@4;
};

// Audio output node information.
//
// NextID: 5
[Stable]
struct ProbeAudioOutputNodeInfo {
  // Node id.
  UInt64Value? id@0;
  // The name of this node. For example, "Speaker".
  string? name@1;
  // The name of the device that this node belongs to. For example,
  // "HDA Intel PCH: CA0132 Analog:0,0"
  string? device_name@2;
  // Whether this node is currently used for output. There is one active
  // node for output.
  BoolValue? active@3;
  // The node volume in [0, 100].
  UInt8Value? node_volume@4;
};

// Audio information.
//
// NextID: 6
[Stable]
struct ProbeAudioInfo {
  // Is the active output device mute or not.
  BoolValue? output_mute@0;
  // Is the active input device mute or not.
  BoolValue? input_mute@1;
  // Number of underruns.
  UInt32Value? underruns@2;
  // Number of severe underruns.
  UInt32Value? severe_underruns@3;
  // Output nodes.
  array<ProbeAudioOutputNodeInfo>? output_nodes@4;
  // Input nodes.
  array<ProbeAudioInputNodeInfo>? input_nodes@5;
};

// Audio probe result. Can either be populated with the ProbeAudioInfo or an
// error retrieving the information.
[Stable]
union ProbeAudioResult {
  // Valid ProbeAudioInfo.
  ProbeAudioInfo audio_info;
  // The error that occurred attempting to retrieve the AudioInfo.
  ProbeError error;
};

// An enumeration of display input type.
//
// NextMinVersion: 1, NextIndex: 3
[Stable, Extensible]
enum ProbeDisplayInputType {
  // An enum value not defined in this version of the enum definition.
  [Default] kUnmappedEnumField = 0,
  // Digital input.
  kDigital = 1,
  // Analog input.
  kAnalog = 2,
};

// NextMinVersion: 1, NextIndex: 15
[Stable]
struct ProbeEmbeddedDisplayInfo {
  // Privacy screen is supported or not.
  bool? privacy_screen_supported@0;
  // Privacy screen is enabled or not.
  bool? privacy_screen_enabled@1;
  // Display width in millimeters.
  uint32? display_width@2;
  // Display height in millimeters.
  uint32? display_height@3;
  // Horizontal resolution.
  uint32? resolution_horizontal@4;
  // Vertical resolution.
  uint32? resolution_vertical@5;
  // Refresh rate.
  double? refresh_rate@6;
  // Three letter manufacturer ID.
  string? manufacturer@7;
  // Manufacturer product code.
  uint16? model_id@8;
  // 32 bits serial number.
  uint32? serial_number@9;
  // Week of manufacture.
  uint8? manufacture_week@10;
  // Year of manufacture.
  uint16? manufacture_year@11;
  // EDID version.
  string? edid_version@12;
  // Digital or analog input.
  ProbeDisplayInputType input_type@13;
  // Name of display product.
  string? display_name@14;
};

// NextMinVersion: 1, NextIndex: 13
[Stable]
struct ProbeExternalDisplayInfo {
  // Display width in millimeters.
  uint32? display_width@0;
  // Display height in millimeters.
  uint32? display_height@1;
  // Horizontal resolution.
  uint32? resolution_horizontal@2;
  // Vertical resolution.
  uint32? resolution_vertical@3;
  // Refresh rate.
  double? refresh_rate@4;
  // Three letter manufacturer ID.
  string? manufacturer@5;
  // Manufacturer product code.
  uint16? model_id@6;
  // 32 bits serial number.
  uint32? serial_number@7;
  // Week of manufacture.
  uint8? manufacture_week@8;
  // Year of manufacture.
  uint16? manufacture_year@9;
  // EDID version.
  string? edid_version@10;
  // Digital or analog input.
  ProbeDisplayInputType input_type@11;
  // Name of display product.
  string? display_name@12;
};

// Display information.
//
// NextMinVersion: 1, NextIndex: 2
[Stable]
struct ProbeDisplayInfo {
  // Embedded display info.
  ProbeEmbeddedDisplayInfo? embedded_display@0;
  // External display info.
  array<ProbeExternalDisplayInfo>? external_displays@1;
};

// Can either be populated with the Display result or an error retrieving the
// information.
[Stable]
union ProbeDisplayResult {
  // Valid DisplayInfo.
  ProbeDisplayInfo display_info;
  // The error that occurred attempting to retrieve DisplayInfo.
  ProbeError error;
};

// The location of sensor.
//
// NextMinVersion: 1, NextIndex: 3
[Stable, Extensible]
enum ProbeThermalSensorSource {
  // For mojo backward compatibility, should not be used.
  [Default] kUnmappedEnumField = 0,
  // Thermal sensor is located in the EC.
  kEc = 1,
  // Thermal sensor is located in SysFs.
  kSysFs = 2,
};

// Information about various thermal sensors.
//
// NextMinVersion: 1, NextIndex: 3
[Stable]
struct ProbeThermalSensorInfo {
  // Name of the thermal sensor.
  string name@0;
  // Temperature detected by the thermal sensor in celsius.
  double temperature_celsius@1;
  // Where the thermal sensor is detected from.
  ProbeThermalSensorSource source@2;
};

// Thermal information.
//
// NextMinVersion: 1, NextIndex: 2
[Stable]
struct ProbeThermalInfo {
  // An array containing all the information retrieved for thermal sensors.
  array<ProbeThermalSensorInfo> thermal_sensors@0;
};

// Can either be populated with the Thermal result or an error retrieving the
// information.
[Stable]
union ProbeThermalResult {
  // Valid thermal info.
  ProbeThermalInfo thermal_info;
  // The error that occurred attempting to retrieve ThermalInfo.
  ProbeError error;
};

// A collection of all the device's telemetry information that cros_healthd is
// capable of reporting. Note that every field in TelemetryInfo is nullable, and
// the response for a particular ProbeTelemetryInfo request will only contain
// fields corresponding to the categories passed to the ProbeTelemetryInfo
// request. All optional array members will be null if cros_healthd did not
// attempt to fetch that information, and size zero if cros_healthd did attempt
// to fetch that information, but was unable to.
//
// Next ID: 17
// Next MinVersion: 5
[Stable]
struct ProbeTelemetryInfo {
  // Information about the device's main battery. Only present when kBattery was
  // included in the categories input to ProbeTelemetryInfo.
  ProbeBatteryResult? battery_result@0;
  // Information about all of the device's non-removable block devices. Only
  // present when kNonRemovableBlockDevices was included in the categories input
  // to ProbeTelemetryInfo.
  ProbeNonRemovableBlockDeviceResult? block_device_result@1;
  // Only present when kCachedVpdData was included in the categories input to
  // ProbeTelemetryInfo.
  ProbeCachedVpdResult? vpd_result@2;
  // Information about each of the device's CPUs. Only present when kCpu was
  // included in the categories input to ProbeTelemetryInfo.
  ProbeCpuResult? cpu_result@3;
  // Information about the device's timezone. Only present when kTimezone was
  // included in the categories input to ProbeTelemetryInfo.
  ProbeTimezoneResult? timezone_result@4;
  // Information about the system's memory. Only present when kMemory was
  // included in the categories input to ProbeTelemetryInfo.
  ProbeMemoryResult? memory_result@5;
  // Information about all of the device's backlights. Only present when
  // kBacklight was included in the categories input to ProbeTelemetryInfo.
  ProbeBacklightResult? backlight_result@6;
  // Information about each of the device's fans. Only present when kFan was
  // included in the categories input to ProbeTelemetryInfo.
  ProbeFanResult? fan_result@7;
  // Information about the stateful partition. Only present when
  // kStatefulPartition was included in the categories input to
  // ProbeTelemetryInfo.
  ProbeStatefulPartitionResult? stateful_partition_result@8;
  // Information about the device's Bluetooth adapters and devices. Only present
  // when kBluetooth was included in the categories input to ProbeTelemetryInfo.
  ProbeBluetoothResult? bluetooth_result@9;
  // Information about the system. Only present when kSystem was included in
  // the categories input to ProbeTelemetryInfo.
  ProbeSystemResult? system_result@10;
  // Information about the networking interfaces and associated networks of the
  // system. Only present when kNetwork was included in the categories input to
  // ProbeTelemetryInfo.
  ProbeNetworkResult? network_result@11;
  // Information about the TPM. Only present when kTpm was included in
  // the categories input to ProbeTelemetryInfo.
  ProbeTpmResult? tpm_result@12;
  // Information about the audio devices. Only present when kAudio was included
  // in the categories input to ProbeTelemetryInfo.
  [MinVersion=1] ProbeAudioResult? audio_result@13;
  // Information about the bus devices. Only present when kBus was included
  // in the categories input to ProbeTelemetryInfo.
  [MinVersion=2] ProbeBusResult? bus_result@14;
  // Information about the bus devices. Only present when kDisplay was included
  // in the categories input to ProbeTelemetryInfo.
  [MinVersion=3] ProbeDisplayResult? display_result@15;
  // Information about the thermal temperatures. Only present when kThermal was
  // included in the categories input to ProbeTelemetryInfo.
  [MinVersion=4] ProbeThermalResult? thermal_result@16;
};

// Result of running /usr/share/cros/oemdata.sh script.
[Stable]
struct ProbeOemData {
  string? oem_data@0;
};