Skip to content

Commit

Permalink
Merge pull request #80 from SW-CSA/cel_develop
Browse files Browse the repository at this point in the history
Cel develop
  • Loading branch information
MickeyZhan authored Jul 8, 2019
2 parents 37f6b8b + fa8c0fd commit 9f54a66
Show file tree
Hide file tree
Showing 12 changed files with 253 additions and 158 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1871,7 +1871,7 @@ int fan_speed_okay(const int fan, int speed, const int slop)
syslog(LOG_WARNING, "%s-1 speed %d, less than %d%% of max speed(%d) detected",
fantray->name, front_speed, 100 - slop, speed);
if(fan_info->front_failed == FAN_FAIL_COUNT)
syslog(LOG_ERR, "%s-1 status is ABNORMAL, speed is set to 100% but real speed is lower than 70% of max speed",
syslog(LOG_ERR, "%s-1 status is ABNORMAL, speed is set to 100%% but real speed is lower than 70%% of max speed",
fantray->name);
if(fan_info->front_failed > FAN_FAIL_COUNT)
fan_info->front_failed = FAN_FAIL_COUNT;
Expand Down Expand Up @@ -1906,7 +1906,7 @@ int fan_speed_okay(const int fan, int speed, const int slop)
syslog(LOG_WARNING, "%s-2 speed %d, less than %d%% of max speed(%d) detected",
fantray->name, rear_speed, 100 - slop, speed);
if(fan_info->rear_failed == FAN_FAIL_COUNT)
syslog(LOG_ERR, "%s-2 status is ABNORMAL, speed is set to 100% but real speed is lower than 70% of max speed",
syslog(LOG_ERR, "%s-2 status is ABNORMAL, speed is set to 100%% but real speed is lower than 70%% of max speed",
fantray->name);
if(fan_info->rear_failed > FAN_FAIL_COUNT)
fan_info->rear_failed = FAN_FAIL_COUNT;
Expand Down Expand Up @@ -1984,7 +1984,7 @@ int psu_speed_okay(const int fan, int speed, const int slop)
syslog(LOG_WARNING, "%s speed %d, less than %d%% of max speed(%d) detected",
fantray->name, psu_speed, 100 - slop, speed);
if(fan_info->front_failed == FAN_FAIL_COUNT)
syslog(LOG_ERR, "%s status is ABNORMAL, speed is set to 100% but real speed is lower than 70% of max speed",
syslog(LOG_ERR, "%s status is ABNORMAL, speed is set to 100%% but real speed is lower than 70%% of max speed",
fantray->name);
if(fan_info->front_failed > FAN_FAIL_COUNT)
fan_info->front_failed = FAN_FAIL_COUNT;
Expand Down Expand Up @@ -2127,11 +2127,11 @@ static int get_fan_direction(int direction)
if(pn = find_sub_string(buffer, FAN_DIR_F2B_STR, sizeof(buffer))) {
f2r_fan_cnt++;
if(fantray->direction == FAN_DIR_FAULT) {
syslog(LOG_WARNING, "%s eeprom is NORMAL", fantray->name);
if(fantray->eeprom_fail) {
syslog(LOG_WARNING, "%s eeprom is NORMAL", fantray->name);
fantray->eeprom_fail = 0;
} else
syslog(LOG_WARNING, "%s model match, part number is %s", fantray->name, FAN_DIR_F2B_STR);
fantray->eeprom_fail = 0;
}
}
fantray->direction = FAN_DIR_F2B;
if(direction != fantray->direction)
Expand All @@ -2141,11 +2141,11 @@ static int get_fan_direction(int direction)
} else if(find_sub_string(buffer, FAN_DIR_B2F_STR, sizeof(buffer))) {
r2f_fan_cnt++;
if(fantray->direction == FAN_DIR_FAULT) {
syslog(LOG_WARNING, "%s eeprom is NORMAL", fantray->name);
if(fantray->eeprom_fail) {
syslog(LOG_WARNING, "%s eeprom is NORMAL", fantray->name);
fantray->eeprom_fail = 0;
} else
syslog(LOG_WARNING, "%s model match, part number is %s", fantray->name, FAN_DIR_B2F_STR);
fantray->eeprom_fail = 0;
}
}
fantray->direction = FAN_DIR_B2F;
if(direction != fantray->direction)
Expand All @@ -2155,21 +2155,20 @@ static int get_fan_direction(int direction)
} else {
fantray->direction = FAN_DIR_FAULT;
if(ret > 0) {
fantray->eeprom_fail = 0;
fantray->eeprom_fail = 1;
syslog(LOG_CRIT, "%s model mismatch, part number is %s", fantray->name, pn);
} else {
fantray->eeprom_fail = 1;
syslog(LOG_WARNING, "%s eeprom is ABNORMAL, read %s eeprom failed", fantray->name, fantray->name);
}
}
} else {
if(pn = find_sub_string(buffer, DELTA_PSU_DIR_F2B_STR, sizeof(buffer))) {
if(fantray->direction == FAN_DIR_FAULT) {
syslog(LOG_WARNING, "%s eeprom is NORMAL", fantray->name);
if(fantray->eeprom_fail) {
syslog(LOG_WARNING, "%s eeprom is NORMAL", fantray->name);
fantray->eeprom_fail = 0;
} else
syslog(LOG_WARNING, "%s model match, part number is %s", fantray->name, DELTA_PSU_DIR_F2B_STR);
fantray->eeprom_fail = 0;
}
}
fantray->direction = FAN_DIR_F2B;
if(direction != fantray->direction)
Expand All @@ -2178,11 +2177,11 @@ static int get_fan_direction(int direction)
syslog(LOG_WARNING, "%s airflow direction match, direction is F2B, system direction is F2B", fantray->name);
} else if(find_sub_string(buffer, DELTA_PSU_DIR_B2F_STR, sizeof(buffer))) {
if(fantray->direction == FAN_DIR_FAULT) {
syslog(LOG_WARNING, "%s eeprom is NORMAL", fantray->name);
if(fantray->eeprom_fail) {
syslog(LOG_WARNING, "%s eeprom is NORMAL", fantray->name);
fantray->eeprom_fail = 0;
} else
syslog(LOG_WARNING, "%s model match, part number is %s", fantray->name, DELTA_PSU_DIR_B2F_STR);
fantray->eeprom_fail = 0;
}
}
fantray->direction = FAN_DIR_B2F;
if(direction != fantray->direction)
Expand All @@ -2191,11 +2190,11 @@ static int get_fan_direction(int direction)
syslog(LOG_WARNING, "%s airflow direction match, direction is B2F, system direction is B2F", fantray->name);
} else if(find_sub_string(buffer, ACBEL_PSU_DIR_F2B_STR, sizeof(buffer))) {
if(fantray->direction == FAN_DIR_FAULT) {
syslog(LOG_WARNING, "%s eeprom is NORMAL", fantray->name);
if(fantray->eeprom_fail) {
syslog(LOG_WARNING, "%s eeprom is NORMAL", fantray->name);
fantray->eeprom_fail = 0;
} else
syslog(LOG_WARNING, "%s model match, part number is %s", fantray->name, ACBEL_PSU_DIR_F2B_STR);
fantray->eeprom_fail = 0;
}
}
fantray->direction = FAN_DIR_F2B;
if(direction != fantray->direction)
Expand All @@ -2204,11 +2203,11 @@ static int get_fan_direction(int direction)
syslog(LOG_WARNING, "%s airflow direction match, direction is F2B, system direction is F2B", fantray->name);
} else if(find_sub_string(buffer, ACBEL_PSU_DIR_B2F_STR, sizeof(buffer))) {
if(fantray->direction == FAN_DIR_FAULT) {
syslog(LOG_WARNING, "%s eeprom is NORMAL", fantray->name);
if(fantray->eeprom_fail) {
syslog(LOG_WARNING, "%s eeprom is NORMAL", fantray->name);
fantray->eeprom_fail = 0;
} else
syslog(LOG_WARNING, "%s model match, part number is %s", fantray->name, ACBEL_PSU_DIR_B2F_STR);
fantray->eeprom_fail = 0;
}
}
fantray->direction = FAN_DIR_B2F;
if(direction != fantray->direction)
Expand All @@ -2218,10 +2217,9 @@ static int get_fan_direction(int direction)
} else {
fantray->direction = FAN_DIR_FAULT;
if(ret > 0) {
fantray->eeprom_fail = 0;
fantray->eeprom_fail = 1;
syslog(LOG_CRIT, "%s model mismatch, part number is %s", fantray->name, pn);
} else {
fantray->eeprom_fail = 1;
syslog(LOG_WARNING, "%s eeprom is ABNORMAL, read %s eeprom failed", fantray->name, fantray->name);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ static struct fantray_info_stu_sysfs fantray_info[] = {
.fan1 = fan1_info,
},
{
.name = "PSU 1-1",
.name = "PSU 1",
.present = 1,
.read_eeprom = 1,
.status = 1,
Expand All @@ -722,7 +722,7 @@ static struct fantray_info_stu_sysfs fantray_info[] = {
.fan1 = psu1_fan_info,
},
{
.name = "PSU 1-2",
.name = "PSU 2",
.present = 1,
.read_eeprom = 1,
.status = 1,
Expand All @@ -732,7 +732,7 @@ static struct fantray_info_stu_sysfs fantray_info[] = {
.fan1 = psu2_fan_info,
},
{
.name = "PSU 2-1",
.name = "PSU 3",
.present = 1,
.read_eeprom = 1,
.status = 1,
Expand All @@ -742,7 +742,7 @@ static struct fantray_info_stu_sysfs fantray_info[] = {
.fan1 = psu3_fan_info,
},
{
.name = "PSU 2-2",
.name = "PSU 4",
.present = 1,
.read_eeprom = 1,
.status = 1,
Expand Down Expand Up @@ -2031,7 +2031,7 @@ int fan_speed_okay(const int fan, int speed, const int slop)
syslog(LOG_WARNING, "%s-1 speed %d, less than %d%% of max speed(%d) detected",
fantray->name, front_speed, 100 - slop, speed);
if(fan_info->front_failed == FAN_FAIL_COUNT)
syslog(LOG_ERR, "%s-1 status is ABNORMAL, speed is set to 100% but real speed is lower than 70% of max speed",
syslog(LOG_ERR, "%s-1 status is ABNORMAL, speed is set to 100%% but real speed is lower than 70%% of max speed",
fantray->name);
if(fan_info->front_failed > FAN_FAIL_COUNT)
fan_info->front_failed = FAN_FAIL_COUNT;
Expand Down Expand Up @@ -2072,7 +2072,7 @@ int fan_speed_okay(const int fan, int speed, const int slop)
syslog(LOG_WARNING, "%s-2 speed %d, less than %d%% of max speed(%d) detected",
fantray->name, rear_speed, 100 - slop, speed);
if(fan_info->rear_failed == FAN_FAIL_COUNT)
syslog(LOG_ERR, "%s-2 status is ABNORMAL, speed is set to 100% but real speed is lower than 70% of max speed",
syslog(LOG_ERR, "%s-2 status is ABNORMAL, speed is set to 100%% but real speed is lower than 70%% of max speed",
fantray->name);
if(fan_info->rear_failed > FAN_FAIL_COUNT)
fan_info->rear_failed = FAN_FAIL_COUNT;
Expand Down Expand Up @@ -2156,7 +2156,7 @@ int psu_speed_okay(const int fan, int speed, const int slop)
syslog(LOG_WARNING, "%s speed %d, less than %d%% of max speed(%d) detected",
fantray->name, psu_speed, 100 - slop, speed);
if(fan_info->front_failed == FAN_FAIL_COUNT)
syslog(LOG_ERR, "%s status is ABNORMAL, speed is set to 100% but real speed is lower than 70% of max speed",
syslog(LOG_ERR, "%s status is ABNORMAL, speed is set to 100%% but real speed is lower than 70%% of max speed",
fantray->name);
if(fan_info->front_failed > FAN_FAIL_COUNT)
fan_info->front_failed = FAN_FAIL_COUNT;
Expand Down Expand Up @@ -2312,11 +2312,11 @@ static int get_fan_direction(int direction)
if(pn = find_sub_string(buffer, FAN_DIR_F2B_STR, sizeof(buffer))) {
f2r_fan_cnt++;
if(fantray->direction == FAN_DIR_FAULT) {
syslog(LOG_WARNING, "%s eeprom is NORMAL", fantray->name);
if(fantray->eeprom_fail) {
syslog(LOG_WARNING, "%s eeprom is NORMAL", fantray->name);
fantray->eeprom_fail = 0;
} else
syslog(LOG_WARNING, "%s model match, part number is %s", fantray->name, FAN_DIR_F2B_STR);
fantray->eeprom_fail = 0;
}
}
fantray->direction = FAN_DIR_F2B;
if(direction != fantray->direction)
Expand All @@ -2332,21 +2332,20 @@ static int get_fan_direction(int direction)
} */else {
fantray->direction = FAN_DIR_FAULT;
if(ret > 0) {
fantray->eeprom_fail = 0;
fantray->eeprom_fail = 1;
syslog(LOG_CRIT, "%s model mismatch, part number is %s", fantray->name, pn);
} else {
fantray->eeprom_fail = 1;
syslog(LOG_WARNING, "%s eeprom is ABNORMAL, read %s eeprom failed", fantray->name, fantray->name);
}
}
} else {
if(pn = find_sub_string(buffer, DELTA_PSU_DIR_F2B_STR, sizeof(buffer))) {
if(fantray->direction == FAN_DIR_FAULT) {
syslog(LOG_WARNING, "%s eeprom is NORMAL", fantray->name);
if(fantray->eeprom_fail) {
syslog(LOG_WARNING, "%s eeprom is NORMAL", fantray->name);
fantray->eeprom_fail = 0;
} else
syslog(LOG_WARNING, "%s model match, part number is %s", fantray->name, DELTA_PSU_DIR_F2B_STR);
fantray->eeprom_fail = 0;
}
}
fantray->direction = FAN_DIR_F2B;
if(direction != fantray->direction)
Expand All @@ -2355,11 +2354,11 @@ static int get_fan_direction(int direction)
syslog(LOG_WARNING, "%s airflow direction match, direction is F2B, system direction is F2B", fantray->name);
} else if(find_sub_string(buffer, DELTA_PSU_DIR_B2F_STR, sizeof(buffer))) {
if(fantray->direction == FAN_DIR_FAULT) {
syslog(LOG_WARNING, "%s eeprom is NORMAL", fantray->name);
if(fantray->eeprom_fail) {
syslog(LOG_WARNING, "%s eeprom is NORMAL", fantray->name);
fantray->eeprom_fail = 0;
} else
syslog(LOG_WARNING, "%s model match, part number is %s", fantray->name, DELTA_PSU_DIR_B2F_STR);
fantray->eeprom_fail = 0;
}
}
fantray->direction = FAN_DIR_B2F;
if(direction != fantray->direction)
Expand All @@ -2368,11 +2367,11 @@ static int get_fan_direction(int direction)
syslog(LOG_WARNING, "%s airflow direction match, direction is B2F, system direction is B2F", fantray->name);
} else if(find_sub_string(buffer, ACBEL_PSU_DIR_F2B_STR, sizeof(buffer))) {
if(fantray->direction == FAN_DIR_FAULT) {
syslog(LOG_WARNING, "%s eeprom is NORMAL", fantray->name);
if(fantray->eeprom_fail) {
syslog(LOG_WARNING, "%s eeprom is NORMAL", fantray->name);
fantray->eeprom_fail = 0;
} else
syslog(LOG_WARNING, "%s model match, part number is %s", fantray->name, ACBEL_PSU_DIR_F2B_STR);
fantray->eeprom_fail = 0;
}
}
fantray->direction = FAN_DIR_F2B;
if(direction != fantray->direction)
Expand All @@ -2381,11 +2380,11 @@ static int get_fan_direction(int direction)
syslog(LOG_WARNING, "%s airflow direction match, direction is F2B, system direction is F2B", fantray->name);
} else if(find_sub_string(buffer, ACBEL_PSU_DIR_B2F_STR, sizeof(buffer))) {
if(fantray->direction == FAN_DIR_FAULT) {
syslog(LOG_WARNING, "%s eeprom is NORMAL", fantray->name);
if(fantray->eeprom_fail) {
syslog(LOG_WARNING, "%s eeprom is NORMAL", fantray->name);
fantray->eeprom_fail = 0;
} else
syslog(LOG_WARNING, "%s model match, part number is %s", fantray->name, ACBEL_PSU_DIR_B2F_STR);
fantray->eeprom_fail = 0;
}
}
fantray->direction = FAN_DIR_B2F;
if(direction != fantray->direction)
Expand All @@ -2395,10 +2394,9 @@ static int get_fan_direction(int direction)
} else {
fantray->direction = FAN_DIR_FAULT;
if(ret > 0) {
fantray->eeprom_fail = 0;
fantray->eeprom_fail = 1;
syslog(LOG_CRIT, "%s model mismatch, part number is %s", fantray->name, pn);
} else {
fantray->eeprom_fail = 1;
syslog(LOG_WARNING, "%s eeprom is ABNORMAL, read %s eeprom failed", fantray->name, fantray->name);
}
}
Expand Down Expand Up @@ -2606,10 +2604,10 @@ void fand_interrupt(int sig)
}

const char *psu_name[TOTAL_PSUS] = {
"PSU 1-1",
"PSU 1-2",
"PSU 2-1",
"PSU 2-2",
"PSU 1",
"PSU 2",
"PSU 3",
"PSU 4",
};
int main(int argc, char **argv) {
int critical_temp;
Expand Down
Loading

0 comments on commit 9f54a66

Please sign in to comment.