Keyboard Driver

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
Collin

Keyboard Driver

Post by Collin »

Hello,
I need to find a keyboard driver for my OS. Does anyone
know where I could find some source code?

Collin
Crg^

RE:Keyboard Driver

Post by Crg^ »

>On 2001-02-23 12:58:09, Collin wrote:
>Hello,
>I need to find a keyboard driver for my OS. Does anyone
>know where I could find some source code?
>
>Collin
It`s quite simple, after the IRQ occurs you have to get a
scancode from port 60h and then send to port 20h value 20h
to tell the controler that the IRQ was dispatched.
so the code could look like:

mov dx,60h
in dx,al
mov bl,al
mov al,20h
mov dx,20h
out dx,al
;; bl -> scancode

another story comes when you want to change scancode to a
ascii character:) anyone have any table about it ?
Guest

RE:Keyboard Driver

Post by Guest »

>On 2001-02-23 13:22:44, Crg^ wrote:
>>On 2001-02-23 12:58:09, Collin wrote:
>>Hello,
>>I need to find a keyboard driver for my OS. Does
anyone
>>know where I could find some source code?
>>
>>Collin
>It`s quite simple, after the IRQ occurs you have to get
a
>scancode from port 60h and then send to port 20h value
20h
>to tell the controler that the IRQ was dispatched.
>so the code could look like:
>
>mov dx,60h
>in dx,al
>mov bl,al
>mov al,20h
>mov dx,20h
>out dx,al
>;; bl -> scancode
>
>another story comes when you want to change scancode to
a
>ascii character:) anyone have any table about it ?

Thanks. This will help alot.

Collin
Chris Giese

RE:Keyboard Driver

Post by Chris Giese »

>On 2001-02-23 13:22:44, Crg^ wrote:
>>On 2001-02-23 12:58:09, Collin wrote:
>>Hello,
>>I need to find a keyboard driver for my OS. Does
anyone
>>know where I could find some source code?
>>
>>Collin
>It`s quite simple, after the IRQ occurs you have to get
a
>scancode from port 60h and then send to port 20h value
20h
>to tell the controler that the IRQ was dispatched.
>so the code could look like:
>
>mov dx,60h
>in dx,al
>mov bl,al
>mov al,20h
>mov dx,20h
>out dx,al
>;; bl -> scancode

That's a good start. Write a program to take
over IRQ 1, read bytes from port 60h, and
print them in hex.

You should not use printf() in an interrupt
handler, so use a queue or global variable to
pass the port 60h values to main()

Then, you can switch the keyboard controller
(8042 chip) into different modes: scancode
sets 1, 2, and 3; set-2-to-set-1 translation
or or off. See what difference it makes.

Or, just read all this crap:

http://www.execpc.com/~geezer/os/kbd.txt
http://www.execpc.com/~geezer/os/kbd.c
http://www.execpc.com/~geezer/osd/kbd/index.htm
Guest

RE:Keyboard Driver

Post by Guest »

>On 2001-02-24 04:05:42, Chris Giese wrote:
>>On 2001-02-23 13:22:44, Crg^ wrote:
>>>On 2001-02-23 12:58:09, Collin wrote:
>>>Hello,
>>>I need to find a keyboard driver for my OS.
Does
>anyone
>>>know where I could find some source code?
>>>
>>>Collin
>>It`s quite simple, after the IRQ occurs you have to
get
>a
>>scancode from port 60h and then send to port 20h
value
>20h
>>to tell the controler that the IRQ was dispatched.
>>so the code could look like:
>>
>>mov dx,60h
>>in dx,al
>>mov bl,al
>>mov al,20h
>>mov dx,20h
>>out dx,al
>>;; bl -> scancode
>
>That's a good start. Write a program to take
>over IRQ 1, read bytes from port 60h, and
>print them in hex.
>
>You should not use printf() in an interrupt
>handler, so use a queue or global variable to
>pass the port 60h values to main()
>
>Then, you can switch the keyboard controller
>(8042 chip) into different modes: scancode
>sets 1, 2, and 3; set-2-to-set-1 translation
>or or off. See what difference it makes.
>
>Or, just read all this crap:
>
>http://www.execpc.com/~geezer/os/kbd.txt
>http://www.execpc.com/~geezer/os/kbd.c
>http://www.execpc.com/~geezer/osd/kbd/index.htm

Hehheheh, hey Geeze, here's [email protected] ;]
Anyone have a table to convert scancode-> ascii?
Chase

RE:Keyboard Driver

Post by Chase »

>On 2001-02-24 04:57:54, Anonymous wrote:

>Anyone have a table to convert scancode-> ascii?

Lots of keyboard info here
http://www.arne.si/~mauricio/Kbdfaq.htm
houbOS1
Posts: 7
Joined: Tue Jan 22, 2008 1:34 pm

reply

Post by houbOS1 »

All the links to keyboard info & tables are broken, or did not work for me. So here's another one for scancodes : http://www.glue.umd.edu/~NSW/ench250/scancode.htm#Key3
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post by JamesM »

Oh well bumped, knobarse. Do you really think that those people posting in 2001 really need the information now?!
Ready4Dis
Member
Member
Posts: 571
Joined: Sat Nov 18, 2006 9:11 am

Post by Ready4Dis »

JamesM wrote:Oh well bumped, knobarse. Do you really think that those people posting in 2001 really need the information now?!
Probably not, but it proves he searched, and anybody using search (which everybody should be using before posting) that finds this link will now have a valid link to find the information since all the olds ones have dissappeared, meaning they don't have to create another post asking the same question ;).
Post Reply