@@ -395,6 +395,7 @@ mod expression {
395395 named ! ( power_supply_discharge_rate => "%power-supply-discharge-rate" ) ;
396396
397397 named ! ( discharging => "?discharging" ) ;
398+ named ! ( intel_pstate => "?intel-pstate" ) ;
398399}
399400
400401#[ derive( Serialize , Deserialize , Debug , Clone , PartialEq ) ]
@@ -454,6 +455,9 @@ pub enum Expression {
454455 #[ serde( with = "expression::discharging" ) ]
455456 Discharging ,
456457
458+ #[ serde( with = "expression::intel_pstate" ) ]
459+ IntelPstate ,
460+
457461 Boolean ( bool ) ,
458462
459463 Number ( f64 ) ,
@@ -615,7 +619,8 @@ pub struct EvalState<'peripherals, 'context> {
615619 pub power_supply_charge : Option < f64 > ,
616620 pub power_supply_discharge_rate : Option < f64 > ,
617621
618- pub discharging : bool ,
622+ pub discharging : bool ,
623+ pub intel_pstate : bool ,
619624
620625 pub context : EvalContext < ' context > ,
621626
@@ -748,6 +753,7 @@ impl Expression {
748753 } ,
749754
750755 Discharging => Boolean ( state. discharging ) ,
756+ IntelPstate => Boolean ( state. intel_pstate ) ,
751757
752758 literal @ ( Boolean ( _) | Number ( _) | String ( _) ) => literal. clone ( ) ,
753759
@@ -1039,6 +1045,7 @@ mod tests {
10391045 power_supply_charge: Some ( 0.8 ) ,
10401046 power_supply_discharge_rate: Some ( 10.0 ) ,
10411047 discharging: false ,
1048+ intel_pstate: false ,
10421049 context: EvalContext :: Cpu ( & cpu) ,
10431050 cpus: & cpus,
10441051 power_supplies: & power_supplies,
@@ -1123,6 +1130,7 @@ mod tests {
11231130 power_supply_charge : Some ( 0.8 ) ,
11241131 power_supply_discharge_rate : Some ( 10.0 ) ,
11251132 discharging : false ,
1133+ intel_pstate : false ,
11261134 context : EvalContext :: Cpu ( & cpu) ,
11271135 cpus : & cpus,
11281136 power_supplies : & power_supplies,
0 commit comments