From 7eedcc506c4f9973c2cd47af22f6b0fbc413f8e7 Mon Sep 17 00:00:00 2001 From: Mike Choi Date: Wed, 31 Oct 2018 19:57:26 -0700 Subject: [PATCH] minipack: fix sim led handler issue (#104) Summary: SIM led may not change in time if interval(0) - 1 = 255. Pull Request resolved: https://github.com/facebookexternal/openbmc.accton/pull/104 Test Plan: Build and verify on minipack system. Reviewed By: benwei13 fbshipit-source-id: 2d433ea30 --- .../front-paneld/files/front-paneld.c | 48 +++++++++++-------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/meta-facebook/meta-minipack/recipes-minipack/front-paneld/files/front-paneld.c b/meta-facebook/meta-minipack/recipes-minipack/front-paneld/files/front-paneld.c index 23082a0a97f7..761eccb6a7d7 100644 --- a/meta-facebook/meta-minipack/recipes-minipack/front-paneld/files/front-paneld.c +++ b/meta-facebook/meta-minipack/recipes-minipack/front-paneld/files/front-paneld.c @@ -299,29 +299,37 @@ simLED_monitor_handler(void *unused) { while(1) { sleep(1); pal_mon_fw_upgrade(brd_rev, &sys_ug, &fan_ug, &psu_ug, &smb_ug); - if(sys_ug == 0 && interval[0] == 0) { - interval[0] = INTERVAL_MAX; - set_sys_led(brd_rev); - } else { - interval[0]--; + if (sys_ug == 0) { + if (interval[0] == 0) { + interval[0] = INTERVAL_MAX; + set_sys_led(brd_rev); + } else { + interval[0]--; + } } - if(fan_ug == 0 && interval[1] == 0) { - interval[1] = INTERVAL_MAX; - set_fan_led(brd_rev); - } else { - interval[1]--; + if (fan_ug == 0) { + if (interval[1] == 0) { + interval[1] = INTERVAL_MAX; + set_fan_led(brd_rev); + } else { + interval[1]--; + } } - if(psu_ug == 0 && interval[2] == 0) { - interval[2] = INTERVAL_MAX; - set_psu_led(brd_rev); - } else { - interval[2]--; + if (psu_ug == 0) { + if (interval[2] == 0) { + interval[2] = INTERVAL_MAX; + set_psu_led(brd_rev); + } else { + interval[2]--; + } } - if(smb_ug == 0 && interval[3] == 0) { - interval[3] = INTERVAL_MAX; - set_smb_led(brd_rev); - } else { - interval[3]--; + if (smb_ug == 0) { + if (interval[3] == 0) { + interval[3] = INTERVAL_MAX; + set_smb_led(brd_rev); + } else { + interval[3]--; + } } } return 0;