Small nudge in right direction for buggy keyboard handling
Small nudge in right direction for buggy keyboard handling
What would cause this bug? I can post my code if you need it, but I am interested in trying to figure out what the issue is myself. So far, I have been reading about the 8259 PIC and "Interrupt Problems" on the OSDev wiki, but I haven't not noticed anything.
The correct characters show up on the left side, but then it inserts that strange text afterwards, and goes to a newline.
Have I missed something? Anyone have a nudge in the right direction?
- eryjus
- Member
- Posts: 286
- Joined: Fri Oct 21, 2011 9:47 pm
- Libera.chat IRC: eryjus
- Location: Tustin, CA USA
Re: Small nudge in right direction for buggy keyboard handli
https://wiki.osdev.org/PS/2_Keyboard#Scan_Code_Sets
Are you properly handling the release codes?
As for the extra text, my first thought is an extra format specifier in kprintf() without a matching parameter.
Are you properly handling the release codes?
As for the extra text, my first thought is an extra format specifier in kprintf() without a matching parameter.
Adam
The name is fitting: Century Hobby OS -- At this rate, it's gonna take me that long!
Read about my mistakes and missteps with this iteration: Journal
"Sometimes things just don't make sense until you figure them out." -- Phil Stahlheber
The name is fitting: Century Hobby OS -- At this rate, it's gonna take me that long!
Read about my mistakes and missteps with this iteration: Journal
"Sometimes things just don't make sense until you figure them out." -- Phil Stahlheber
Re: Small nudge in right direction for buggy keyboard handli
Hm, maybe I forgot to add support for the release codes. This is my code: https://github.com/Bowlslaw/slawOS/blob ... terrupts.ceryjus wrote:https://wiki.osdev.org/PS/2_Keyboard#Scan_Code_Sets
Are you properly handling the release codes?
As for the extra text, my first thought is an extra format specifier in kprintf() without a matching parameter.
It draws heavily from meaty skeleton and Sortie, Sortix's OS.
Code: Select all
void pic_init() {
/* ICW1 - begin initialization */
port_byte_out(PIC1_CMD, 0x11);
port_byte_out(PIC2_CMD, 0x11);
/* ICW2 - remap offset address of IDT
* In x86 protected mode, we have to remap the PICs after 0x20 because
* Intel has designated the first 32 interrupts as "reserved" for CPU exceptions
*/
port_byte_out(PIC1_DATA, 0x20);
port_byte_out(PIC2_DATA, 0x28);
/* OCW3 - set up cascading */
port_byte_out(PIC1_DATA, 0x04);
port_byte_out(PIC2_DATA, 0x02);
/*
* port_byte_out(PIC1_DATA, 0x0);
* port_byte_out(PIC2_DATA, 0x0);
*/
/* ICW4 - environment info */
port_byte_out(PIC1_DATA, 0x01);
port_byte_out(PIC2_DATA, 0x01);
/* mask interrupts */
port_byte_out(PIC1_DATA, 0xFF);
port_byte_out(PIC2_DATA, 0xFF);
}
void isr_handler(struct regs *r) {
int irqn = (int)r->irqn;
printf("INT%d\n", irqn);
/* write EOI */
port_byte_out(PIC1_CMD, 0x20);
switch(irqn) {
case 0x21:
kbd_isr_main();
break;
default:
printf("Unknown interrupt %d\n", irqn);
break;
}
}