ID:431 - Fix correct interpretation of led states

The LED state bits are not mutually exclusive. Bit [0] says LEDs can be
controlled locally and the state bit [1] says wheter the default local
settings or the override settings are used. This means that both bits can be
set at the same time.

Bit [2], the lamp test, indicates wether the test is in progress and logically
works the same as [1].

If bit [0] is not set then bit [1] and [2] has no meaning.

Signed-off-by: Jens Nyberg <jens.nyberg@ericsson.com>
This commit is contained in:
Jens Nyberg 2016-03-10 08:42:35 +00:00 committed by Zdenek Styblik
parent eb5c73c04e
commit cacdd1b6ec

View File

@ -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] );
}