mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 20:58:22 +00:00
ps2kbd: actually enable data reporting
This commit is contained in:
@@ -116,12 +116,13 @@ static char extendedcodes[128] = {
|
||||
};
|
||||
|
||||
#define KEYBOARDIRQ 1
|
||||
#define KEYBOARD_CMD_REPORTDATA 0xf4
|
||||
|
||||
keyboard_t *kb;
|
||||
static bool extended = false;
|
||||
|
||||
static void kbdisr(isr_t *isr, context_t *ctx) {
|
||||
uint8_t scancode = inb(0x60);
|
||||
uint8_t scancode = inb(PS2_PORT_DATA);
|
||||
if (scancode == 0xE0) {
|
||||
extended = true;
|
||||
return;
|
||||
@@ -151,9 +152,16 @@ static void kbdisr(isr_t *isr, context_t *ctx) {
|
||||
keyboard_sendpacket(kb, &packet);
|
||||
}
|
||||
|
||||
void ps2kbd_init(){
|
||||
void ps2kbd_init() {
|
||||
// clear PS/2 buffer to make sure its empty
|
||||
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);
|
||||
__assert(isr);
|
||||
arch_ioapic_setirq(KEYBOARDIRQ, isr->id & 0xff, _cpu()->id, false);
|
||||
|
||||
Reference in New Issue
Block a user