void onlp_led_dump(onlp_oid_t id, aim_pvs_t* pvs, uint32_t flags) { int rv; iof_t iof; onlp_led_info_t info; VALIDATENR(id); onlp_oid_dump_iof_init_default(&iof, pvs); iof_push(&iof, "led @ %d", ONLP_OID_ID_GET(id)); rv = onlp_led_info_get(id, &info); if(rv < 0) { onlp_oid_info_get_error(&iof, rv); } else { onlp_oid_show_description(&iof, &info.hdr); if(info.status & 1) { /* Present */ iof_iprintf(&iof, "Status: %{onlp_led_status_flags}", info.status); iof_iprintf(&iof, "Caps: %{onlp_led_caps_flags}", info.caps); iof_iprintf(&iof, "Mode: %{onlp_led_mode}", info.mode); } else { iof_iprintf(&iof, "Not present."); } } iof_pop(&iof); }
void onlp_led_show(onlp_oid_t id, aim_pvs_t* pvs, uint32_t flags) { int rv; iof_t iof; onlp_led_info_t info; VALIDATENR(id); onlp_oid_show_iof_init_default(&iof, pvs); iof_push(&iof, "LED %d", ONLP_OID_ID_GET(id)); rv = onlp_led_info_get(id, &info); if(rv < 0) { onlp_oid_info_get_error(&iof, rv); } else { onlp_oid_show_description(&iof, &info.hdr); if(info.status & 1) { /* Present */ iof_iprintf(&iof, "Mode: %{onlp_led_mode}", info.mode); } else { onlp_oid_show_state_missing(&iof); } } iof_pop(&iof); }
void onlp_fan_dump(onlp_oid_t id, aim_pvs_t* pvs, uint32_t flags) { int rv; iof_t iof; onlp_fan_info_t info; VALIDATENR(id); onlp_oid_dump_iof_init_default(&iof, pvs); iof_push(&iof, "fan @ %d", ONLP_OID_ID_GET(id)); rv = onlp_fan_info_get(id, &info); if(rv < 0) { onlp_oid_info_get_error(&iof, rv); } else { onlp_oid_show_description(&iof, &info.hdr); if(info.status & 1) { /* Present */ iof_iprintf(&iof, "Status: %{onlp_fan_status_flags}", info.status); iof_iprintf(&iof, "Caps: %{onlp_fan_caps_flags}", info.caps); iof_iprintf(&iof, "RPM: %d", info.rpm); iof_iprintf(&iof, "Per: %d", info.percentage); iof_iprintf(&iof, "Model: %s", info.model[0] ? info.model : "NULL"); iof_iprintf(&iof, "SN: %s", info.serial[0] ? info.serial : "NULL"); } else { iof_iprintf(&iof, "Not present."); } } iof_pop(&iof); }
/************************************************************ * * Debug and Show Functions * ***********************************************************/ void onlp_thermal_dump(onlp_oid_t id, aim_pvs_t* pvs, uint32_t flags) { int rv; iof_t iof; onlp_thermal_info_t info; VALIDATENR(id); onlp_oid_dump_iof_init_default(&iof, pvs); iof_push(&iof, "thermal @ %d", ONLP_OID_ID_GET(id)); rv = onlp_thermal_info_get(id, &info); if(rv < 0) { onlp_oid_info_get_error(&iof, rv); } else { onlp_oid_show_description(&iof, &info.hdr); if(info.status & 1) { /* Present */ iof_iprintf(&iof, "Status: %{onlp_thermal_status_flags}", info.status); iof_iprintf(&iof, "Caps: %{onlp_thermal_caps_flags}", info.caps); iof_iprintf(&iof, "Temperature: %d", info.mcelsius); iof_push(&iof, "thresholds"); { iof_iprintf(&iof, "Warning: %d", info.thresholds.warning); iof_iprintf(&iof, "Error: %d", info.thresholds.error); iof_iprintf(&iof, "Shutdown: %d", info.thresholds.shutdown); iof_pop(&iof); } } else { iof_iprintf(&iof, "Not present."); } } iof_pop(&iof); }
void onlp_led_show(onlp_oid_t id, aim_pvs_t* pvs, uint32_t flags) { int rv; iof_t iof; onlp_led_info_t info; int yaml; VALIDATENR(id); onlp_oid_show_iof_init_default(&iof, pvs, flags); yaml = flags & ONLP_OID_SHOW_F_YAML; if(yaml) { iof_push(&iof, " -"); iof_iprintf(&iof, "Name: LED %d", ONLP_OID_ID_GET(id)); } else { iof_push(&iof, "LED %d", ONLP_OID_ID_GET(id)); } rv = onlp_led_info_get(id, &info); if(rv < 0) { if(yaml) { iof_iprintf(&iof, "State: Error"); iof_iprintf(&iof, "Error: %{onlp_status}", rv); } else { onlp_oid_info_get_error(&iof, rv); } } else { onlp_oid_show_description(&iof, &info.hdr); if(info.status & 1) { /* Present */ iof_iprintf(&iof, "State: Present"); iof_iprintf(&iof, "Mode: %{onlp_led_mode}", info.mode); } else { onlp_oid_show_state_missing(&iof); } } iof_pop(&iof); }
void onlp_fan_show(onlp_oid_t oid, aim_pvs_t* pvs, uint32_t flags) { int rv; iof_t iof; onlp_fan_info_t fi; int yaml; onlp_oid_show_iof_init_default(&iof, pvs, flags); rv = onlp_fan_info_get(oid, &fi); yaml = flags & ONLP_OID_SHOW_F_YAML; if(yaml) { iof_push(&iof, "- "); iof_iprintf(&iof, "Name: Fan %d", ONLP_OID_ID_GET(oid)); } else { iof_push(&iof, "Fan %d", ONLP_OID_ID_GET(oid)); } if(rv < 0) { if(yaml) { iof_iprintf(&iof, "State: Error"); iof_iprintf(&iof, "Error: %{onlp_status}", rv); } else { onlp_oid_info_get_error(&iof, rv); } } else { onlp_oid_show_description(&iof, &fi.hdr); if(fi.status & 0x1) { /* Present */ iof_iprintf(&iof, "State: Present"); if(fi.status & ONLP_FAN_STATUS_FAILED) { iof_iprintf(&iof, "Status: Failed"); } else { iof_iprintf(&iof, "Status: Running"); if(fi.model[0]) { iof_iprintf(&iof, "Model: %s", fi.model); } if(fi.serial[0]) { iof_iprintf(&iof, "SN: %s", fi.serial); } if(fi.caps & ONLP_FAN_CAPS_GET_RPM) { iof_iprintf(&iof, "RPM: %d", fi.rpm); } if(fi.caps & ONLP_FAN_CAPS_GET_PERCENTAGE) { iof_iprintf(&iof, "Speed: %d%%", fi.percentage); } if(fi.status & ONLP_FAN_STATUS_B2F) { iof_iprintf(&iof, "Airflow: Back-to-Front"); } if(fi.status & ONLP_FAN_STATUS_F2B) { iof_iprintf(&iof, "Airflow: Front-to-Back"); } } } else { /* Not present */ onlp_oid_show_state_missing(&iof); } } iof_pop(&iof); }
void onlp_thermal_show(onlp_oid_t id, aim_pvs_t* pvs, uint32_t flags) { int rv; iof_t iof; onlp_thermal_info_t ti; VALIDATENR(id); int yaml; onlp_oid_show_iof_init_default(&iof, pvs, flags); rv = onlp_thermal_info_get(id, &ti); yaml = flags & ONLP_OID_SHOW_YAML; if(yaml) { iof_push(&iof, "- "); iof_iprintf(&iof, "Name: Thermal %d", ONLP_OID_ID_GET(id)); } else { iof_push(&iof, "Thermal %d", ONLP_OID_ID_GET(id)); } if(rv < 0) { if(yaml) { iof_iprintf(&iof, "State: Error"); iof_iprintf(&iof, "Error: %{onlp_status}", rv); } else { onlp_oid_info_get_error(&iof, rv); } } else { onlp_oid_show_description(&iof, &ti.hdr); if(ti.status & 0x1) { /* Present */ if(ti.status & ONLP_THERMAL_STATUS_FAILED) { iof_iprintf(&iof, "Status: Failed"); } else { iof_iprintf(&iof, "Status: Functional"); if(ti.caps & ONLP_THERMAL_CAPS_GET_TEMPERATURE) { iof_iprintf(&iof, "Temperature: %d.%d C", ONLP_MILLI_NORMAL_INTEGER_TENTHS(ti.mcelsius)); } #if ONLP_CONFIG_INCLUDE_THERMAL_THRESHOLDS == 1 if(ti.caps & ONLP_THERMAL_CAPS_GET_ANY_THRESHOLD) { iof_push(&iof, "Thresholds:"); if(ti.caps & ONLP_THERMAL_CAPS_GET_WARNING_THRESHOLD) { iof_iprintf(&iof, "Warning : %d.%d C", ONLP_MILLI_NORMAL_INTEGER_TENTHS(ti.thresholds.warning)); } if(ti.caps & ONLP_THERMAL_CAPS_GET_ERROR_THRESHOLD) { iof_iprintf(&iof, "Error : %d.%d C", ONLP_MILLI_NORMAL_INTEGER_TENTHS(ti.thresholds.error)); } if(ti.caps & ONLP_THERMAL_CAPS_GET_SHUTDOWN_THRESHOLD) { iof_iprintf(&iof, "Shutdown: %d.%d C", ONLP_MILLI_NORMAL_INTEGER_TENTHS(ti.thresholds.shutdown)); } iof_pop(&iof); } #endif } } else { /* Not present */ onlp_oid_show_state_missing(&iof); } } iof_pop(&iof); }