| // 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. |
| |
| module crosapi.mojom; |
| |
| import "chromeos/crosapi/mojom/nullable_primitives.mojom"; |
| import "chromeos/services/network_health/public/mojom/network_health.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: 14 |
| [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, |
| }; |
| |
| // 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; |
| }; |
| |
| // 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: 5 |
| [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; |
| }; |
| |
| // 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. |
| [Stable] |
| struct ProbeOsInfo { |
| // Contents of CrosConfig in /branding/oem-name. |
| string? oem_name@0; |
| // OS Version information. |
| [MinVersion=1] ProbeOsVersion? os_version@1; |
| }; |
| |
| // 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; |
| }; |
| |
| // 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: 13 |
| [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; |
| }; |
| |
| // Result of running /usr/share/cros/oemdata.sh script. |
| [Stable] |
| struct ProbeOemData { |
| string? oem_data@0; |
| }; |