Page 1 of 2

Keyboard layouts: WHERE are they!?

Posted: Wed Sep 26, 2007 4:08 pm
by HJED
hi
dose anyone know where i could get information on and/or keyboard layout scan codes.

Posted: Wed Sep 26, 2007 4:26 pm
by Pyrofan1
Bran's kernel tutorial, keyboard section

Posted: Wed Sep 26, 2007 6:28 pm
by frank

Posted: Wed Sep 26, 2007 7:25 pm
by bewing
I used Bran's, but I think it has a couple errors in it. At least, I know I had to fix and reprogram a couple things.

Here is my map from scanset 1 keyboard scancodes into lowercase ascii.

Code: Select all

kbd_table:
 	db	255,  27, '1234567890-=', 8, 9		; bad, esc, backspace & tab
 	db	'qwertyuiop[]', 13, 2			; Enter & left ctl
 	db	'asdfghjkl;', 39, '`', 0		; Left shift
 	db	'\zxcvbnm,./', 1			; Right shift
 	db	150, 4, ' ', 12			; Kp*, Left Alt, sp, NumLock
 	db	128, 129, 130, 131, 132, 133, 134, 135, 136, 137	; F1 - F10
 	db	11, 10, 147, 148, 149, 153	; CapsLock, ScrlLck, Kp7-9, Kp-
 	db	144, 145, 146, 151		; Kp4-6, Kp+
 	db	141, 142, 143, 140, 154, 14	; Kp1-3, Kp0, Kp., Alt-PrtSc
 	db	255, 255, 138, 139, 255		; 2 bad, F11, F12, 1 bad
 	db	255, 255, 255, 255, 255, 255	; 5a to 5f are bad
; and now for all the codes with an e0 in front
kbd_e0tbl:
 	db	255, 255, 255, 255, 255, 255, 255, 255		; most e0 esc's are illegal
 	db	255, 255, 255, 255, 255, 255, 255, 255		; 8 to 0f
 	db	255, 255, 255, 255, 255, 255, 255, 255		; 10 to 17
 	db	255, 255, 255, 255, 152, 3, 255, 255		; 18 to 1b, KpEnt, Rctl, 1e, 1f
 	db	255, 255, 255, 255, 255, 255, 255, 255		; 20 to 27
 	db	255, 255, 6, 255, 255, 255, 255, 255		; 28, 29, fake Lshft, 2b to 2f
	db	255, 255, 255, 255, 255, 155, 7, 15		; 30 to 34, Kp/, fake Rshft, ctlPrtScn
 	db	5, 255, 255, 255, 255, 255, 255, 255		; Right Alt, 39 to 3f
 	db	255, 255, 255, 255, 255, 16, 17, 29		; 40 to 44, Pause, ctlPause, Home
 	db	30, 31, 255, 26					; arrUp, PgUp, bad, arrLeft
 	db	255, 28, 255, 23				; bad, arrRight, bad, End
 	db	24, 25, 22, 0x7f				; arrDown, PgDn, Ins, Del
 	db	255, 255, 255, 255				; 54 to 57
 	db	255, 255, 255, 20				; 58 to 5a bad, LWindow
 	db	21, 18, 255, 255				; RWindow, Menu, 5e, 5f

Posted: Thu Sep 27, 2007 4:18 pm
by HJED
as far as i can tell those all those the us-international keyboard scan code.
dose anyone know of info about other keyboard layouts such as the uk keyboard layout.

but thanks for your help anyway

Posted: Thu Sep 27, 2007 4:22 pm
by Pyrofan1
just change the table so that when a key is pressed it provides the right letter like so

Code: Select all

unsigned char kbdus[128] =
{
    0,  27, '1', '2', '3', '4', '5', '6', '7', '8',	/* 9 */
  '9', '0', '-', '=', '\b',	/* Backspace */
  '\t',			/* Tab */
  'q', 'w', 'e', 'r',	/* 19 */
  't', 'y', 'u', 'i', 'o', 'p', '[', ']', '\n',	/* Enter key */
    KEY_CTRL,			/* 29   - Control */
  'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';',	/* 39 */
 '\'', '`',   KEY_LSHIFT,		/* Left shift */
 '\\', 'z', 'x', 'c', 'v', 'b', 'n',			/* 49 */
  'm', ',', '.', '/',   KEY_RSHIFT,				/* Right shift */
  '*',
    KEY_ALT,	/* Alt */
  ' ',	/* Space bar */
    KEY_CAPS,	/* Caps lock */
    KEY_F1,	/* 59 - F1 key ... > */
    KEY_F2,   KEY_F3,   KEY_F4,   KEY_F5,   KEY_F6,   KEY_F7,   KEY_F8,   KEY_F9,
    KEY_F10,	/* < ... F10 */
    0,	/* 69 - Num lock*/
    0,	/* Scroll Lock */
    KEY_HOME,	/* Home key */
    KEY_UP,	/* Up Arrow */
    KEY_PGUP,	/* Page Up */
  '-',
    KEY_LEFT,	/* Left Arrow */
    0,
    KEY_RIGHT,	/* Right Arrow */
  '+',
    KEY_END,	/* 79 - End key*/
    KEY_DOWN,	/* Down Arrow */
    KEY_PGDOWN,	/* Page Down */
    KEY_INSERT,	/* Insert Key */
    KEY_DEL,	/* Delete Key */
    0,   0,   0,
    KEY_F11,	/* F11 Key */
    KEY_F12,	/* F12 Key */
    0,	/* All other keys are undefined */
};	

unsigned char kbdvorak[128] =
{
    0,  27, '1', '2', '3', '4', '5', '6', '7', '8',	/* 9 */
  '9', '0', '[', ']', '\b',	/* Backspace */
  '\t',			/* Tab */
  '\'', ',', '.', 'p',	/* 19 */
  'y', 'f', 'g', 'c', 'r', 'l', '/', '=', '\n',	/* Enter key */
    KEY_CTRL,			/* 29   - Control */
  'a', 'o', 'e', 'u', 'i', 'd', 'h', 't', 'n', 's',	/* 39 */
 '-', '`',   KEY_LSHIFT,		/* Left shift */
 '\\', ';', 'q', 'j', 'k', 'x', 'b',			/* 49 */
  'm', 'w', 'v', 'z',   KEY_RSHIFT,				/* Right shift */
  '*',
    KEY_ALT,	/* Alt */
  ' ',	/* Space bar */
    KEY_CAPS,	/* Caps lock */
    KEY_F1,	/* 59 - F1 key ... > */
    KEY_F2,   KEY_F3,   KEY_F4,   KEY_F5,   KEY_F6,   KEY_F7,   KEY_F8,   KEY_F9,
    KEY_F10,	/* < ... F10 */
    0,	/* 69 - Num lock*/
    0,	/* Scroll Lock */
    KEY_HOME,	/* Home key */
    KEY_UP,	/* Up Arrow */
    KEY_PGUP,	/* Page Up */
  '-',
    KEY_LEFT,	/* Left Arrow */
    0,
    KEY_RIGHT,	/* Right Arrow */
  '+',
    KEY_END,	/* 79 - End key*/
    KEY_DOWN,	/* Down Arrow */
    KEY_PGDOWN,	/* Page Down */
    KEY_INSERT,	/* Insert Key */
    KEY_DEL,	/* Delete Key */
    0,   0,   0,
    KEY_F11,	/* F11 Key */
    KEY_F12,	/* F12 Key */
    0,	/* All other keys are undefined */
};		

Posted: Fri Sep 28, 2007 1:35 am
by JamesM
Why don't you just do it yourself, like I did?

I took the US keyboard layout, then, when some keys didn't work I got my OS to print out their scancodes, then edited them. Simple as!

Posted: Fri Sep 28, 2007 7:08 am
by Craze Frog
JamesM wrote:Why don't you just do it yourself, like I did?

I took the US keyboard layout, then, when some keys didn't work I got my OS to print out their scancodes, then edited them. Simple as!
For every keyboard layout? There's over 90 of them. His house will be filled with keyboards by the time he's done.

Posted: Fri Sep 28, 2007 5:04 pm
by JackScott
There are worse things to collect. :P

We should all get together and do a keyboard layout each, then share data. Use a wiki page/directory for it. :) Much more sensible.

Posted: Fri Sep 28, 2007 5:35 pm
by bewing
Yes, all of them we can test should go in the wiki, of course.

Posted: Sat Sep 29, 2007 4:50 am
by Combuster
Wouldn't there be a way to get the keyboard layouts from say, Linux?

Posted: Sat Sep 29, 2007 10:12 am
by exkor
Craze Frog wrote:For every keyboard layout? There's over 90 of them. His house will be filled with keyboards by the time he's done.
There is no other way IMHO. Can't trust on work of others, only hope that its right and hope to check it some day. Otherwise mistakes will be copied from one program to another.

Posted: Sat Sep 29, 2007 1:30 pm
by bewing
exkor wrote:There is no other way IMHO. Can't trust on work of others, only hope that its right and hope to check it some day. Otherwise mistakes will be copied from one program to another.
I disagree. There are 5 million distinct pieces of hardware out there. It is quite impossible for each of us to independently build fully tested drivers for all of them. We do not have the time, or finances, to accomplish any such thing. Therefore, we *must* make it possible for other people's after-the-fact contributions to be added to our OSes -- if we have to label them "untrusted", then so be it. And that is precisely the situation here, with keyboard layouts. We need each non-US layout submitted to be as fully tested as possible, but we will all certainly reach the point where we simply have to accept what is provided by others.

Posted: Sun Sep 30, 2007 10:08 am
by JAAman
nobody wants to use the map tools provided by MS? the MS website has a list of all keyboards, with key maps (cant provide a link, since the one i have is out-of-date) and tools for identifying key-layouts of custom keyboards

Posted: Mon Oct 01, 2007 5:58 pm
by HJED
thanks for your help and ideas :D :D :D