Before doing a ps2_input_wait(), the code now first reads from the data
port once (for port 1 device) or twice (for port 2 device). This makes
the PS/2 initialization work.
int dev_1_test, dev_2_test;
int dev_1_test, dev_2_test;
if (port_1_test) {
uint8_t resp;
if (port_1_test) {
uint8_t resp;
} else { dev_1_test = 1; kprint("ps2: Port 1 device test successful\n", 0); }
}
} else { dev_1_test = 1; kprint("ps2: Port 1 device test successful\n", 0); }
}
+ inb(PS2_DATA_PORT);
+ ps2_input_wait();
+
- while (resp == RESEND) {
ps2_input_wait();
outb(PS2_CMD_STS_PORT, PS2_CMD_PORT_2_WRITE);
ps2_input_wait();
outb(PS2_DATA_PORT, PS2_DEV_RESET);
ps2_output_wait();
resp = inb(PS2_DATA_PORT);
ps2_input_wait();
outb(PS2_CMD_STS_PORT, PS2_CMD_PORT_2_WRITE);
ps2_input_wait();
outb(PS2_DATA_PORT, PS2_DEV_RESET);
ps2_output_wait();
resp = inb(PS2_DATA_PORT);
+ } while (resp == RESEND);
if (resp == SELF_TEST_BAD || resp == SELF_TEST_BAD_2) {
dev_2_test = 0;
if (resp == SELF_TEST_BAD || resp == SELF_TEST_BAD_2) {
dev_2_test = 0;
kprint("ps2: No functioning devices, exiting!\n", 0);
return -1;
}
kprint("ps2: No functioning devices, exiting!\n", 0);
return -1;
}
- } else { dev_2_test = 1; kprint("ps2: Port 2 test successful\n", 0); }
+ } else { dev_2_test = 1; kprint("ps2: Port 2 device test successful\n", 0); }
+ inb(PS2_DATA_PORT);
+ inb(PS2_DATA_PORT);
ps2_input_wait();
outb(PS2_CMD_STS_PORT, PS2_CMD_READ_CCB);
ps2_output_wait();
ps2_input_wait();
outb(PS2_CMD_STS_PORT, PS2_CMD_READ_CCB);
ps2_output_wait();