Keyboard Driver
Keyboard Driver
hi all
Can someone explain me what the differences are between a AT and a PS/2 keyboard. And how can i find out wheter i have a AT or a PS/2. And musst i have more than one driver? Are there no standards?
Thx & greez
Can someone explain me what the differences are between a AT and a PS/2 keyboard. And how can i find out wheter i have a AT or a PS/2. And musst i have more than one driver? Are there no standards?
Thx & greez
Re:Keyboard Driver
The difference is in the size and shape of the plug. A normal AT keyboard has a DIN plug (which is slightly over a centimeter in diameter and has big pins), whereas a PS/2 keyboard has a PS/2 plug (which is around 0.5 centimeter in diameter and has small pins).zack wrote: hi all
Can someone explain me what the differences are between a AT and a PS/2 keyboard. And how can i find out wheter i have a AT or a PS/2. And musst i have more than one driver? Are there no standards?
Thx & greez
They're both accessed through the same keyboard controller and you can't have both of them on one machine. You access both of them through the keyboard controller on ports 0x60 and 0x64.
Newer keyboards use USB and are interfaced through the USB standard with HID.
Note that both PS/2 and AT are old technologies.
Re:Keyboard Driver
i know that this are old things. but however for example in my notebook there is a ps/2 keyboard integrated. if the are connected both to the same keyboard controller, why have i to varriant two enable them?
0x64 -> 0xAE <- AT
0x64 -> 0xF4 <- PS/2
And how can i dedect which i have installed?
thanks
0x64 -> 0xAE <- AT
0x64 -> 0xF4 <- PS/2
And how can i dedect which i have installed?
thanks
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Keyboard Driver
to what i've read from http://panda.cs.ndsu.nodak.edu/~achapwe ... board.html,
# 0xF5 (Disable) - Keyboard stops scanning, loads default values (see "Set Default" command), and waits further instructions.
# 0xF4 (Enable) - Re-enables keyboard after disabled using previous command.
# 0xAD (Disable keyboard interface) - Sets bit 4 of command byte and disables all communication with keyboard.
# 0xAE (Enable keyboard interface) - Clears bit 4 of command byte and re-enables communication with keyboard.
So it seems to me that both command are available on both system, but that they have some difference in their meaning, especially, since the PS/2 8042 controller support both mouse and keyboard, using "disable/enable keyboard interface" can make sense since you might wish to disable keyboard but not mouse.
Now, however, the BIOS will enable the keyboard for you so you shouldn't worry about that too much.
# 0xF5 (Disable) - Keyboard stops scanning, loads default values (see "Set Default" command), and waits further instructions.
# 0xF4 (Enable) - Re-enables keyboard after disabled using previous command.
# 0xAD (Disable keyboard interface) - Sets bit 4 of command byte and disables all communication with keyboard.
# 0xAE (Enable keyboard interface) - Clears bit 4 of command byte and re-enables communication with keyboard.
So it seems to me that both command are available on both system, but that they have some difference in their meaning, especially, since the PS/2 8042 controller support both mouse and keyboard, using "disable/enable keyboard interface" can make sense since you might wish to disable keyboard but not mouse.
Now, however, the BIOS will enable the keyboard for you so you shouldn't worry about that too much.
Re:Keyboard Driver
why ever, if i don't enable the keyboard it don't execute the IRQ1. nothing happens if i hit a key. could it be because the keyboard buffer has a value inside?
in my bootloader i can chosse which vesa resolution i want. when im later in the c kernel and read out the keyboard buffer there is still the breakcode from the hitten key...
what could i do?
and which scancode set is the best. does every keyboard / kbc support every scancode set? i think i take set 2 or set 3.. but mor 3 than 2..
thanks & greez
in my bootloader i can chosse which vesa resolution i want. when im later in the c kernel and read out the keyboard buffer there is still the breakcode from the hitten key...
what could i do?
and which scancode set is the best. does every keyboard / kbc support every scancode set? i think i take set 2 or set 3.. but mor 3 than 2..
thanks & greez
Re:Keyboard Driver
Hi,
0xAD/0xAE for the first device and 0xA7/0xA8 for the second device all tell the controller chip to disable/enable the clock signal to the device, which prevents any form of communication between the device and the controller.
0xF4 and 0xF5 have nothing to do with the controller chip - they are handled by the device itself. All keyboards and mouses respond to these commands by enabling/disabling scanning. This basically means that a keyboard will stop looking for key press/release and a mouse will stop looking for movement and button state changes. In this case the device can still communicate with the controller.
For example, when you're configuring a keyboard you can disable scanning so that while you're setting the typematic rate, keyboard LEDs, setting the scan code set, etc you don't have to worry about handling keypress information at the same time.
For scancode sets, set 2 is the default and it's supported by all keyboards. Scancode sets 1 and 3 are often not supported at all, and often the keyboard merely pretends they are (i.e. they return "ACK" when you try to set them, even though they aren't supported), which makes it hard to figure out what is and isn't supported.
To add some annoyance, the controller chip itself will convert scan code set 2 into scancode set 1. This means if you try to use any other scancode set the controller chip will probably trash the data instead of doing a correct conversion. It also means that even though the keyboard itself uses scancode set 2, you will get scancode set 1 values from I/O port 0x60.
The controller chip's scancode conversion can be disabled, but it's probably not worth the hassle for most OS's.
Cheers,
Brendan
They are entirely different.Pype.Clicker wrote:So it seems to me that both command are available on both system, but that they have some difference in their meaning, especially, since the PS/2 8042 controller support both mouse and keyboard, using "disable/enable keyboard interface" can make sense since you might wish to disable keyboard but not mouse.
0xAD/0xAE for the first device and 0xA7/0xA8 for the second device all tell the controller chip to disable/enable the clock signal to the device, which prevents any form of communication between the device and the controller.
0xF4 and 0xF5 have nothing to do with the controller chip - they are handled by the device itself. All keyboards and mouses respond to these commands by enabling/disabling scanning. This basically means that a keyboard will stop looking for key press/release and a mouse will stop looking for movement and button state changes. In this case the device can still communicate with the controller.
For example, when you're configuring a keyboard you can disable scanning so that while you're setting the typematic rate, keyboard LEDs, setting the scan code set, etc you don't have to worry about handling keypress information at the same time.
For scancode sets, set 2 is the default and it's supported by all keyboards. Scancode sets 1 and 3 are often not supported at all, and often the keyboard merely pretends they are (i.e. they return "ACK" when you try to set them, even though they aren't supported), which makes it hard to figure out what is and isn't supported.
To add some annoyance, the controller chip itself will convert scan code set 2 into scancode set 1. This means if you try to use any other scancode set the controller chip will probably trash the data instead of doing a correct conversion. It also means that even though the keyboard itself uses scancode set 2, you will get scancode set 1 values from I/O port 0x60.
The controller chip's scancode conversion can be disabled, but it's probably not worth the hassle for most OS's.
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Re:Keyboard Driver
if i do this, nothing happens if i hit a key. must i wait for a ack (0xFA). or happens nothing because there is still a value in the buffer. or must i configure bochs first?
Sorry for these few questions...
thanks!
Sorry for these few questions...
thanks!
Code: Select all
void SetupKeyboard()
{
WaitToWrite();
outb(0x64, 0xF4);
RefreshLEDs();
CurrentLayout = KeyboardLayout;
EnableKeyboard(true);
printf("SetupKeyboard [Done]\n\tScancode Set = 2\n");
};
unsigned char GetKey ()
{
return inb(0x60);
};
void WaitToRead()
{
while (!(inb(0x64) & 0x1));
};
void WaitToWrite()
{
while (inb(0x64) & 0x2);
};
Re:Keyboard Driver
Hi,
You don't want to do that - sending command 0xF4 to the controller chip makes it send a 6 uS pulse to one of it's output pins (one of these pins is connected to system reset, not sure what the others are used for).
What you want to do is send 0xF4 to the keyboard itself (rather than to the controller chip):
Of course this isn't necessary unless you disabled keyboard scanning previously.
BTW the "ACK" is probably left over from your "RefreshLEDs();" code - hard to tell.
Cheers,
Brendan
Code: Select all
WaitToWrite();
outb(0x64, 0xF4);
What you want to do is send 0xF4 to the keyboard itself (rather than to the controller chip):
Code: Select all
WaitToWrite();
outb(0x60, 0xF4);
BTW the "ACK" is probably left over from your "RefreshLEDs();" code - hard to tell.
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Re:Keyboard Driver
yes, it roxs now.
but if i hit a key i get a gpf( general protection fault). what this mean exactly. means that, that i try to access on a space which a have no write/read rights or what means that?
why could this appear?
thank really! this forum is great!
but if i hit a key i get a gpf( general protection fault). what this mean exactly. means that, that i try to access on a space which a have no write/read rights or what means that?
why could this appear?
thank really! this forum is great!
Re:Keyboard Driver
GPF is the "catch-all" of exceptions. It means that something went wrong, but it isnt one of the other types. Think protection errors and such.zack wrote: yes, it roxs now.
but if i hit a key i get a gpf( general protection fault). what this mean exactly. means that, that i try to access on a space which a have no write/read rights or what means that?
why could this appear?
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Keyboard Driver
doh. >_<Brendan wrote: Hi,
They are entirely different.Pype.Clicker wrote: ** junk **
as far as i'm concerned, i'd completely avoid to switch to other scancode stuff. The chipset convert whatever it receives to scancode 1 which is well known, setup by default by the BIOS, supports newer keys like "WIN" and "POPUP", and even more ...The controller chip's scancode conversion can be disabled, but it's probably not worth the hassle for most OS's.
So other scancode sets are mainly the problem of people that program PICs to receive input from a PS/2 keyboard, not the problem of people that develop Operating Systems ...