ps2kbd: actually enable data reporting

This commit is contained in:
Matheus
2024-07-10 20:55:46 -03:00
parent 0ff8a6c0fa
commit bb1fe2b4dc
+9 -1
View File
@@ -116,12 +116,13 @@ static char extendedcodes[128] = {
}; };
#define KEYBOARDIRQ 1 #define KEYBOARDIRQ 1
#define KEYBOARD_CMD_REPORTDATA 0xf4
keyboard_t *kb; keyboard_t *kb;
static bool extended = false; static bool extended = false;
static void kbdisr(isr_t *isr, context_t *ctx) { static void kbdisr(isr_t *isr, context_t *ctx) {
uint8_t scancode = inb(0x60); uint8_t scancode = inb(PS2_PORT_DATA);
if (scancode == 0xE0) { if (scancode == 0xE0) {
extended = true; extended = true;
return; return;
@@ -154,6 +155,13 @@ static void kbdisr(isr_t *isr, context_t *ctx) {
void ps2kbd_init() { void ps2kbd_init() {
// clear PS/2 buffer to make sure its empty // clear PS/2 buffer to make sure its empty
inb(PS2_PORT_DATA); inb(PS2_PORT_DATA);
int response = device_write_response(1, KEYBOARD_CMD_REPORTDATA);
if (response != ACK) {
printf("ps2keyboard: expected ACK, got %x\n", response);
return;
}
isr_t *isr = interrupt_allocate(kbdisr, arch_apic_eoi, IPL_KEYBOARD); isr_t *isr = interrupt_allocate(kbdisr, arch_apic_eoi, IPL_KEYBOARD);
__assert(isr); __assert(isr);
arch_ioapic_setirq(KEYBOARDIRQ, isr->id & 0xff, _cpu()->id, false); arch_ioapic_setirq(KEYBOARDIRQ, isr->id & 0xff, _cpu()->id, false);