Keyboard Interrupt only works manually not on press

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
CrossScar
Posts: 2
Joined: Sat Jun 15, 2024 12:23 am

Keyboard Interrupt only works manually not on press

Post by CrossScar »

When I tried to implement my keyboard interrupt it wouldn't get called even though it works when ran manually. I've tried calling

Code: Select all

inportb(0x60)
to clear the buffer but that doesn't work either. Can't figure out what to do. Here is my code. Sorry about the messy code, the keyboard driver is currently split between

Code: Select all

src/kernel.cpp
and

Code: Select all

src/keyboard/keyboard.c
for testing and interrupts are in the

Code: Select all

src/interrupts folder
.
Octocontrabass
Member
Member
Posts: 5418
Joined: Mon Mar 25, 2013 7:01 pm

Re: Keyboard Interrupt only works manually not on press

Post by Octocontrabass »

You need to set up a GDT before you can set up your IDT. Multiboot does not guarantee a usable GDT.

You mask all the IRQs and never unmask IRQ1.

You install your keyboard handler on IRQ3.

There may be other problems, this is just what I spotted after looking for a few minutes.
CrossScar
Posts: 2
Joined: Sat Jun 15, 2024 12:23 am

Re: Keyboard Interrupt only works manually not on press

Post by CrossScar »

Thank you I fixed it with unmasking and switching to IRQ 1. I didn't need to setup the GDT but I've been needing to for a while. I can't seem to figure out how to do it correctly.
Octocontrabass
Member
Member
Posts: 5418
Joined: Mon Mar 25, 2013 7:01 pm

Re: Keyboard Interrupt only works manually not on press

Post by Octocontrabass »

If you'd like help with setting up the GDT, tell us more about what you've tried so far.
Post Reply