Page 1 of 1

Activate keyboard on real hardware (notebook)

Posted: Sun Jan 05, 2014 8:41 pm
by matec1
Hi,

I have resently extended my OS by a interrupt handler for IRQ1, and keyboard input works perfectly with qemu. However when I boot from USB on my netbook, the interrupt handler is never called. Other interrupt handler (IRQ0 for timer) are called.
(The same also with a second notebook)

I'm not sure how to even check what keyboard type (PS/2, USB, other?) the netbook has. I do have a file (in ubuntu) `/dev/input/by-path/platform-i8042-serio-0-event-kbd` if that says anything to anyone.

Is it possible that I have to somehow activate my keyboard in a way that is not necessary in qemu? What could be the problem?

Thanks for help.

Re: Activate keyboard on real hardware (notebook)

Posted: Mon Jan 06, 2014 3:55 am
by Combuster
You can use

Code: Select all

lsusb
to find out what USB devices are connected. If you find your keyboard or touchpad on there you'll know it's not connected using PS/2. Some machines might allow emulating USB keyboards as PS/2 ones via a BIOS setting, but those tricks tend to be iffy.

If the keyboard actually is a native PS/2, then there's probably something wrong with the specific handling.

Re: Activate keyboard on real hardware (notebook)

Posted: Mon Jan 06, 2014 1:16 pm
by matec1
Adding the following before installing the keyboard IRQ handler fixed the problem:

Code: Select all

/* don't let devices send data at the wrong time and mess up initialisation */
outb(PS2_COMMAND, PS2_DISABLE_FIRST_PORT);
outb(PS2_COMMAND, PS2_DISABLE_SECOND_PORT); /* ignored if not supported */

/* flush device buffer */
while (inb(PS2_COMMAND) & PS2_OUTPUT_FULL) {
        inb(PS2_DATA);
}

/* finilize PS/2 initialization by reenabling devices */
outb(PS2_COMMAND, PS2_ENABLE_FIRST_PORT);
outb(PS2_COMMAND, PS2_ENABLE_SECOND_PORT); /* ignored if unsupported? */
Thanks, Combustor. Seeing that my keyboard is not USB lead me to the direction to improve on my PS/2 initialization.