Page 1 of 1
keyboard driver: How does os send data to program
Posted: Mon Mar 08, 2010 2:09 am
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?
Re: keyboard driver: How does os send data to program
Posted: Mon Mar 08, 2010 3:34 am
by AJ
Hi,
How do you do your normal IPC?
Cheers,
Adam
Re: keyboard driver: How does os send data to program
Posted: Mon Mar 08, 2010 11:29 am
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
Re: keyboard driver: How does os send data to program
Posted: Tue Mar 09, 2010 9:20 am
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?).