diff options
Diffstat (limited to 'lib/ipmi_picmg.c')
-rw-r--r-- | lib/ipmi_picmg.c | 54 |
1 files changed, 29 insertions, 25 deletions
diff --git a/lib/ipmi_picmg.c b/lib/ipmi_picmg.c index f47577e..70f845d 100644 --- a/lib/ipmi_picmg.c +++ b/lib/ipmi_picmg.c @@ -1280,49 +1280,53 @@ ipmi_picmg_get_led_state(struct ipmi_intf * intf, int argc, char ** argv) } printf("LED states: %x ", rsp->data[1] ); - if (rsp->data[1] == 0x1) - printf("[LOCAL CONTROL]\n"); - else if (rsp->data[1] == 0x2) - printf("[OVERRIDE]\n"); - else if (rsp->data[1] == 0x4) - printf("[LAMPTEST]\n"); - else - printf("\n"); + + if (!(rsp->data[1] & 0x1)) { + printf("[NO LOCAL CONTROL]\n"); + return 0; + } + + printf("[LOCAL CONTROL"); + + if (rsp->data[1] & 0x2) { + printf("|OVERRIDE"); + } + + if (rsp->data[1] & 0x4) { + printf("|LAMPTEST"); + } + + printf("]\n"); printf(" Local Control function: %x ", rsp->data[2] ); - if (rsp->data[2] == 0x0) + if (rsp->data[2] == 0x0) { printf("[OFF]\n"); - else if (rsp->data[2] == 0xff) + } else if (rsp->data[2] == 0xff) { printf("[ON]\n"); - else + } else { printf("[BLINKING]\n"); + } printf(" Local Control On-Duration: %x\n", rsp->data[3] ); printf(" Local Control Color: %x [%s]\n", rsp->data[4], led_color_str[ rsp->data[4] ]); /* override state or lamp test */ - if (rsp->data[1] == 0x02) { + if (rsp->data[1] & 0x02) { printf(" Override function: %x ", rsp->data[5] ); - if (rsp->data[2] == 0x0) + if (rsp->data[2] == 0x0) { printf("[OFF]\n"); - else if (rsp->data[2] == 0xff) + } else if (rsp->data[2] == 0xff) { printf("[ON]\n"); - else + } else { printf("[BLINKING]\n"); + } printf(" Override On-Duration: %x\n", rsp->data[6] ); printf(" Override Color: %x [%s]\n", rsp->data[7], led_color_str[ rsp->data[7] ]); - }else if (rsp->data[1] == 0x06) { - printf(" Override function: %x ", rsp->data[5] ); - if (rsp->data[2] == 0x0) - printf("[OFF]\n"); - else if (rsp->data[2] == 0xff) - printf("[ON]\n"); - else - printf("[BLINKING]\n"); - printf(" Override On-Duration: %x\n", rsp->data[6] ); - printf(" Override Color: %x [%s]\n", rsp->data[7], led_color_str[ rsp->data[7] ]); + } + + if (rsp->data[1] & 0x04) { printf(" Lamp test duration: %x\n", rsp->data[8] ); } |