// 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 diagnostics API exposed by the cros_healthd daemon. This
// API is normally consumed by the browser and the diag command-line tool.
// NOTE: This mojom should be kept in sync with the copy in Chromium's repo in
// src/platform2/diagnostics/mojom/public/cros_healthd_diagnostics.mojom.
module ash.cros_healthd.mojom;
// Special id that will be returned if a routine was unable to be created.
const int32 kFailedToStartId = 0;
// Enumeration of each of the diagnostics routines the platform may support.
//
// NextMinVersion: 13, NextIndex: 48
[Stable, Extensible]
enum DiagnosticRoutineEnum {
[Default] kUnknown = 30,
kBatteryCapacity = 0,
kBatteryHealth = 1,
kUrandom = 2,
kSmartctlCheck = 3,
kAcPower = 4,
kCpuCache = 5,
kCpuStress = 6,
kFloatingPointAccuracy = 7,
DEPRECATED_kNvmeWearLevel = 8,
kNvmeSelfTest = 9,
kDiskRead = 10,
kPrimeSearch = 11,
kBatteryDischarge = 12,
kBatteryCharge = 13,
kMemory = 14,
kLanConnectivity = 15,
kSignalStrength = 16,
kGatewayCanBePinged = 17,
kHasSecureWiFiConnection = 18,
kDnsResolverPresent = 19,
kDnsLatency = 20,
kDnsResolution = 21,
kCaptivePortal = 22,
kHttpFirewall = 23,
kHttpsFirewall = 24,
kHttpsLatency = 25,
kVideoConferencing = 26,
kArcHttp = 27,
kArcPing = 28,
kArcDnsResolution = 29,
[MinVersion=1] kSensitiveSensor = 31,
[MinVersion=2] kFingerprint = 32,
[MinVersion=2] kFingerprintAlive = 33,
[MinVersion=3] kPrivacyScreen = 34,
[MinVersion=4] DEPRECATED_kLedLitUp = 35,
[MinVersion=5] kSmartctlCheckWithPercentageUsed = 36,
[MinVersion=6] kEmmcLifetime = 37,
[MinVersion=7] DEPRECATED_kAudioSetVolume = 38,
[MinVersion=7] DEPRECATED_kAudioSetGain = 39,
[MinVersion=8] kBluetoothPower = 40,
[MinVersion=8] kBluetoothDiscovery = 41,
[MinVersion=8] kBluetoothScanning = 42,
[MinVersion=8] kBluetoothPairing = 43,
[MinVersion=9] kPowerButton = 44,
[MinVersion=10] kAudioDriver = 45,
[MinVersion=11] kUfsLifetime = 46,
[MinVersion=12] kFan = 47,
};
// Enumeration of the possible DiskRead routine's command type
//
// NextMinVersion: 1, NextIndex: 3
[Stable, Extensible]
enum DiskReadRoutineTypeEnum {
// This is required for backwards compatibility, should not be used.
[Default] kUnmappedEnumField = 2,
kLinearRead = 0,
kRandomRead = 1,
};
// Enumeration of each of the possible statuses for a diagnostics routine.
//
// NextMinVersion: 1, NextIndex: 13
[Stable, Extensible]
enum DiagnosticRoutineStatusEnum {
[Default] kUnknown = 12,
// Routine is ready to start.
kReady = 0,
// Routine is currently running.
kRunning = 1,
// Routine needs user input to continue.
kWaiting = 2,
// Routine completed and passed.
kPassed = 3,
// Routine completed and failed.
kFailed = 4,
// An error prevented the routine from completing.
kError = 5,
// Routine was cancelled before completion. A cancelled routine's information
// can still be accessed with a GetRoutineUpdateRequest.
kCancelled = 6,
// Routine could not be created.
kFailedToStart = 7,
// Routine has been removed and is no longer valid.
kRemoved = 8,
// Routine is in the process of being cancelled.
kCancelling = 9,
// Routine is not supported by the device.
kUnsupported = 10,
// Routine was not run because it is currently not applicable.
kNotRun = 11,
};
// Enumeration of each of the messages a diagnostics routine can pass back.
// These messages prompt interaction from the user of the routine.
//
// NextMinVersion: 3, NextIndex: 5
[Stable, Extensible]
enum DiagnosticRoutineUserMessageEnum {
[Default] kUnknown = 2,
// The user needs to unplug the AC power cord.
kUnplugACPower = 0,
// The user needs to plug in the AC power cord.
kPlugInACPower = 1,
// The user needs to check the LED color.
[MinVersion=1] kCheckLedColor = 3,
// The user needs to press the power button.
[MinVersion=2] kPressPowerButton = 4,
};
// Enumeration of the possible commands to send a diagnostics routine.
//
// NextMinVersion: 1, NextIndex: 5
[Stable, Extensible]
enum DiagnosticRoutineCommandEnum {
[Default] kUnknown = 4,
// Resume a routine that is waiting.
kContinue = 0,
// Cancelled routines must still be removed before the routine is destroyed.
kCancel = 1,
// Used to get status but not otherwise control a routine.
kGetStatus = 2,
// All routines which started successfully must be removed, otherwise they
// will persist on the system. This makes sure the routine is terminated
// before removing it.
kRemove = 3,
};
// Generic return value for a RunSomeRoutine call.
//
// NextMinVersion: 1, NextIndex: 2
[Stable]
struct RunRoutineResponse {
// Unique identifier for the newly-created routine. An id of kFailedToStartId
// means that the routine was unable to be created. Can be used in a
// GetRoutineUpdate call to control or get the status of the created routine.
int32 id@0;
// Current status of the newly-created routine. A status of kFailedToStart
// means the routine was unable to be created.
DiagnosticRoutineStatusEnum status@1;
};
// Status fields specific to interactive routines.
//
// NextMinVersion: 1, NextIndex: 1
[Stable]
struct InteractiveRoutineUpdate {
// Request for user action. This message should be localized and displayed to
// the user.
DiagnosticRoutineUserMessageEnum user_message@0;
};
// Status fields specific to noninteractive routines.
//
// NextMinVersion: 1, NextIndex: 2
[Stable]
struct NonInteractiveRoutineUpdate {
// Current status of the routine.
DiagnosticRoutineStatusEnum status@0;
// More detailed status - for example, if |status| was kError,
// |status_message| would describe the error encountered, like "failed to read
// file."
string status_message@1;
};
// Responses will be either interactive or noninteractive.
[Stable]
union RoutineUpdateUnion {
InteractiveRoutineUpdate interactive_update;
NonInteractiveRoutineUpdate noninteractive_update;
};
// Response type for GetRoutineUpdate.
//
// NextMinVersion: 1, NextIndex: 3
[Stable]
struct RoutineUpdate {
// Percent complete, must be between 0 and 100, inclusive.
uint32 progress_percent@0;
// Any accumulated output, like logs, from the routine. This field is only
// valid when GetRoutineUpdate (see cros_healthd.mojom) is called with
// include_output = true.
handle? output@1;
// Information specific to the type of response - interactive or
// noninteractive.
RoutineUpdateUnion routine_update_union@2;
};
// Enumeration of the possible statuses for a power supply in the AC power
// routine.
//
// NextMinVersion: 1, NextIndex: 3
[Stable, Extensible]
enum AcPowerStatusEnum {
[Default] kUnknown = 2,
// Power supply is connected.
kConnected = 0,
// Power supply is disconnected.
kDisconnected = 1,
};
// Enumeration of the self-test type in nvme_self_test routine
//
// NextMinVersion: 1, NextIndex: 3
[Stable, Extensible]
enum NvmeSelfTestTypeEnum {
[Default] kUnknown = 2,
// Short time self-test.
kShortSelfTest = 0,
// Long time self-test.
kLongSelfTest = 1,
};
// Enumeration of each possible LEDs on a device. This enum type is a mirror of
// the enums defined in EC. To find out the actual names of each installed LEDs,
// please refer to the EC firmware.
//
// NextMinVersion: 1, NextIndex: 6
[Stable, Extensible]
enum DEPRECATED_LedName {
// The default value is for backward compatibility, should not be used.
[Default] kUnmappedEnumField = 0,
kBattery = 1,
kPower = 2,
kAdapter = 3,
kLeft = 4,
kRight = 5,
};
// Enumeration of each possible supported LED colors.
//
// NextMinVersion: 1, NextIndex: 7
[Stable, Extensible]
enum DEPRECATED_LedColor {
// The default value is for backward compatibility, should not be used.
[Default] kUnmappedEnumField = 0,
kRed = 1,
kGreen = 2,
kBlue = 3,
kYellow = 4,
kWhite = 5,
kAmber = 6,
};
// Replier interface for LED lit up routine.
//
// NextMinVersion: 1, NextIndex: 1
[Stable]
interface DEPRECATED_LedLitUpRoutineReplier {
// Returns whether the actual LED color matches the expected color.
//
// The response:
// * |matched| - true if the actual LED color matches the expected color.
// Otherwise, false.
GetColorMatched@0() => (bool matched);
};