// Copyright (c) 2013 The Chromium OS Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. syntax = "proto2"; option optimize_for = LITE_RUNTIME; package power_manager; // Power supply status sent from powerd to Chrome. message PowerSupplyProperties { // For any of these power sources, the system may be consuming power at a high // enough rate that the battery is discharging rather than charging; see // BatteryState. See the PowerSource submessage's |type| field for more // details about the active power source. enum ExternalPower { // AC/line/mains or USB PD power is connected. This is typically the // highest-power source that can be attached to the system. AC = 0; // A low-power USB source (SDP, DCP, CDP, or ACA) is connected. USB = 1; // No external power source is connected. DISCONNECTED = 2; // Next value to use: 4 } enum BatteryState { // The battery is full or close to full. FULL = 0; // The battery is being charged but is not yet full. CHARGING = 1; // The battery is discharging. Note that an external power source may be // connected but not supplying enough power to offset the system's // instantaneous power consumption. This state is also used if the battery // is neither charging nor discharging (i.e. current is zero) in a non-full // state, which may indicate a battery defect. DISCHARGING = 2; // The system doesn't have a battery. NOT_PRESENT = 3; // Next value to use: 4 } // Details about a potential source of power to the system. message PowerSource { enum Port { // The location of the port is unknown, or there's only one port. UNKNOWN = 0; // Various positions on the device. The first word describes the side of // the device where the port is located while the second clarifies the // position. For example, LEFT_BACK means the farthest-back port on the // left side, while BACK_LEFT means the leftmost port on the back of the // device. LEFT = 1; RIGHT = 2; BACK = 3; FRONT = 4; LEFT_FRONT = 5; LEFT_BACK = 6; RIGHT_FRONT = 7; RIGHT_BACK = 8; BACK_LEFT = 9; BACK_RIGHT = 10; // Next value to use: 11 } enum Type { // Unspecified type. OTHER = 0; // Dedicated charger. Typically single-purpose and non-USB (e.g. barrel // jack plugs). Corresponds to kernel-reported type "Mains". This source // is reported by the ACPI driver and may also appear (along with a USB_PD // source) on Type-C-only systems if the ACPI driver is present. MAINS = 1; // USB Type-C, including dedicated Type-C chargers. Typically >= 7.5W. // Corresponds to kernel-reported types "USB_C", "USB_PD", "USB_PD_DRP", // and "BrickID". USB_C = 2; // USB Battery Charging r1.2. Typically <= 7.5W. Corresponds to // kernel-reported types "USB", "USB_ACA", "USB_CDP", and "USB_DCP". USB_BC_1_2 = 3; // Next value to use: 4 } // Opaque ID corresponding to the device. Do not use this for any purpose // beyond comparisons with |external_power_source_id| or as an argument to // powerd's SetPowerSource D-Bus method. optional string id = 1; // The charging port to which this power source is connected. optional Port port = 7; // Power source type. optional Type type = 8; // Raw strings read from |manufacturer| and |model_name| files in sysfs. optional string manufacturer_id = 4; optional string model_id = 5; // Maximum power this source is capable of delivering, in watts. optional double max_power = 6; // True if the power source will automatically deliver charge to the system // when connected (assuming there isn't another |active_by_default| source // doing so). If false, the source will not deliver charge unless requested // to do so by the user. optional bool active_by_default = 3; // Next ID to use: 9 } // Current state of the external power source. optional ExternalPower external_power = 14; // ID of the PowerSource that is currently providing power to the system. optional string external_power_source_id = 17; // Currently-connected external power sources. repeated PowerSource available_external_power_source = 18; // Current state of the battery. optional BatteryState battery_state = 15; // Estimated battery charge as a percent of its total capacity, in the // range [0.0, 100.0]. Unset if a battery isn't present. optional double battery_percent = 7 [default = -1.0]; // Estimated time until the battery is empty, in seconds, or zero if the // battery isn't discharging. -1 if the estimated time would be huge // (e.g. because the current is zero or close to zero). Unset if a battery // isn't present. optional int64 battery_time_to_empty_sec = 5; // Estimated time until the battery is full, in seconds, or zero if the // battery isn't charging. -1 if the estimated time would be huge (e.g. // because the current is zero or close to zero). Unset if a battery isn't // present. optional int64 battery_time_to_full_sec = 6; // True when |battery_time_to_*| can't be trusted, e.g. because the power // source just changed. Unset if a battery isn't present. optional bool is_calculating_battery_time = 12 [default = false]; // The battery discharge rate measured in W. Positive if the battery is being // discharged, negative if it's being charged, or unset if a battery isn't // present. optional double battery_discharge_rate = 16; // True if it is possible for some connected devices to function as either // sources or sinks (i.e. to either deliver or receive charge). optional bool supports_dual_role_devices = 19; // Next ID to use: 20 }