SOLVED -- caps lock, num lock, and scroll lock interrupts all being sent twice
Posted: Tue Jun 03, 2025 3:51 pm
Hey, I'm still pretty new to OSdev, and i'm currently working on implementing a keyboard driver. However, I'm running into an odd issue. Whenever I press Caps Lock, Num Lock, or Scroll Lock, these all fire interrupts 4 times (press, release, press, release).

However, every other key press functions just fine, only receiving a single interrupt for press and release:

I'm using bochs as my emulator, and here is my code for interrupt handling:
I have the PIC remapped, and have the keyboard init'ing with some commands to enable scanning, i've messed around with different typematic rates but has changed nothing. I'm at a bit of a loss for this, and was wondering if anyone could provide some input.

However, every other key press functions just fine, only receiving a single interrupt for press and release:

I'm using bochs as my emulator, and here is my code for interrupt handling:
Code: Select all
isr_stub%+%1: ; code from OSDev wiki
pushad
cld
push dword %1
call exception_handler
pop eax
popad
iret
Code: Select all
void exception_handler(unsigned int i)
{
if (i <= 31) {
printf("Exception: %u\n", i); // TODO
__asm__ volatile ("cli; hlt");
}
if (i == PIC_KEYB) {
unsigned char in = inb(0x60);
// I have a keyboard driver in the works but downgraded to printing the scancodes to diagnose this problem
printf("scancode: %x\n", in);
PIC_sendEOI(1);
}
}