keyboard not so dumb?

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.
Post Reply
sancho1980
Member
Member
Posts: 199
Joined: Fri Jul 13, 2007 6:37 am
Location: Stuttgart/Germany
Contact:

keyboard not so dumb?

Post by sancho1980 »

hi

after having my os lay idle for quite a while, i was just playing around with it and noticed some strange behaviour.
i have a table for my keyboard driver which is laid out a bit like this:

table: [
actionWhenKeyUnshifted, actionWhenKeyShifted,
...
]

I used to have only entries for "normal" characters like abce..xyz in that table, completely leaving out numbers and special characters.
Now I just wante to add the colon,semicolon,commam and full stop characters (which on my german keyboard are entered by pressing the keys just right to the "m" key.

so i made the respective entries in the keyboard table:

table: [
...
',', ';',
'.', ':'
...
]

When I press the respective keys unshifted, everything is fine, but when I press the two keys shifted, their respective characters (';', ':') dont appear on the console.
I then inserted a putunsint call in the keyboard interrupt service just to see the scancode, an the result quite surprised me:
When I press the key just right beside the 'm' key unshifted, the make and break codes are 102 and 358. When I press the very same key shifted, the make and break codes are: 78 and 334. Shouldnt the keyboard ALWAYS send the same make and break codes irrespective of what other keys are pressed?
PS I use bochs...
Korona
Member
Member
Posts: 1000
Joined: Thu May 17, 2007 1:27 pm
Contact:

Re: keyboard not so dumb?

Post by Korona »

sancho1980 wrote:PS I use bochs...
AFAIK bochs does not send the actual key presses to your os but translates them according to your keyboard layout settings. Some real keyboards also send different scancodes while control keys are pressed (e.g. laptops that have FN keys do that). One key may not always generate the same scancode in all situations.
Post Reply