diff options
author | Raptor Engineering Development Team <support@raptorengineering.com> | 2018-01-23 21:21:42 -0600 |
---|---|---|
committer | Raptor Engineering Development Team <support@raptorengineering.com> | 2018-01-23 21:21:42 -0600 |
commit | f1f8e04d025dd741edc11cf1660d5bf8f973cbc0 (patch) | |
tree | 6a67683205979293151ecf35efbbe767bd4fafbe | |
parent | c437adbfea21c06f1012cef30910edfda59f3d05 (diff) | |
download | phosphor-fan-presence-f1f8e04d025dd741edc11cf1660d5bf8f973cbc0.tar.gz phosphor-fan-presence-f1f8e04d025dd741edc11cf1660d5bf8f973cbc0.zip |
Allow per-zone preconditions
This lays the groundwork for CPU population-dependent fan control
-rwxr-xr-x | control/gen-fan-zone-defs.py | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/control/gen-fan-zone-defs.py b/control/gen-fan-zone-defs.py index c071aea..c35bcd3 100755 --- a/control/gen-fan-zone-defs.py +++ b/control/gen-fan-zone-defs.py @@ -604,10 +604,27 @@ def getEventsInZone(zone_num, zone_conditions, events_data): # Add precondition if given if ('precondition' in e) and \ (e['precondition'] is not None): - event['pc'] = addPrecondition(zone_num, + precondition_applies_to_zone = True + if 'events' in e['precondition']: + for p in e['precondition']['events']: + # Verify precondition applies to current zone + if 'zone_conditions' in p: + for zc in p['zone_conditions']: + if 'zones' in zc: + zone_allowed = False + for z in zc['zones']: + if z == zone_num: + zone_allowed = True + if zone_allowed == False: + precondition_applies_to_zone = False + + if precondition_applies_to_zone == True: + event['pc'] = addPrecondition(zone_num, zone_conditions, e, events_data) + else: + continue else: event = getEvent(zone_num, zone_conditions, e, events_data) if not event: |