File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
framework_lib/src/commandline Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -1163,11 +1163,15 @@ pub fn analyze_capsule(data: &[u8]) -> Option<capsule::EfiCapsuleHeader> {
1163
1163
fn handle_charge_limit ( ec : & CrosEc , maybe_limit : Option < u8 > ) -> EcResult < ( ) > {
1164
1164
let ( cur_min, _cur_max) = ec. get_charge_limit ( ) ?;
1165
1165
if let Some ( limit) = maybe_limit {
1166
- // Prevent accidentally setting a very low limit
1166
+ // Prevent setting unreasonable limits
1167
1167
if limit < 25 {
1168
1168
return Err ( EcError :: DeviceError (
1169
1169
"Not recommended to set charge limit below 25%" . to_string ( ) ,
1170
1170
) ) ;
1171
+ } else if limit > 100 {
1172
+ return Err ( EcError :: DeviceError (
1173
+ "Charge limit cannot be set above 100%" . to_string ( ) ,
1174
+ ) ) ;
1171
1175
}
1172
1176
ec. set_charge_limit ( cur_min, limit) ?;
1173
1177
}
You can’t perform that action at this time.
0 commit comments