Page 1 of 1

Problem with scancodes

Posted: Mon Jan 20, 2020 8:54 pm
by aphexia
I just wrote an entire translation table for scancode set 3 and made sure that i switched the keyboard to use set 3. However, i still recieve set 2 scancodes.

To add to that, i get the ACK response even if the keyboard doesn't seem to change its set. What should i do?

Re: Problem with scancodes

Posted: Tue Jan 21, 2020 4:48 am
by Octocontrabass
Probably you should stop trying to use set 3.

What are you running your OS on? If you're running on bare metal, what kind of keyboard are you using?

Re: Problem with scancodes

Posted: Tue Jan 21, 2020 8:35 am
by aphexia
I'm running my OS on virtualbox.

Re: Problem with scancodes

Posted: Tue Jan 21, 2020 8:46 am
by Octocontrabass
Virtualbox appears to support scan code set 3. How are you switching the keyboard to set 3? If you ask the keyboard which set it's using, how does it respond?

Re: Problem with scancodes

Posted: Tue Jan 21, 2020 8:59 am
by aphexia
The output of that command is 3F.

outb(PORT_NB_PS2_DATA, 0xF0);
outb(PORT_NB_PS2_DATA, 3);
outb(PORT_NB_PS2_DATA, 0xF0);
outb(PORT_NB_PS2_DATA, 0);

Re: Problem with scancodes

Posted: Tue Jan 21, 2020 10:50 am
by Octocontrabass
You are not receiving set 2 scan codes. You are receiving set 1 scan codes.

The keyboard is sending set 3 scan codes, and the keyboard controller is translating them to set 1 scan codes. If you want to receive set 3 scan codes, you need to turn off translation in the keyboard controller.

Incidentally, when you ask the keyboard which scan code set it's using, it responds with 0x03 and the keyboard controller translates that into 0x3F.

Re: Problem with scancodes

Posted: Tue Jan 21, 2020 10:56 am
by aphexia
Thanks a lot!!!!!

Have a nice day :)