Detecting PS/2 and AT

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.
jal
Member
Member
Posts: 1385
Joined: Wed Oct 31, 2007 9:09 am

Re: Detecting PS/2 and AT

Post by jal »

Brendan wrote:Originally there were 2 control keys that gave the same scancode.
Not quite. The original XT keyboard had only one Ctrl-key and one Alt-key, but two Shift-keys. That's why the shift keys have their own code, and the Ctrl and Alt have the same + extended (for the reason you mentioned: backwards compatibility). Everything else you write is correct, it's all done for backwards compatability (with the original XT!).


JAL
User avatar
ChazZeromus
Member
Member
Posts: 61
Joined: Sun Jun 22, 2008 4:09 pm

Re: Detecting PS/2 and AT

Post by ChazZeromus »

Brendan wrote:Hi,
ChazZeromus wrote:Why is right control have a way different scancode than the left?
Originally there were 2 control keys that gave the same scancode. Then they added extended scancodes (scancodes that begin with an 0xE0 byte) and gave the right control key it's own scancode (so you could tell which control key was pressed), but they did it in a way that made sense if you ignored the 0xE0 byte (because old software that was written beforehand ignores 0xE0). For example, left control is 0x14 while right control is "0xE0 0x14" (which gives backward compatible scancodes for the old software). The same is true for other keys, like left and right alt; and up, down, left, right, pgup, pgdown, end, delete, home and insert (which had scancodes on the numerics keypad but were given extended scancodes when they became seperate keys).

In a similar way the scancode for prntScrn is backward compatible with the scancodes for "left_shift + keypad_*", and the scancode for pause is backward compatible with the scancodes for "control + numLock" (where 0xE1 is strange because the new right control already used the 0xE0 byte).

Note: For all of the above I'm talking about scancode set 1 (or translated scancode set 2). For untranslated scancode set 2 it's the same with different numbers...
ChazZeromus wrote:How can I get the same multiple input intervals for the pause key?
What do you mean by "multiple input intervals"? If you want to get a break code when pause is released (like normal keys) then you can't unless you use scancode set 3 (which isn't recommended)..


Cheers,

Brendan
Well Im only getting one scancode for the pause key when i hold it down, so configuring the keyboard controller to set 3 well change this? Well that drastically change anything else?
Image
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: Detecting PS/2 and AT

Post by Brendan »

Hi,
ChazZeromus wrote:Well Im only getting one scancode for the pause key when i hold it down, so configuring the keyboard controller to set 3 well change this?
Yes - in scancode set 3 you should get a make scancode when "pause" is pressed and then (some time later) a break scancode when it's released.
ChazZeromus wrote:Well that drastically change anything else?
Yes - you'll end up with unreliable code, because lots of keyboards don't support scancode set 3, and AFAIK there's no way to determine if scancode set 3 is supported or not.


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.
Post Reply