chromium/chromeos/ash/services/cros_healthd/public/mojom/cros_healthd_probe.mojom

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

// Definitions for the probe API exposed by the cros_healthd daemon. This API is
// normally consumed by the browser.

// NOTE: This mojom should be kept in sync with the copy in Chromium OS's repo
// in src/platform2/diagnostics/mojom/public/cros_healthd_probe.mojom.
module ash.cros_healthd.mojom;

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

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

// An enumeration of each category of information that cros_healthd can report.
//
// NextMinVersion: 4, NextIndex: 23
[Stable, Extensible]
enum ProbeCategoryEnum {
  [Default] kUnknown = 16,
  kBattery = 0,
  kNonRemovableBlockDevices = 1,
  kCpu = 2,
  kTimezone = 3,
  kMemory = 4,
  kBacklight = 5,
  kFan = 6,
  kStatefulPartition = 7,
  kBluetooth = 8,
  kSystem = 9,
  kNetwork = 10,
  kAudio = 11,
  kBootPerformance = 12,
  kBus = 13,
  kTpm = 14,
  kGraphics = 15,
  kDisplay = 17,
  kNetworkInterface = 18,
  kInput = 19,
  [MinVersion=1] kAudioHardware = 20,
  [MinVersion=2] kSensor = 21,
  [MinVersion=3] kThermal = 22,
};

// An enumeration of the different categories of errors that can occur when
// probing telemetry information.
//
// NextMinVersion: 1, NextIndex: 5
[Stable, Extensible]
enum ErrorType {
  [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.
//
// NextMinVersion: 1, NextIndex: 2
[Stable]
struct ProbeError {
  // The type of error that occurred.
  ErrorType 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;
};

// An enumeration of states a process can be in.
//
// NextMinVersion: 2, NextIndex: 9
[Stable, Extensible]
enum ProcessState {
  [Default] kUnknown = 7,
  // The process is running.
  kRunning = 0,
  // The process is sleeping in an interruptible wait.
  kSleeping = 1,
  // The process is waiting in an uninterruptible disk sleep.
  kWaiting = 2,
  // The process is a zombie.
  kZombie = 3,
  // The process is stopped on a signal.
  kStopped = 4,
  // The process is stopped by tracing.
  kTracingStop = 5,
  // The process is dead.
  kDead = 6,
  // The process is idle.
  [MinVersion=1] kIdle = 8,
};

// Process probe result. Can either be populated with the ProcessInfo or an
// error retrieving the information.
[Stable]
union ProcessResult {
  // Valid ProcessInfo.
  ProcessInfo process_info;
  // The error that occurred attempting to retrieve the ProcessInfo.
  ProbeError error;
};

// Multiple process probe results. Including successfully fetched process_info
// and errors if any occurred and not ignored.
//
// NextMinVersion: 1, NextIndex: 2
[Stable]
struct MultipleProcessResult {
  // map of valid ProcessInfo, with process id as key and ProcessInfo as value.
  // Can be empty if no processes are successfully fetched.
  map<uint32, ProcessInfo> process_infos@0;
  // map of errors that occurred when retrieving ProcessInfo, with process id as
  // key and ProbeError as value. Can be empty if no errors occur or if errors
  // are ignored.
  map<uint32, ProbeError> errors@1;
};

// Information related to a particular process.
//
// NextMinVersion: 3, NextIndex: 21
[Stable]
struct ProcessInfo {
  // Command which started the process.
  string command@0;
  // User the process is running as.
  uint32 user_id@1;
  // If the process is running a real-time scheduling policy, this field is the
  // negated scheduling priority, minus one. Real-time priorities range from 1
  // to 99, so this will range from -2 to -100. If the process is not running a
  // real-time scheduling priority, this field will be the raw nice value, where
  // 0 corresponds to the user-visible high priority nice value of -20, and 39
  // corresponds to the user-visible low priority nice value of 19.
  int8 priority@2;
  // User-visible nice value of the process, from a low priority of 19 to a high
  // priority of -20.
  int8 nice@3;
  // Uptime of the process, in clock ticks.
  uint64 uptime_ticks@4;
  // State of the process.
  ProcessState state@5;
  // Total memory allocated to the process, in KiB.
  uint32 total_memory_kib@6;
  // Amount of resident memory currently used by the process, in KiB.
  uint32 resident_memory_kib@7;
  // Unused memory available to the process, in KiB. This will always be
  // |total_memory_kib| - |resident_memory_kib|.
  uint32 free_memory_kib@8;
  // The sum of bytes passed to system read calls. This includes terminal I/O
  // and is independent of whether the physical disk is accessed.
  uint64 bytes_read@9;
  // The sum of bytes passed to system write calls. This includes terminal I/O
  // and is independent of whether the physical disk is accessed.
  uint64 bytes_written@10;
  // Attempted count of read syscalls.
  uint64 read_system_calls@11;
  // Attempted count of write syscalls.
  uint64 write_system_calls@12;
  // Attempt to count the number of bytes which this process really did cause to
  // be fetched from the storage layer.
  uint64 physical_bytes_read@13;
  // Attempt to count the number of bytes which this process caused to be sent
  // to the storage layer.
  uint64 physical_bytes_written@14;
  // Number of bytes which this process caused to not happen, by truncating
  // pagecache.
  uint64 cancelled_bytes_written@15;
  // Filename of the executable.
  [MinVersion=1]
  string? name@16;
  // PID of the parent of this process.
  [MinVersion=1]
  uint32 parent_process_id@17;
  // Process group ID of the group.
  [MinVersion=1]
  uint32 process_group_id@18;
  // Number of threads in this process.
  [MinVersion=1]
  uint32 threads@19;
  // Process ID of the particular process.
  [MinVersion=2]
  uint32 process_id@20;
};

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

// Information related to the main battery.
//
// NextMinVersion: 1, NextIndex: 14
[Stable]
struct BatteryInfo {
  // TODO(crbug.com/40633980): Update "smart" cycle count.
  int64 cycle_count@0;
  // Current battery voltage (V)
  double voltage_now@1;
  // Manufacturer of the battery
  string vendor@2;
  // Serial number of the battery
  string serial_number@3;
  // Design capacity (Ah)
  double charge_full_design@4;
  // Full capacity (Ah)
  double charge_full@5;
  // Desired minimum output voltage (V)
  double voltage_min_design@6;
  // Model name.
  string model_name@7;
  // Current battery charge (Ah)
  double charge_now@8;
  // Current battery current (A)
  double 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.
  NullableUint64? temperature@13;
};

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

// Unions for device-specific data fields. |other| is provided by the default
// data adapter and filled with a default value for the unknown device type.

// The manufacturer of the block device.
//
// NextMinVersion: 3, NextIndex: 5
[Stable, Extensible]
union BlockDeviceVendor {
  uint32 nvme_subsystem_vendor@0;
  uint16 emmc_oemid@1;
  uint16 other@2;

  [MinVersion=1, Default]
  uint64 unknown@3;

  [MinVersion=2]
  uint16 jedec_manfid@4;
};

// The manufacturer-specific product identifier.
//
// NextMinVersion: 2, NextIndex: 4
[Stable, Extensible]
union BlockDeviceProduct {
  uint32 nvme_subsystem_device@0;
  uint64 emmc_pnm@1;
  uint16 other@2;

  [MinVersion=1, Default]
  uint64 unknown@3;
};

// The revision of the device's hardware.
//
// NextMinVersion: 2, NextIndex: 4
[Stable, Extensible]
union BlockDeviceRevision {
  uint8 nvme_pcie_rev@0;
  uint8 emmc_prv@1;
  uint16 other@2;

  [MinVersion=1, Default]
  uint64 unknown@3;
};

// The revision of the device's firmware.
//
// NextMinVersion: 3, NextIndex: 5
[Stable, Extensible]
union BlockDeviceFirmware {
  uint64 nvme_firmware_rev@0;
  uint64 emmc_fwrev@1;
  uint16 other@2;

  [MinVersion=1, Default]
  uint64 unknown@3;

  [MinVersion=2]
  uint64 ufs_fwrev@4;
};

// Purpose of the storage device.
//
// NextMinVersion: 2, NextIndex: 4
[Stable, Extensible]
enum StorageDevicePurpose {
  [Default] kUnknown = 0,
  // The storage device is the root device which ChromeOS boots from.
  kBootDevice = 1,
  // DEPRECATED. See b/287120238.
  DEPRECATED_kSwapDevice = 2,
  // The storage device is not the root device which ChromeOS boots from.
  [MinVersion=1] kNonBootDevice = 3,
};

// NVMe-specific device info.
//
// NextMinVersion: 1, NextIndex: 4
[Stable]
struct NvmeDeviceInfo {
  // The manufacturer ID.
  uint32 subsystem_vendor@0;
  // The product ID.
  uint32 subsystem_device@1;
  // The product revision.
  uint8 pcie_rev@2;
  // The firmware revision.
  uint64 firmware_rev@3;
};

// eMMC-specific device info.
//
// NextMinVersion: 1, NextIndex: 4
[Stable]
struct EmmcDeviceInfo {
  // The manufacturer ID.
  uint16 manfid@0;
  // The product name.
  uint64 pnm@1;
  // The product revision.
  uint8 prv@2;
  // The firmware revision.
  uint64 fwrev@3;
};

// UFS-specific device info.
//
// NextMinVersion: 1, NextIndex: 2
[Stable]
struct UfsDeviceInfo {
  // The JEDEC manufacturer ID.
  uint16 jedec_manfid@0;
  // The firmware revision.
  uint64 fwrev@1;
};

// The union of device-specific info.
//
// NextMinVersion: 1, NextIndex: 4
[Stable, Extensible]
union BlockDeviceInfo {
  // Default field is required by extensible unions for backward compatibility.
  // Any unrecognized Mojo field will deserialize to this field. Don't use this.
  [Default]
  bool unrecognized@0;

  NvmeDeviceInfo nvme_device_info@1;
  EmmcDeviceInfo emmc_device_info@2;
  UfsDeviceInfo ufs_device_info@3;
};

// Information related to a specific non-removable block device.
//
// NextMinVersion: 4, NextIndex: 20
[Stable]
struct NonRemovableBlockDeviceInfo {
  // IO statistics

  // Bytes read since last boot.
  uint64 bytes_read_since_last_boot@0;
  // Bytes written since last boot.
  uint64 bytes_written_since_last_boot@1;
  // Time spent reading since last boot.
  uint64 read_time_seconds_since_last_boot@2;
  // Time spent writing since last boot.
  uint64 write_time_seconds_since_last_boot@3;
  // 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.
  uint64 io_time_seconds_since_last_boot@4;
  // Time spent discarding since last boot. Discarding is writing to clear
  // blocks which are no longer in use. Supported on kernels 4.18+.
  NullableUint64? discard_time_seconds_since_last_boot@5;

  // Additional device info.

  // Device specific info.
  [MinVersion=1]
  BlockDeviceInfo? device_info@17;

  // Device identification.

  // (Deprecated, use |device_info| instead) Device vendor identification.
  BlockDeviceVendor vendor_id@6;
  // (Deprecated, use |device_info| instead) Device product identification.
  BlockDeviceProduct product_id@7;
  // (Deprecated, use |device_info| instead) Device revision.
  BlockDeviceRevision revision@8;
  // Device model.
  string name@9;
  // Device size in bytes.
  uint64 size@10;
  // (Deprecated, use |device_info| instead) Firmware version.
  BlockDeviceFirmware firmware_version@11;
  // Storage type, could be MMC / NVMe / ATA, based on udev subsystem.
  string type@12;
  // Purpose of the device e.g. "boot", "swap".
  StorageDevicePurpose purpose@13;

  // Additional identification.

  // The path of this storage on the system. It is useful if caller needs to
  // correlate with other information.
  string path@14;
  // Manufacturer ID, 8 bits.
  uint8 manufacturer_id@15;
  // PSN: Product serial number, 32 bits
  uint32 serial@16;
  // String representatil of the device FW version
  [MinVersion=2]
  string? firmware_string@18;
  // Whether the block device is a spinning disk.
  [MinVersion=3]
  bool? is_rotational@19;
};

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

// Information about the device's CPUs.
//
// NextMinVersion: 2, NextIndex: 7
[Stable]
struct CpuInfo {
  // Number of total threads available.
  uint32 num_total_threads@0;
  // The CPU architecture - it's assumed all of a device's CPUs share an
  // architecture.
  CpuArchitectureEnum architecture@1;
  // Information about the device's physical CPUs.
  array<PhysicalCpuInfo> physical_cpus@2;
  // Information about the CPU temperature channels.
  array<CpuTemperatureChannel> temperature_channels@3;
  // Information about keylocker.
  KeylockerInfo? keylocker_info@4;
  // The general virtualization info. Guaranteed to be not null unless the
  // version doesn't match.
  [MinVersion=1]
  VirtualizationInfo? virtualization@5;
  // The cpu vulnerability info. The key is the name of the vulnerability.
  // Guaranteed to be not null unless the version doesn't match.
  [MinVersion=1]
  map<string, VulnerabilityInfo>? vulnerabilities@6;
};

// Information related to virtualization.
//
// NextMinVersion: 1, NextIndex: 3
[Stable]
struct VirtualizationInfo {
  // The possible states of Simultaneous multithreading(SMT) control.
  [Stable, Extensible]
  enum SMTControl {
    // This is required for backwards compatibility, should not be used.
    [Default] kUnmappedEnumField,
    // SMT is enabled.
    kOn,
    // SMT is disabled.
    kOff,
    // SMT is force disabled. Cannot be changed.
    kForceOff,
    // SMT is not supported by the CPU.
    kNotSupported,
    // SMT runtime toggling is not implemented for the architecture, or the
    // kernel version doesn't support SMT detection yet.
    kNotImplemented,
  };

  // Whether the /dev/kvm device exists.
  bool has_kvm_device@0;
  // Whether SMT is active. This will always be false if SMT detection is not
  // supported by the kernel of this device.
  bool is_smt_active@1;
  // The state of SMT control.
  SMTControl smt_control@2;
};

// Information related to CPU Vulnerabilities.
//
// NextMinVersion: 1, NextIndex: 2
[Stable]
struct VulnerabilityInfo {
  // The status of the vulnerability.
  [Stable, Extensible]
  enum Status {
    // This is required for backwards compatibility, should not be used.
    [Default] kUnmappedEnumField,
    // Not affected by this vulnerability.
    kNotAffected,
    // Vulnerable by this vulnerability.
    kVulnerable,
    // Vulnerability is mitigated.
    kMitigation,
    // Vulnerability is unknown.
    kUnknown,
    // Vulnerability is unrecognized by parser.
    kUnrecognized,
  };

  Status status@0;
  // The description of the vulnerability.
  string message@1;
};

// Information related to Keylocker.
//
// NextMinVersion: 1, NextIndex: 1
[Stable]
struct KeylockerInfo {
  // Has Keylocker been configured or not.
  bool keylocker_configured@0;
};

// Information related to a particular physical CPU.
//
// NextMinVersion: 2, NextIndex: 4
[Stable]
struct PhysicalCpuInfo {
  // The CPU model name, if available.
  // For Arm devices, we will return SoC model instead.
  string? model_name@0;
  // Logical CPUs corresponding to this physical CPU.
  array<LogicalCpuInfo> logical_cpus@1;
  // The cpu flags, labelled as |flags| in x86 architecture and |Features| in
  // ARM architecture.
  [MinVersion=1]
  array<string>? flags@2;
  // The virtualization info of this cpu.
  [MinVersion=1]
  CpuVirtualizationInfo? virtualization@3;
};

// Information related to virtualization status of a cpu.
//
// NextMinVersion: 1, NextIndex: 3
[Stable]
struct CpuVirtualizationInfo {
  // The type of cpu hardware virtualization.
  [Stable, Extensible]
  enum Type {
    // This is required for backwards compatibility, should not be used.
    [Default] kUnmappedEnumField,
    // The cpu supports Intel virtualization (VT-x).
    kVMX,
    // The cpu supports AMD virtualization (AMD-V).
    kSVM,
  };

  Type type@0;
  // Whether virtualization is enabled.
  bool is_enabled@1;
  // Whether the virtualization configuration is locked and cannot be modified.
  // This is usually set by the BIOS to prevent the OS changing the setting
  // after booting into the OS.
  bool is_locked@2;
};

// Information related to a particular logical CPU.
//
// NextMinVersion: 2, NextIndex: 8
[Stable]
struct LogicalCpuInfo {
  // The max CPU clock speed in kHz. The value will be 0 on devices that don't
  // support CPU frequency scaling.
  uint32 max_clock_speed_khz@0;
  // Maximum frequency the CPU is allowed to run at, by policy. The value will
  // be 0 on devices that don't support CPU frequency scaling.
  uint32 scaling_max_frequency_khz@1;
  // Current frequency the CPU is running at. The value will be 0 on devices
  // that don't support CPU frequency scaling.
  uint32 scaling_current_frequency_khz@2;
  // Time spent in user mode since last boot. USER_HZ can be converted to
  // seconds with the conversion factor given by sysconf(_SC_CLK_TCK).
  uint64 user_time_user_hz@3;
  // Time spent in system mode since last boot. USER_HZ can be converted to
  // seconds with the conversion factor given by sysconf(_SC_CLK_TCK).
  uint64 system_time_user_hz@4;
  // Idle time since last boot. USER_HZ can be converted to seconds with the
  // conversion factor given by sysconf(_SC_CLK_TCK).
  uint64 idle_time_user_hz@5;
  // Information about the logical CPU's time in various C-states.
  array<CpuCStateInfo> c_states@6;
  // The core number this logical CPU corresponds to.
  [MinVersion=1]
  uint32 core_id@7;
};

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

// Information about a single CPU temperature channel.
//
// NextMinVersion: 1, NextIndex: 2
[Stable]
struct CpuTemperatureChannel {
  // Temperature channel label, if found on the device.
  string? label@0;
  // CPU temperature in Celsius.
  int32 temperature_celsius@1;
};

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

// Timezone information.
//
// NextMinVersion: 1, NextIndex: 2
[Stable]
struct TimezoneInfo {
  // The timezone of the device in POSIX standard.
  string posix@0;
  // The timezone region of the device.
  string region@1;
};

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

// Memory information.
//
// NextMinVersion: 3, NextIndex: 16
[Stable]
struct MemoryInfo {
  // Computed total memory including memory reserved for the kernel, etc.,
  // in KiB.
  uint32 total_memory_kib@0;
  // Free memory, in KiB.
  uint32 free_memory_kib@1;
  // Available memory, in KiB.
  uint32 available_memory_kib@2;
  // Number of page faults since the last boot.
  uint64 page_faults_since_last_boot@3;
  // Memory Encryption info.
  [MinVersion=1]
  MemoryEncryptionInfo? memory_encryption_info@4;
  // Relatively temporary storage for raw disk blocks, in KiB.
  [MinVersion=2]
  uint64? buffers_kib@5;
  // In-memory cache for files read from the disk, in KiB.
  [MinVersion=2]
  uint64? page_cache_kib@6;
  // Shared memory, used in tmpfs, in KiB.
  [MinVersion=2]
  uint64? shared_memory_kib@7;
  // More recently used memory, in KiB.
  [MinVersion=2]
  uint64? active_memory_kib@8;
  // Less recently used memory, in KiB.
  [MinVersion=2]
  uint64? inactive_memory_kib@9;
  // Total swap memory, in KiB.
  [MinVersion=2]
  uint64? total_swap_memory_kib@10;
  // Free swap memory, in KiB.
  [MinVersion=2]
  uint64? free_swap_memory_kib@11;
  // The swapped back memory in KiB, but is still in the swap.
  [MinVersion=2]
  uint64? cached_swap_memory_kib@12;
  // Kernal-used memory, in KiB.
  [MinVersion=2]
  uint64? total_slab_memory_kib@13;
  // Reclaimable slab memory, in KiB.
  [MinVersion=2]
  uint64? reclaimable_slab_memory_kib@14;
  // Unreclaimable slab memory, in KiB.
  [MinVersion=2]
  uint64? unreclaimable_slab_memory_kib@15;
};

// NextMinVersion: 1, NextIndex: 4
[Stable]
struct MemoryEncryptionInfo {
  // Memory encryption state.
  EncryptionState encryption_state@0;
  // Max number of encryption keys.
  uint32 max_key_number@1;
  // Encryption key length.
  uint32 key_length@2;
  // Crypto algorithm currently used.
  CryptoAlgorithm active_algorithm@3;
};

// Memory encryption states.
// NextMinVersion: 1, NextIndex: 4
[Stable, Extensible]
enum EncryptionState {
  [Default] kUnknown = 0,
  kEncryptionDisabled = 1,
  kTmeEnabled = 2,
  kMktmeEnabled = 3,
};

// Crypto algorithm.
// NextMinVersion: 1, NextIndex: 3
[Stable, Extensible]
enum CryptoAlgorithm {
  [Default] kUnknown = 0,
  kAesXts128 = 1,
  kAesXts256 = 2,
};

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

// Backlight information.
//
// NextMinVersion: 1, NextIndex: 3
[Stable]
struct BacklightInfo {
  // 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.
  uint32 max_brightness@1;
  // Current brightness of the backlight, between 0 and max_brightness.
  uint32 brightness@2;
};

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

// Fan information.
//
// NextMinVersion: 1, NextIndex: 1
[Stable]
struct FanInfo {
  // Fan speed in RPM.
  uint32 speed_rpm@0;
};

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

// Stateful partition info
//
// NextMinVersion: 1, NextIndex: 4
[Stable]
struct StatefulPartitionInfo {
  // Available space in bytes for stateful partition.
  uint64 available_space@0;
  // Total space in bytes for stateful partition.
  uint64 total_space@1;
  // File system on stateful partition. e.g. ext4.
  string filesystem@2;
  // Source of stateful partition. e.g. /dev/mmcblk0p1.
  string mount_source@3;
};

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

// Information related to one of a device's Bluetooth adapters.
//
// NextMinVersion: 3, NextIndex: 11
[Stable]
struct BluetoothAdapterInfo {
  // 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.
  bool powered@2;
  // The number of devices connected to this adapter.
  uint32 num_connected_devices@3;
  // The info of connected devices to this adapter.
  [MinVersion=1]
  array<BluetoothDeviceInfo>? connected_devices@4;
  // The adapter is visible or not.
  [MinVersion=1]
  bool discoverable@5;
  // The device discovery procedure is active or not.
  [MinVersion=1]
  bool discovering@6;
  // The list of the available local services.
  [MinVersion=1]
  array<string>? uuids@7;
  // Local Device ID information.
  [MinVersion=1]
  string? modalias@8;
  // List of allowed system devices.
  [MinVersion=2]
  array<string>? service_allow_list@9;
  // A dictionary of supported capabilities. DEPRECATED.
  [MinVersion=2]
  DEPRECATED_SupportedCapabilities? deprecated_capabilities@10;
};

// Information related to one of a adapter's Bluetooth connected devices.
//
// NextMinVersion: 3, NextIndex: 10
[Stable]
struct BluetoothDeviceInfo {
  // The MAC address of the device.
  string address@0;
  // The name of the device.
  string? name@1;
  // The carriers supported by this remote device ("BR/EDR", "LE", or "DUAL").
  BluetoothDeviceType type@2;
  // The external appearance of the device.
  NullableUint16? appearance@3;
  // Remote Device ID information.
  string? modalias@4;
  // Received Signal Strength Indicator.
  NullableInt16? rssi@5;
  // The Maximum Transmission Unit used in ATT communication. DEPRECATED.
  NullableUint16? deprecated_mtu@6;
  // The list of the available remote services.
  array<string>? uuids@7;
  // The battery percentage of the device.
  [MinVersion=1]
  NullableUint8? battery_percentage@8;
  // The Bluetooth class of device (CoD) of the device.
  [MinVersion=2]
  NullableUint32? bluetooth_class@9;
};

// An enumeration of type in Bluetooth device info.
//
// NextMinVersion: 1, NextIndex: 5
[Stable, Extensible]
enum BluetoothDeviceType {
  // An enum value not defined in this version of the enum definition.
  [Default] kUnmappedEnumField = 0,
  // Unknown type.
  kUnknown = 1,
  // BR/EDR.
  kBrEdr = 2,
  // LE.
  kLe = 3,
  // DUAL.
  kDual = 4,
};

// Supported Capabilities related information. DEPRECATED.
[Stable]
struct DEPRECATED_SupportedCapabilities {};

// System probe result. DEPRECATED.
[Stable]
union DEPRECATED_SystemResult {
  ProbeError error;
};

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

// System Information.
//
// NextMinVersion: 2, NextIndex: 4
[Stable]
struct SystemInfo {
  // The info related to the OS.
  OsInfo os_info@0;
  // The info from the VPD cache.
  VpdInfo? vpd_info@1;
  // The info from DMI (x86 only). The info from here should only be used for
  // logging and debugging.
  DmiInfo? dmi_info@2;
  // The info related to Intel Platform Service Record (PSR).
  [MinVersion=1]
  PsrInfo? psr_info@3;
};

// The OS information.
//
// NextMinVersion: 3, NextIndex: 6
[Stable]
struct OsInfo {
  // Google code name for the given model. While it is OK to use this string for
  // human-display purposes (such as in a debug log or help dialog), or for a
  // searchable-key in metrics collection, it is not recommended to use this
  // property for creating model-specific behaviors.
  string code_name@0;
  // Contents of CrosConfig in /branding/marketing-name.
  string? marketing_name@1;
  // The OS version of the system.
  OsVersion os_version@2;
  // The boot flow used by the current boot.
  BootMode boot_mode@3;
  // Contents of CrosConfig in /branding/oem-name.
  [MinVersion=1]
  string? oem_name@4;

  // NextMinVersion: 1, NextIndex: 4
  [Stable, Extensible]
  enum EfiPlatformSize {
    // An enum value not defined in this version of the enum definition.
    [Default] kUnmappedEnumField = 0,
    // Unknown size. Always sets to this if not boot from efi.
    kUnknown = 1,
    // 64 bit platform.
    k64 = 2,
    // 32 bit platform.
    k32 = 3,
  };

  [MinVersion=2]
  EfiPlatformSize efi_platform_size@5;
};

// Structure containing information about the operating system version of the
// device. This structure decomposes a full version string
// (e.g. "87.13544.59.0") into its parts:
//
// NextMinVersion: 2, NextIndex: 5
[Stable]
struct OsVersion {
  // 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 branch number (e.g. "59").
  [MinVersion=1]
  string? branch_number@4;
  // The OS version patch number (e.g. "0").
  string patch_number@2;
  // The OS release channel (e.g. "stable-channel").
  string release_channel@3;
};

// The boot mode of the current os.
//
// NextMinVersion: 1, NextIndex: 5
[Stable, Extensible]
enum BootMode {
  [Default] kUnknown = 0,
  // Boot with ChromeOS firmware.
  kCrosSecure = 1,
  // Boot with EFI
  kCrosEfi = 2,
  // Boot with Legacy BIOS.
  kCrosLegacy = 3,
  // Boot with EFI security boot.
  kCrosEfiSecure = 4,
};

// The list of VPD fields are available in the ChromeOS Partner Site document
// "VPD Field Requirements":
//    https://chromeos.google.com/partner/dlm/docs/factory/vpd.html
// Note that all the fields (include required fields) are not guaranteed to be
// exist in some situation. (e.g. in a early stage device)
//
// NextMinVersion: 2, NextIndex: 7
[Stable]
struct VpdInfo {
  // A unique identifier of the device. (Required RO VPD field)
  string? serial_number@0;
  // Defines a market region where devices share a particular configuration of
  // keyboard layout, language, and timezone. (Required VPD field)
  string? region@1;
  // The date the device was manufactured. (Required RO VPD field)
  // Format: YYYY-MM-DD.
  string? mfg_date@2;
  // The date the device was first activated. (Runtime RW VPD field)
  // Format: YYYY-WW.
  string? activate_date@3;
  // The product SKU number. (Optional RO VPD field. b/35512367)
  string? sku_number@4;
  // The product model name. (Optional RO VPD field. b/35512367)
  string? model_name@5;
  // OEM name of the device. (Optional RO VPD field)
  [MinVersion=1]
  string? oem_name@6;
};

// DMI (a.k.a. SMBIOS) is only supported on x86 platform. These info can be used
// to identify the hardware.
//
// NextMinVersion: 1, NextIndex: 11
[Stable]
struct DmiInfo {
  // The BIOS vendor.
  string? bios_vendor@0;
  // The BIOS version.
  string? bios_version@1;
  // The product name of the motherboard.
  string? board_name@2;
  // The vendor of the motherboard.
  string? board_vendor@3;
  // The version of the motherboard.
  string? board_version@4;
  // The vendor of the chassis.
  string? chassis_vendor@5;
  // The chassis type of the device. The values reported by chassis type are
  // mapped in
  // www.dmtf.org/sites/default/files/standards/documents/DSP0134_3.0.0.pdf.
  NullableUint64? chassis_type@6;
  // The product family name.
  string? product_family@7;
  // The product name (model) of the system.
  string? product_name@8;
  // The product version.
  string? product_version@9;
  // The system vendor name.
  string? sys_vendor@10;
};

// Platform Service Record (PSR) event.
//
// NextMinVersion: 1: NextIndex 3
[Stable]
struct PsrEvent {
  // PSR event types.
  //
  // NextMinVersion: 2, NextIndex: 11
  [Stable, Extensible]
  enum EventType {
    // An enum value not defined in this version of the enum definition.
    [Default] kUnmappedEnumField = 0,
    // Log has started.
    kLogStart = 1,
    // Log has ended.
    kLogEnd = 2,
    // CSME recovery
    kCsmeRecovery = 3,
    // Protected real-time counter failure.
    kPrtcFailure = 4,
    // Secure Version Number increased.
    kSvnIncrease = 5,
    // Missing event file.
    [MinVersion=1] kMissing = 6,
    // Invalid event.
    [MinVersion=1] kInvalid = 7,
    // Entered into CSME DAM state.
    [MinVersion=1] kCsmeDamState = 8,
    // CSME Unlocked state for debugging.
    [MinVersion=1] kCsmeUnlockState = 9,
    // FW Version Changed.
    [MinVersion=1] kFwVersionChanged = 10,
  };
  EventType type@0;

  // Time of occurrence.
  uint32 time@1;
  // Event data.
  uint32 data@2;
};

// Platform Service Record (PSR) information.
//
// NextMinVersion: 2, NextIndex: 16
[Stable]
struct PsrInfo {
  // The PSR log state.
  //
  // NextMinVersion: 1, NextIndex: 4
  [Stable, Extensible]
  enum LogState {
    // An enum value not defined in this version of the enum definition.
    [Default] kUnmappedEnumField = 0,
    // PSR logging was not started yet.
    kNotStarted = 1,
    // PSR logging was started and currently running.
    kStarted = 2,
    // PSR logging was stopped due to some critical event.
    kStopped = 3,
  };
  LogState log_state@0;

  // PSR UUID.
  string uuid@1;
  // Platform UPID.
  string upid@2;
  // Logging start date in UNIX time.
  uint32 log_start_date@3;
  // OEM's name, ex: Panasonic.
  string oem_name@4;
  // OEM's make, ex: Toughbook.
  string oem_make@5;
  // OEM's model, ex: 55.
  string oem_model@6;
  // Country of device origin.
  string manufacture_country@7;
  // Additional OEM data.
  string oem_data@8;
  // All the counters will never be reset unless the FW is reflashed.
  // Cumulative number of seconds at S0.
  uint32 uptime_seconds@9;
  // Cumulative number of S0->S5.
  uint32 s5_counter@10;
  // Cumulative number of S0->S4.
  uint32 s4_counter@11;
  // Cumulative number of S0->S3.
  uint32 s3_counter@12;
  // Cumulative number of warm resets (soft reboots).
  uint32 warm_reset_counter@13;
  // First 100 PSR events that have been saved.
  array<PsrEvent> events@14;
  // Is PSR supported.
  [MinVersion=1]
  bool is_supported@15;
};

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

[Stable]
union NetworkInterfaceResult {
  // Valid network interfaces.
  array<NetworkInterfaceInfo> network_interface_info;
  // Error occurred while fetching network interface data.
  ProbeError error;
};

// Will expand to beyond wireless interface.
// NextMinVersion: 1, NextIndex: 1
[Stable]
union NetworkInterfaceInfo {
  // Wireless interfaces.
  WirelessInterfaceInfo wireless_interface_info@0;
};

// NextMinVersion: 1, NextIndex: 3
[Stable]
struct WirelessInterfaceInfo {
  // Interface name.
  string interface_name@0;
  // Is power management enabled for wifi or not.
  bool power_management_on@1;
  // Link info only available when device is connected to an access point.
  WirelessLinkInfo? wireless_link_info@2;
};

// NextMinVersion: 1, NextIndex: 7
[Stable]
struct WirelessLinkInfo {
  // Access point address.
  string access_point_address_str@0;
  // Tx bit rate measured in Mbps.
  uint32 tx_bit_rate_mbps@1;
  // Rx bit rate measured in Mbps.
  uint32 rx_bit_rate_mbps@2;
  // Transmission power measured in dBm.
  int32 tx_power_dBm@3;
  // Is wifi encryption key on or not.
  bool encyption_on@4;
  // Wifi link quality.
  uint32 link_quality@5;
  // Wifi signal level in dBm.
  int32 signal_level_dBm@6;
};

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

// Audio information.
//
// NextMinVersion: 2, NextIndex: 10
[Stable]
struct AudioInfo {
  // Is active output device mute or not.
  bool output_mute@0;
  // Is active input device mute or not.
  bool input_mute@1;
  // Active output device's volume in [0, 100].
  uint64 output_volume@2;
  // Active output device's name.
  string output_device_name@3;
  // Active input device's gain in [0, 100].
  uint32 input_gain@4;
  // Active input device's name.
  string input_device_name@5;
  // Numbers of underruns.
  uint32 underruns@6;
  // Numbers of severe underruns.
  uint32 severe_underruns@7;
  // Output nodes.
  [MinVersion=1]
  array<AudioNodeInfo>? output_nodes@8;
  // Input nodes.
  [MinVersion=1]
  array<AudioNodeInfo>? input_nodes@9;
};

// Audio node information.
//
// NextMinVersion: 1, NextIndex: 6
[Stable]
struct AudioNodeInfo {
  // Node id.
  uint64 id@0;
  // The name of this node. For example, "Speaker" or "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 output/input. There is one active
  // node for output and one active node for input.
  bool active@3;
  // The node volume in [0, 100].
  uint8 node_volume@4;
  // The input node gain set by UI, the value is in [0, 100].
  uint8 input_node_gain@5;
};

// Audio hardware probe result.
[Stable]
union AudioHardwareResult {
  // Valid AudioHardwareInfo.
  AudioHardwareInfo audio_hardware_info;
  // The error that occurred.
  ProbeError error;
};

// Audio hardware information.
//
// NextMinVersion: 1, NextIndex: 2
[Stable]
struct AudioHardwareInfo {
  // Audio cards information.
  array<AudioCard> audio_cards@0;
};

// Audio card information.
//
// NextMinVersion: 1, NextIndex: 3
[Stable]
struct AudioCard {
  // The id used by ALSA(Advanced Linux Sound Architecture).
  string alsa_id@0;
  // The bus device. If omits, the card is belongs to a bus type which is not
  // yet supported by Healthd.
  BusDevice? bus_device@1;
  // The hd-audio codecs.
  array<HDAudioCodec> hd_audio_codecs@2;
};

// HD-Audio codec information.
//
// NextMinVersion: 1, NextIndex: 2
[Stable]
struct HDAudioCodec {
  // The name. E.g. "ATI R6xx HDMI".
  string name@0;
  // The address. E.g. "0".
  uint8 address@1;
};

// Boot performance result.
[Stable]
union BootPerformanceResult {
  // Valid BootPerformanceInfo.
  BootPerformanceInfo boot_performance_info;
  // The error that occurred attempting to retrieve the BootPerformanceInfo.
  ProbeError error;
};

// Boot performance information.
//
// NextMinVersion: 3, NextIndex: 11
[Stable]
struct BootPerformanceInfo {
  // Total time of [power on, boot up complete], a.k.a. boot up time.
  // Boot up complete event is fired when login screen is shown.
  double boot_up_seconds@0;
  // The timestamp when power on.
  double boot_up_timestamp@1;
  // Total time(rough) since shutdown start to power off.
  // Only meaningful when shutdown_reason is not "N/A".
  double shutdown_seconds@2;
  // The timestamp when shutdown.
  // Only meaningful when shutdown_reason is not "N/A".
  double shutdown_timestamp@3;
  // The shutdown reason (including reboot).
  string shutdown_reason@4;
  // TPM initialization time.
  [MinVersion=1]
  NullableDouble? tpm_initialization_seconds@5;
  // Total time of [power on, jump to kernel], a.k.a. firmware time.
  [MinVersion=2]
  double? power_on_to_kernel_seconds@6;
  // Total time of [jump to kernel, pre start up], a.k.a. kernel time.
  [MinVersion=2]
  double? kernel_to_pre_startup_seconds@7;
  // Total time of [jump to kernel, post start up].
  [MinVersion=2]
  double? kernel_to_post_startup_seconds@8;
  // Total time of [start up, chrome exec], a.k.a. system time.
  [MinVersion=2]
  double? startup_to_chrome_exec_seconds@9;
  // Total time of [chrome exec, login screen prompt], a.k.a. chrome time.
  [MinVersion=2]
  double? chrome_exec_to_login_seconds@10;
};

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

// The classes of the bus devices. Can be used to group the devices by their
// use.
//
// NextMinVersion: 1, NextIndex: 7
[Stable, Extensible]
enum BusDeviceClass {
  // For the devices which cannot be classified.
  [Default] kOthers = 0,
  kDisplayController = 1,
  kEthernetController = 2,
  kWirelessController = 3,
  kBluetoothAdapter = 4,
  kThunderboltController = 5,
  kAudioCard = 6,
};

// The bus device info.
//
// NextMinVersion: 1, NextIndex: 4
[Stable]
struct BusDevice {
  // The vendor / product name of the device. These are extracted from the
  // databases on the system and should only be used for showing / logging.
  // Don't use these to identify the devices.
  string vendor_name@0;
  string product_name@1;
  // The class of the device.
  BusDeviceClass device_class@2;
  // The info related to specific bus type.
  BusInfo bus_info@3;
};

// The info related to specific bus type.
//
// NextMinVersion: 2
[Stable, Extensible]
union BusInfo {
  // The info related to pci.
  PciBusInfo pci_bus_info;
  // The info related to usb.
  UsbBusInfo usb_bus_info;
  // The info related to thunderbolt.
  ThunderboltBusInfo thunderbolt_bus_info;
  // The required field for backwards compatibility. The unrecognized Mojo
  // field will deserialize to this field. It should not be used.
  [MinVersion=1, Default]
  bool unmapped_field;
};

// The info related to pci.
//
// NextMinVersion: 2, NextIndex: 8
[Stable]
struct PciBusInfo {
  // These fields can be used to classify / identify the pci devices. See the
  // pci.ids database for the values. (https://github.com/gentoo/hwids)
  uint8 class_id@0;
  uint8 subclass_id@1;
  uint8 prog_if_id@2;
  uint16 vendor_id@3;
  uint16 device_id@4;
  // 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@5;
  // These fields can be used to classify / identify the pci subsystem devices.
  // See the pci.ids database for the values. (https://github.com/gentoo/hwids)
  // Note that not every device has these fields.
  [MinVersion=1]
  NullableUint16? sub_vendor_id@6;

  [MinVersion=1]
  NullableUint16? sub_device_id@7;
};

// The info related to usb.
//
// NextMinVersion: 3, NextIndex: 9
[Stable]
struct UsbBusInfo {
  // These fields can be used to classify / identify the usb devices. See the
  // usb.ids database for the values. (https://github.com/gentoo/hwids)
  uint8 class_id@0;
  uint8 subclass_id@1;
  uint8 protocol_id@2;
  uint16 vendor_id@3;
  uint16 product_id@4;
  // The usb interfaces under 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<UsbBusInterfaceInfo> interfaces@5;
  // The firmware version obtained from fwupd.
  [MinVersion=1]
  FwupdFirmwareVersionInfo? fwupd_firmware_version_info@6;
  // The recognized usb version. It may not be the highest USB version supportrd
  // by the hardware.
  [MinVersion=2]
  UsbVersion version@7;
  // The spec usb speed.
  [MinVersion=2]
  UsbSpecSpeed spec_speed@8;
};

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

// 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 FwupdVersionFormat {
  // An enum value not defined in this version of the enum definition.
  [Default] kUnmappedEnumField = 0,
  // Unknown version format.
  kUnknown = 1,
  // An unidentified format text string.
  kPlain = 2,
  // A single integer version number.
  kNumber = 3,
  // Two AABB.CCDD version numbers.
  kPair = 4,
  // Microsoft-style AA.BB.CCDD version numbers.
  kTriplet = 5,
  // UEFI-style AA.BB.CC.DD version numbers.
  kQuad = 6,
  // Binary coded decimal notation.
  kBcd = 7,
  // Intel ME-style bitshifted notation.
  kIntelMe = 8,
  // Intel ME-style A.B.CC.DDDD notation.
  kIntelMe2 = 9,
  // Legacy Microsoft Surface 10b.12b.10b.
  kSurfaceLegacy = 10,
  // Microsoft Surface 8b.16b.8b.
  kSurface = 11,
  // Dell BIOS BB.CC.DD style.
  kDellBios = 12,
  // Hexadecimal 0xAABCCDD style.
  kHex = 13,
};

// An enumeration of the usb version.
//
// NextMinVersion: 1, NextIndex: 5
[Stable, Extensible]
enum UsbVersion {
  // This is for mojo compatibility between two versions. It won't be used in
  // our code base.
  [Default] kUnmappedEnumField = 0,
  // Can't determine the usb version.
  kUnknown = 1,
  // Usb 1.
  kUsb1 = 2,
  // Usb 2.
  kUsb2 = 3,
  // Usb 3.
  kUsb3 = 4,
};

// 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: 9
[Stable, Extensible]
enum UsbSpecSpeed {
  // This is for mojo compatibility between two versions. It won't be used in
  // our code base.
  [Default] kUnmappedEnumField = 0,
  // Unknown speed.
  kUnknown = 1,
  // Low speed.
  k1_5Mbps = 2,
  // Full speed.
  k12Mbps = 3,
  // Deprecated. Should be a typo in
  // https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-bus-usb.
  kDeprecatedSpeed = 4,
  // High Speed.
  k480Mbps = 5,
  // Super Speed.
  k5Gbps = 6,
  // Super Speed+.
  k10Gbps = 7,
  // Super Speed+ Gen 2x2.
  k20Gbps = 8,
};

// The info related to usb interfaces.
//
// NextMinVersion: 1, NextIndex: 5
[Stable]
struct UsbBusInterfaceInfo {
  // The zero-based number (index) of the interface.
  uint8 interface_number@0;
  // These fields can be used to classify / identify the usb interfaces. See the
  // usb.ids database for the values.
  uint8 class_id@1;
  uint8 subclass_id@2;
  uint8 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;
};

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

// Information of the Trusted Platform Module(TPM).
//
// NextMinVersion: 1, NextIndex: 6
[Stable]
struct TpmInfo {
  // TPM version related information.
  TpmVersion version@0;
  // TPM status related information.
  TpmStatus status@1;
  // TPM dictionary attack (DA) related information.
  TpmDictionaryAttack dictionary_attack@2;
  // TPM attestation related information.
  TpmAttestation attestation@3;
  // TPM supported features information.
  TpmSupportedFeatures supported_features@4;
  // [Do NOT use] TPM did_vid file. This field is only used in Cloudready
  // project. It is going to drop the support in few milestone.
  // TODO(b/199686982): Remove this.
  string? did_vid@5;
};

// The version of Google security chip(GSC).
//
// NextMinVersion: 1, NextIndex: 3
[Stable, Extensible]
enum TpmGSCVersion {
  // 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.
//
// NextMinVersion: 1, NextIndex: 7
[Stable]
struct TpmVersion {
  // GSC version.
  TpmGSCVersion 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
  uint32 family@1;
  // TPM spec level.
  uint64 spec_level@2;
  // Manufacturer code.
  uint32 manufacturer@3;
  // TPM model number.
  uint32 tpm_model@4;
  // Firmware version.
  uint64 firmware_version@5;
  // Vendor specific information.
  string? vendor_specific@6;
};

// TPM status related information.
//
// NextMinVersion: 1, NextIndex: 3
[Stable]
struct TpmStatus {
  // Whether a TPM is enabled on the system.
  bool enabled@0;
  // Whether the TPM has been owned.
  bool owned@1;
  // Whether the owner password is still retained.
  bool owner_password_is_present@2;
};

// TPM dictionary attack (DA) related information.
//
// NextMinVersion: 1, NextIndex: 4
[Stable]
struct TpmDictionaryAttack {
  // The current dictionary attack counter value.
  uint32 counter@0;
  // The current dictionary attack counter threshold.
  uint32 threshold@1;
  // Whether the TPM is in some form of dictionary attack lockout.
  bool lockout_in_effect@2;
  // The number of seconds remaining in the lockout.
  uint32 lockout_seconds_remaining@3;
};

// TPM attestation related information.
//
// NextMinVersion: 1, NextIndex: 2
[Stable]
struct TpmAttestation {
  // Is prepared for enrollment? True if prepared for *any* CA.
  bool prepared_for_enrollment@0;
  // Is enrolled (AIK certificate created)? True if enrolled with *any* CA.
  bool enrolled@1;
};

// TPM supported features information.
//
// NextMinVersion: 1, NextIndex: 4
[Stable]
struct TpmSupportedFeatures {
  // Whether the u2f is supported or not.
  bool support_u2f@0;
  // Whether the pinweaver is supported or not.
  bool support_pinweaver@1;
  // Whether the platform supports runtime TPM selection or not.
  bool support_runtime_selection@2;
  // Whether the TPM is allowed to use or not.
  bool is_allowed@3;
};

// Graphics probe result. Can either be populated with the GraphicsInfo or an
// error retrieving the information.
[Stable]
union GraphicsResult {
  // Valid GraphicsInfo.
  GraphicsInfo graphics_info;
  // The error that occurred attempting to retrieve the GraphicsInfo.
  ProbeError error;
};

// Graphics information.
//
// NextMinVersion: 1, NextIndex: 2
[Stable]
struct GraphicsInfo {
  // OpenGL | ES information.
  GLESInfo gles_info@0;
  // EGL information.
  EGLInfo egl_info@1;
};

// NextMinVersion: 1, NextIndex: 5
[Stable]
struct GLESInfo {
  // GL version.
  string version@0;
  // GL shading version.
  string shading_version@1;
  // GL vendor.
  string vendor@2;
  // GL renderer.
  string renderer@3;
  // GL extensions.
  array<string> extensions@4;
};

// NextMinVersion: 1, NextIndex: 4
[Stable]
struct EGLInfo {
  // EGL version.
  string version@0;
  // EGL vendor.
  string vendor@1;
  // EGL client API.
  string client_api@2;
  // EGL extensions.
  array<string> extensions@3;
};

// Display result.
[Stable]
union DisplayResult {
  // Valid DisplayInfo.
  DisplayInfo display_info;
  // The error that occurred attempting to retrieve the DisplayInfo.
  ProbeError error;
};

// Display information.
//
// NextMinVersion: 2, NextIndex: 2
[Stable]
struct DisplayInfo {
  // Embedded display info.
  EmbeddedDisplayInfo embedded_display@0;
  // External display info.
  [MinVersion=1]
  array<ExternalDisplayInfo>? external_displays@1;
};

// NextMinVersion: 3, NextIndex: 15
[Stable]
struct EmbeddedDisplayInfo {
  // 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.
  [MinVersion=1]
  NullableUint32? display_width@2;
  // Display height in millimeters.
  [MinVersion=1]
  NullableUint32? display_height@3;
  // Horizontal resolution.
  [MinVersion=1]
  NullableUint32? resolution_horizontal@4;
  // Vertical resolution.
  [MinVersion=1]
  NullableUint32? resolution_vertical@5;
  // Refresh rate.
  [MinVersion=1]
  NullableDouble? refresh_rate@6;
  // Three letter manufacturer ID.
  [MinVersion=2]
  string? manufacturer@7;
  // Manufacturer product code.
  [MinVersion=2]
  NullableUint16? model_id@8;
  // 32 bits serial number.
  [MinVersion=2]
  NullableUint32? serial_number@9;
  // Week of manufacture.
  [MinVersion=2]
  NullableUint8? manufacture_week@10;
  // Year of manufacture.
  [MinVersion=2]
  NullableUint16? manufacture_year@11;
  // EDID version.
  [MinVersion=2]
  string? edid_version@12;
  // Digital or analog input.
  [MinVersion=2]
  DisplayInputType input_type@13;
  // Name of display product.
  [MinVersion=2]
  string? display_name@14;
};

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

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

// Information related to a Thunderbolt device.
//
// NextMinVersion: 1, NextIndex: 8
[Stable]
struct ThunderboltBusInterfaceInfo {
  // Vendor name of connected device interface.
  string vendor_name@0;
  // Product name of connected device interface.
  string device_name@1;
  // Type of device.
  string device_type@2;
  // The device unique id.
  string device_uuid@3;
  // Transmit link speed for thunderbolt interface.
  uint32 tx_speed_gbs@4;
  // Receive link speed for thunderbolt interface.
  uint32 rx_speed_gbs@5;
  // Connection is authorized or not.
  bool authorized@6;
  // nvm firmware version.
  string device_fw_version@7;
};

// NextMinVersion: 1, NextIndex: 6
[Stable, Extensible]
enum ThunderboltSecurityLevel {
  [Default] kNone = 0,
  kUserLevel = 1,
  kSecureLevel = 2,
  kDpOnlyLevel = 3,
  kUsbOnlyLevel = 4,
  kNoPcieLevel = 5,
};

// NextMinVersion: 1, NextIndex: 2
[Stable]
struct ThunderboltBusInfo {
  // Security level none, user, secure, dponly.
  ThunderboltSecurityLevel security_level@0;
  // Info of devices attached to the controller.
  array<ThunderboltBusInterfaceInfo> thunderbolt_interfaces@1;
};

// Input result.
[Stable]
union InputResult {
  // Valid InputInfo.
  InputInfo input_info;
  // The error that occurred attempting to retrieve the InputInfo.
  ProbeError error;
};

// Input software and hardware information.
//
// NextMinVersion: 2, NextIndex: 3
[Stable]
struct InputInfo {
  // The touchpad library name used by the input stack.
  string touchpad_library_name@0;
  // The touchscreen devices.
  array<TouchscreenDevice> touchscreen_devices@1;
  // The touchpad devices.
  [MinVersion=1]
  array<TouchpadDevice>? touchpad_devices@2;
};

// Data of a touch screen device.
//
// NextMinVersion: 1, NextIndex: 4
[Stable]
struct TouchscreenDevice {
  // The input device of this touchscreen.
  InputDevice input_device@0;
  // Number of touch points this device supports (0 if unknown).
  int32 touch_points@1;
  // True if the specified touchscreen device is stylus capable.
  bool has_stylus@2;
  // True if there is a garage/dock switch associated with the stylus.
  bool has_stylus_garage_switch@3;
};

// Data of a touchpad device.
//
// NextMinVersion: 2, NextIndex: 4
[Stable]
struct TouchpadDevice {
  // The input device of this touchpad.
  InputDevice input_device@0;
  // The kernel driver in use.
  string driver_name@1;
  // The touchpad vendor id
  [MinVersion=1]
  string? vendor_id@2;
  // the touchpad product id
  [MinVersion=1]
  string? product_id@3;
};

// Data of a input device.
//
// NextMinVersion: 1, NextIndex: 4
[Stable]
struct InputDevice {
  // Name of the device.
  string name@0;

  // The connection type of the input device.
  [Stable, Extensible]
  enum ConnectionType {
    // For mojo backward compatibility.
    [Default] kUnmappedEnumField,
    // Internally connected input device.
    kInternal,
    // Known externally connected usb input device.
    kUSB,
    // Known externally connected bluetooth input device.
    kBluetooth,
    // Device that may or may not be an external device.
    kUnknown,
  };

  ConnectionType connection_type@1;
  // The physical location(port) associated with the input device. This is
  // (supposed to be) stable between reboots and hotplugs. However this may not
  // always be set and will change when the device is connected via a different
  // port.
  string physical_location@2;
  // If the device is enabled, and whether events should be dispatched to UI.
  bool is_enabled@3;
};

// Sensor result.
[Stable]
union SensorResult {
  // Valid SensorInfo.
  SensorInfo sensor_info;
  // The error that occurred attempting to retrieve the SensorInfo.
  ProbeError error;
};

// Sensor information and related metrics.
//
// NextMinVersion: 2, NextIndex: 2
[Stable]
struct SensorInfo {
  // Angle between lid and base.
  NullableUint16? lid_angle@0;
  // Information about the device's sensors.
  [MinVersion=1]
  array<Sensor>? sensors@1;
};

// Data of a sensor.
//
// NextMinVersion: 1, NextIndex: 4
[Stable]
struct Sensor {
  // The name of sensor.
  string? name@0;
  // The ID of sensor.
  int32 device_id@1;

  // The supported sensor types.
  //
  // NextMinVersion: 2, NextIndex: 7
  [Stable, Extensible]
  enum Type {
    // For mojo backward compatibility, should not be used.
    [Default] kUnmappedEnumField = 0,
    // Accelerometer.
    kAccel = 1,
    // Light sensor.
    kLight = 2,
    // Angular velocity sensor, also known as Gyro sensor.
    kGyro = 3,
    // Angle sensor.
    kAngle = 4,
    // Gravity sensor.
    kGravity = 5,
    // Magnetometer.
    [MinVersion=1] kMagn = 6,
  };
  Type type@2;

  // The location of sensor.
  //
  // NextMinVersion: 1, NextIndex: 5
  [Stable, Extensible]
  enum Location {
    // For mojo backward compatibility, should not be used.
    [Default] kUnmappedEnumField = 0,
    // Unknown location.
    kUnknown = 1,
    kBase = 2,
    kLid = 3,
    kCamera = 4,
  };
  Location location@3;
};

// Thermal result.
[Stable]
union ThermalResult {
  // Valid ThermalInfo.
  ThermalInfo thermal_info;
  // The error that occurred attempting to retrieve the ThermalInfo.
  ProbeError error;
};

// Information about the various thermal sensors.
//
// NextMinVersion: 1, NextIndex: 1
[Stable]
struct ThermalInfo {
  // An array containing all the information retrieved for thermal sensors.
  array<ThermalSensorInfo> thermal_sensors@0;
};

// Information about various thermal sensors.
//
// NextMinVersion: 1, NextIndex: 3
[Stable]
struct ThermalSensorInfo {
  // The location of sensor.
  //
  // NextMinVersion: 1, NextIndex: 3
  [Stable, Extensible]
  enum ThermalSensorSource {
    // 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,
  };

  // 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.
  ThermalSensorSource source@2;
};

// 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.
//
// NextMinVersion: 7, NextIndex: 23
[Stable]
struct TelemetryInfo {
  // Information about the device's main battery. Only present when kBattery was
  // included in the categories input to ProbeTelemetryInfo.
  BatteryResult? 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.
  NonRemovableBlockDeviceResult? block_device_result@1;
  // Information about each of the device's CPUs. Only present when kCpu was
  // included in the categories input to ProbeTelemetryInfo.
  CpuResult? cpu_result@2;
  // Information about the device's timezone. Only present when kTimezone was
  // included in the categories input to ProbeTelemetryInfo.
  TimezoneResult? timezone_result@3;
  // Information about the system's memory. Only present when kMemory was
  // included in the categories input to ProbeTelemetryInfo.
  MemoryResult? memory_result@4;
  // Information about all of the device's backlights. Only present when
  // kBacklight was included in the categories input to ProbeTelemetryInfo.
  BacklightResult? backlight_result@5;
  // Information about each of the device's fans. Only present when kFan was
  // included in the categories input to ProbeTelemetryInfo.
  FanResult? fan_result@6;
  // Information about the stateful partition. Only present when
  // kStatefulPartition was included in the categories input to
  // ProbeTelemetryInfo.
  StatefulPartitionResult? stateful_partition_result@7;
  // Information about the device's Bluetooth adapters and devices. Only present
  // when kBluetooth was included in the categories input to ProbeTelemetryInfo.
  BluetoothResult? bluetooth_result@8;
  // Information about the system. DEPRECATED.
  DEPRECATED_SystemResult? deprecated_system_result@9;
  // Information about the networking devices and associated networks of the
  // system. Only present when kNetwork was included in the categories input to
  // ProbeTelemetryInfo.
  NetworkResult? network_result@10;
  // Information about the audio devices. Only present when kAudio was included
  // in the categories input to ProbeTelemetryInfo.
  AudioResult? audio_result@11;
  // Information about boot performance. Only present when kBootPerformance was
  // included in the categories input to ProbeTelemetryInfo.
  BootPerformanceResult? boot_performance_result@12;
  // Information about the bus devices. Only present when kBus was included in
  // the categories input to ProbeTelemetryInfo.
  BusResult? bus_result@13;
  // Information about the system. Only present when kSystem was included in the
  // categories input to ProbeTelemetryInfo.
  SystemResult? system_result@14;
  // Information about the tpm. Only present when kTpm was included in the
  // categories input to ProbeTelemetryInfo.
  TpmResult? tpm_result@15;
  // Information about the graphics. Only present when kGraphics was included in
  // the categories input to ProbeTelemetryInfo.
  GraphicsResult? graphics_result@16;
  // Information about the display. Only present when kDisplay was included in
  // the categories input to ProbeTelemetryInfo.
  [MinVersion=1]
  DisplayResult? display_result@17;
  // Information about the network interfaces. Only present when
  // kNetworkInterface was included in the categories input to
  // ProbeTelemetryInfo.
  [MinVersion=2]
  NetworkInterfaceResult? network_interface_result@18;
  // Information about the input software and hardware. Only present when kInput
  // was included in the categories input to ProbeTelemetryInfo.
  [MinVersion=3]
  InputResult? input_result@19;
  // Information about audio hardware. Only present when kAudioHardware was
  // included.
  [MinVersion=4]
  AudioHardwareResult? audio_hardware_result@20;
  // Information about sensor. Only present when kSensor was included.
  [MinVersion=5]
  SensorResult? sensor_result@21;
  // Information about thermal. Only present when kThermal was included.
  [MinVersion=6]
  ThermalResult? thermal_result@22;
};