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> | 2019-04-19 22:07:46 +0000 |
commit | 26a78ab15690be7421bb000bc473cd0bdfd8ad15 (patch) | |
tree | 3b236643fc7548ead37635ecda4d2f91ead6f762 | |
parent | 696aed8abe58696e5eb173da38b848825523883a (diff) | |
download | phosphor-fan-presence-26a78ab15690be7421bb000bc473cd0bdfd8ad15.tar.gz phosphor-fan-presence-26a78ab15690be7421bb000bc473cd0bdfd8ad15.zip |
Allow per-zone preconditions
This lays the groundwork for CPU population-dependent fan control
-rwxr-xr-x | control/gen-fan-zone-defs.py | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/control/gen-fan-zone-defs.py b/control/gen-fan-zone-defs.py index a5e4809..8d32b7f 100755 --- a/control/gen-fan-zone-defs.py +++ b/control/gen-fan-zone-defs.py @@ -636,10 +636,29 @@ 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 'groups' in p: + for g in p['groups']: + if 'zone_conditions' in g: + zone_allowed = False + for zc in g['zone_conditions']: + if 'zones' in zc: + 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: |