Keyboard layouts: WHERE are they!?

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.
HJED
Member
Member
Posts: 61
Joined: Tue Sep 04, 2007 4:18 am
Location: the world wide web
Contact:

Keyboard layouts: WHERE are they!?

Post by HJED »

hi
dose anyone know where i could get information on and/or keyboard layout scan codes.
.................................. um what should i put here .............................?..........................................
..... :D................
Pyrofan1
Member
Member
Posts: 234
Joined: Sun Apr 29, 2007 1:13 am

Post by Pyrofan1 »

Bran's kernel tutorial, keyboard section
frank
Member
Member
Posts: 729
Joined: Sat Dec 30, 2006 2:31 pm
Location: East Coast, USA

Post by frank »

User avatar
bewing
Member
Member
Posts: 1401
Joined: Wed Feb 07, 2007 1:45 pm
Location: Eugene, OR, US

Post 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
HJED
Member
Member
Posts: 61
Joined: Tue Sep 04, 2007 4:18 am
Location: the world wide web
Contact:

Post 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
.................................. um what should i put here .............................?..........................................
..... :D................
Pyrofan1
Member
Member
Posts: 234
Joined: Sun Apr 29, 2007 1:13 am

Post 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 */
};		
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post 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!
Craze Frog
Member
Member
Posts: 368
Joined: Sun Sep 23, 2007 4:52 am

Post 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.
User avatar
JackScott
Member
Member
Posts: 1036
Joined: Thu Dec 21, 2006 3:03 am
Location: Hobart, Australia
Mastodon: https://aus.social/@jackscottau
Matrix: @JackScottAU:matrix.org
GitHub: https://github.com/JackScottAU
Contact:

Post 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.
User avatar
bewing
Member
Member
Posts: 1401
Joined: Wed Feb 07, 2007 1:45 pm
Location: Eugene, OR, US

Post by bewing »

Yes, all of them we can test should go in the wiki, of course.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Post by Combuster »

Wouldn't there be a way to get the keyboard layouts from say, Linux?
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
exkor
Member
Member
Posts: 111
Joined: Wed May 23, 2007 9:38 pm

Post 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.
User avatar
bewing
Member
Member
Posts: 1401
Joined: Wed Feb 07, 2007 1:45 pm
Location: Eugene, OR, US

Post 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.
User avatar
JAAman
Member
Member
Posts: 879
Joined: Wed Oct 27, 2004 11:00 pm
Location: WA

Post 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
HJED
Member
Member
Posts: 61
Joined: Tue Sep 04, 2007 4:18 am
Location: the world wide web
Contact:

Post by HJED »

thanks for your help and ideas :D :D :D
.................................. um what should i put here .............................?..........................................
..... :D................
Post Reply