Add Page 14 (Event Log) and Page 20 (Enclosure Info) to C mock driver
This commit is contained in:
@@ -100,12 +100,70 @@ void test_page11(void) {
|
||||
}
|
||||
|
||||
void test_page14(void) {
|
||||
printf("\n========== TEST PAGE 14: RAID Info 6-7 ==========\n");
|
||||
printf("\n========== TEST PAGE 14: Event Log ==========\n");
|
||||
|
||||
MOCK_CTRL_INFO *ctrl = mock_get_ctrl_info(0);
|
||||
unsigned char *buf = ctrl->bPage14Data;
|
||||
|
||||
print_hex("Full Page 14", buf, 64);
|
||||
printf("Event Count: %d\n", buf[960]);
|
||||
|
||||
// Print first event
|
||||
printf("\nEvent 0:\n");
|
||||
printf(" Type: 0x%02X\n", buf[0]);
|
||||
printf(" Timestamp: %u\n", *(unsigned int*)(buf + 4));
|
||||
printf(" Slot/EID: 0x%02X\n", *(unsigned int*)(buf + 8));
|
||||
printf(" Status: 0x%02X\n", buf[12]);
|
||||
printf(" Message: %.32s\n", buf + 32);
|
||||
|
||||
// Print second event
|
||||
printf("\nEvent 1:\n");
|
||||
printf(" Type: 0x%02X\n", buf[64]);
|
||||
printf(" Timestamp: %u\n", *(unsigned int*)(buf + 68));
|
||||
printf(" Slot/EID: 0x%02X\n", *(unsigned int*)(buf + 72));
|
||||
printf(" Status: 0x%02X\n", buf[76]);
|
||||
printf(" Message: %.32s\n", buf + 96);
|
||||
|
||||
print_hex("Page 14 (first 128 bytes)", buf, 128);
|
||||
}
|
||||
|
||||
void test_page20(void) {
|
||||
printf("\n========== TEST PAGE 20: Enclosure Info ==========\n");
|
||||
|
||||
MOCK_CTRL_INFO *ctrl = mock_get_ctrl_info(0);
|
||||
unsigned char *buf = ctrl->bPage20Data;
|
||||
|
||||
printf("Enclosure ID: %d\n", buf[0]);
|
||||
printf("Fan Count: %d\n", buf[1]);
|
||||
printf("Power Supply Count: %d\n", buf[2]);
|
||||
printf("Temperature Sensor Count: %d\n", buf[3]);
|
||||
printf("Heat Sink Count: %d\n", buf[4]);
|
||||
|
||||
// Fan speeds
|
||||
unsigned short fan1 = buf[0x10] | (buf[0x11] << 8);
|
||||
unsigned short fan2 = buf[0x12] | (buf[0x13] << 8);
|
||||
printf("Fan 1 Speed: %d RPM\n", fan1);
|
||||
printf("Fan 2 Speed: %d RPM\n", fan2);
|
||||
|
||||
// Temperatures
|
||||
printf("Temperature 1: %d C\n", buf[0x20]);
|
||||
printf("Temperature 2: %d C\n", buf[0x21]);
|
||||
printf("Temperature 3: %d C\n", buf[0x22]);
|
||||
printf("Temperature 4: %d C\n", buf[0x23]);
|
||||
|
||||
// Temp status
|
||||
printf("Temp 1 Status: %d\n", buf[0x40]);
|
||||
printf("Temp 2 Status: %d\n", buf[0x41]);
|
||||
printf("Temp 3 Status: %d\n", buf[0x42]);
|
||||
|
||||
// Power Supply status
|
||||
printf("Power Supply 1: %s\n", buf[0x50] == 0 ? "OK" : "FAIL");
|
||||
printf("Power Supply 2: %s\n", buf[0x51] == 0 ? "OK" : "FAIL");
|
||||
|
||||
// Battery
|
||||
printf("Battery Present: %s\n", buf[0x60] == 1 ? "Yes" : "No");
|
||||
printf("Battery Charge: %d%%\n", buf[0x61]);
|
||||
|
||||
print_hex("Full Page 20", buf, 128);
|
||||
}
|
||||
|
||||
void test_page27(void) {
|
||||
@@ -190,6 +248,7 @@ int main(int argc, char *argv[]) {
|
||||
test_page10();
|
||||
test_page11();
|
||||
test_page14();
|
||||
test_page20();
|
||||
test_page27();
|
||||
test_devioctl();
|
||||
test_events();
|
||||
|
||||
Reference in New Issue
Block a user