This project is read-only.

Change Keyboard language?

Topics: Compiler, Using Cosmos (Developing your own OS, projects, etc)
Oct 15, 2012 at 9:31 AM
Edited Oct 15, 2012 at 1:03 PM

Hi @all  :)

My english is not the best, because i´m from Germany..

Is it possible to change the keyboard-input-language in COSMOS?
For example:  On my german Keyboard "y" is "z" and "z" is "y".

Oct 15, 2012 at 12:20 PM

You just need to create a new scan map.

Oct 15, 2012 at 1:02 PM
Edited Oct 15, 2012 at 1:03 PM
kudzu wrote:

You just need to create a new scan map.

Big thanks!

It would be very nice if you could give me an example.
I´m new in COSMOS and I don´t know anything about scan maps :D 

Oct 15, 2012 at 5:48 PM
On 10/15/2012 8:03 AM, SplitOS wrote:
> It would be nice if you could give me an example.
> I´m new in COSMOS and I don´t know anything about scan maps :D

Take a look at the keyboard code and you'll see the existing English map.
Oct 15, 2012 at 11:37 PM
Edited Oct 15, 2012 at 11:39 PM

Basically, your keyboard is an electric device. An hundred or so switches. For marketing purpose the switches are decorated with a glyph our brain was given a meaning when we were at school. A couple of decades ago each computer you could buy was engineered and marketed by a company owning everything from the screen to the keyboard (no virtual 3D glasses or even mouse at that time).

Thanks to early globalization, it has been discovered a factory can build a keyboard that can fit requirements from any country on one or two continents at a time. This allowed for keyboards that where 10 to 30 times cheaper than the ones that were available before. However there was a little drawback. These cheaper keyboards couldn't tell anymore which "letter" or "digit" the user pressed. They could just say something like "user hit key number 143". From that time until now, OSes are accustomed to handle this kind of message using what is sometimes known as a "scan map". Each key is given a number by the keyboard manufacturer and a little piece of software is handling the translation within the OS itself using this "scan map" that will say number 143 is eszett (just an example, I'm quite sure this is not the key number for this letter on your keyboard) . Ahem, and because your OS is wise enough to know your danish girlfriend might come to your home with her own keyboard with a very different glyph than yours  for key number 143 and hot plug it (the keyboard) on your computer, your friendly OS will let you switch the "scan map" on the fly.

Oct 16, 2012 at 8:45 AM

Ok thanks =)

uint scancode;
Global.Keyboard.GetScancode(out scancode);   // returns 0

So far so good, but I don´t know how to code a new scanmap ^^