• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5syntax = "proto2";
6
7option optimize_for = LITE_RUNTIME;
8
9package power_manager;
10
11// Power supply status sent from powerd to Chrome.
12message PowerSupplyProperties {
13  // For any of these power sources, the system may be consuming power at a high
14  // enough rate that the battery is discharging rather than charging; see
15  // BatteryState. See the PowerSource submessage's |type| field for more
16  // details about the active power source.
17  enum ExternalPower {
18    // AC/line/mains or USB PD power is connected. This is typically the
19    // highest-power source that can be attached to the system.
20    AC = 0;
21
22    // A low-power USB source (SDP, DCP, CDP, or ACA) is connected.
23    USB = 1;
24
25    // No external power source is connected.
26    DISCONNECTED = 2;
27
28    // Next value to use: 4
29  }
30
31  enum BatteryState {
32    // The battery is full or close to full.
33    FULL = 0;
34
35    // The battery is being charged but is not yet full.
36    CHARGING = 1;
37
38    // The battery is discharging. Note that an external power source may be
39    // connected but not supplying enough power to offset the system's
40    // instantaneous power consumption. This state is also used if the battery
41    // is neither charging nor discharging (i.e. current is zero) in a non-full
42    // state, which may indicate a battery defect.
43    DISCHARGING = 2;
44
45    // The system doesn't have a battery.
46    NOT_PRESENT = 3;
47
48    // Next value to use: 4
49  }
50
51  // Details about a potential source of power to the system.
52  message PowerSource {
53    enum Port {
54      // The location of the port is unknown, or there's only one port.
55      UNKNOWN = 0;
56
57      // Various positions on the device. The first word describes the side of
58      // the device where the port is located while the second clarifies the
59      // position. For example, LEFT_BACK means the farthest-back port on the
60      // left side, while BACK_LEFT means the leftmost port on the back of the
61      // device.
62      LEFT        = 1;
63      RIGHT       = 2;
64      BACK        = 3;
65      FRONT       = 4;
66      LEFT_FRONT  = 5;
67      LEFT_BACK   = 6;
68      RIGHT_FRONT = 7;
69      RIGHT_BACK  = 8;
70      BACK_LEFT   = 9;
71      BACK_RIGHT  = 10;
72
73      // Next value to use: 11
74    }
75
76    enum Type {
77      // Unspecified type.
78      OTHER = 0;
79
80      // Dedicated charger. Typically single-purpose and non-USB (e.g. barrel
81      // jack plugs). Corresponds to kernel-reported type "Mains". This source
82      // is reported by the ACPI driver and may also appear (along with a USB_PD
83      // source) on Type-C-only systems if the ACPI driver is present.
84      MAINS = 1;
85
86      // USB Type-C, including dedicated Type-C chargers. Typically >= 7.5W.
87      // Corresponds to kernel-reported types "USB_C", "USB_PD", "USB_PD_DRP",
88      // and "BrickID".
89      USB_C = 2;
90
91      // USB Battery Charging r1.2. Typically <= 7.5W. Corresponds to
92      // kernel-reported types "USB", "USB_ACA", "USB_CDP", and "USB_DCP".
93      USB_BC_1_2 = 3;
94
95      // Next value to use: 4
96    }
97
98    // Opaque ID corresponding to the device. Do not use this for any purpose
99    // beyond comparisons with |external_power_source_id| or as an argument to
100    // powerd's SetPowerSource D-Bus method.
101    optional string id = 1;
102
103    // The charging port to which this power source is connected.
104    optional Port port = 7;
105
106    // Power source type.
107    optional Type type = 8;
108
109    // Raw strings read from |manufacturer| and |model_name| files in sysfs.
110    optional string manufacturer_id = 4;
111    optional string model_id = 5;
112
113    // Maximum power this source is capable of delivering, in watts.
114    optional double max_power = 6;
115
116    // True if the power source will automatically deliver charge to the system
117    // when connected (assuming there isn't another |active_by_default| source
118    // doing so). If false, the source will not deliver charge unless requested
119    // to do so by the user.
120    optional bool active_by_default = 3;
121
122    // Next ID to use: 9
123  }
124
125  // Current state of the external power source.
126  optional ExternalPower external_power = 14;
127
128  // ID of the PowerSource that is currently providing power to the system.
129  optional string external_power_source_id = 17;
130
131  // Currently-connected external power sources.
132  repeated PowerSource available_external_power_source = 18;
133
134  // Current state of the battery.
135  optional BatteryState battery_state = 15;
136
137  // Estimated battery charge as a percent of its total capacity, in the
138  // range [0.0, 100.0]. Unset if a battery isn't present.
139  optional double battery_percent = 7 [default = -1.0];
140
141  // Estimated time until the battery is empty, in seconds, or zero if the
142  // battery isn't discharging. -1 if the estimated time would be huge
143  // (e.g. because the current is zero or close to zero). Unset if a battery
144  // isn't present.
145  optional int64 battery_time_to_empty_sec = 5;
146
147  // Estimated time until the battery is full, in seconds, or zero if the
148  // battery isn't charging. -1 if the estimated time would be huge (e.g.
149  // because the current is zero or close to zero). Unset if a battery isn't
150  // present.
151  optional int64 battery_time_to_full_sec = 6;
152
153  // True when |battery_time_to_*| can't be trusted, e.g. because the power
154  // source just changed. Unset if a battery isn't present.
155  optional bool is_calculating_battery_time = 12 [default = false];
156
157  // The battery discharge rate measured in W. Positive if the battery is being
158  // discharged, negative if it's being charged, or unset if a battery isn't
159  // present.
160  optional double battery_discharge_rate = 16;
161
162  // True if it is possible for some connected devices to function as either
163  // sources or sinks (i.e. to either deliver or receive charge).
164  optional bool supports_dual_role_devices = 19;
165
166  // Next ID to use: 20
167}
168