keyboard driver: How does os send data to program

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
garob
Posts: 16
Joined: Wed Dec 30, 2009 3:26 am
Location: Melbourne, Australia

keyboard driver: How does os send data to program

Post by garob »

The keyboard driver catches the interrupt, figures out which key was pressed, then sends a message to the user program. How do I send it to that message?
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Re: keyboard driver: How does os send data to program

Post by AJ »

Hi,

How do you do your normal IPC?

Cheers,
Adam
User avatar
piranha
Member
Member
Posts: 1391
Joined: Thu Dec 21, 2006 7:42 pm
Location: Unknown. Momentum is pretty certain, however.
Contact:

Re: keyboard driver: How does os send data to program

Post by piranha »

The way that I see it, the kernel does not send the data - the process retrieves the data through some sort of read call. The way I see it, the key is pressed and the kernel catches the int and then stores the pressed key to a buffer. Then the user process performs a system call and the kernel returns one (or more) keys stored in the buffer.

Of course, this isn't the only way, you could send a pressed key to a process by means of a signal or message...

-JL
SeaOS: Adding VT-x, networking, and ARM support
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
User avatar
Creature
Member
Member
Posts: 548
Joined: Sat Dec 27, 2008 2:34 pm
Location: Belgium

Re: keyboard driver: How does os send data to program

Post by Creature »

Or you could have your application (when initializing) perform a system call that registers an event handler function, which is called when a keyboard interrupt occurs (à la Win32?).
When the chance of succeeding is 99%, there is still a 50% chance of that success happening.
Post Reply