On Mon, 6 Oct 2003, Hans-Georg Thien wrote:yes, - I know
Richard B. Johnson wrote:
On Mon, 6 Oct 2003, Hans-Georg Thien wrote:
[...]
I'm writing a kernel mode device driver (mouse).
In that device driver I need the timestamp of the last event for another
kernel mode device (keyboard).
I do not care if that timestamp is in jiffies or in gettimeofday()
format or whatever format does exist in the world. I am absolutely sure
I can convert it somehow to fit my needs.
But since it is a kernel mode driver it can not -AFAIK- use the signal()
syscall.
-Hans
Then it gets real simple. Just use jiffies, if you can stand the [...]
I fear that there is still some miss-understanding. Jiffies are totally
OK for me. I can use them without any conversion.
I'll try to formulate the problem with some other words:
I hope that there is is something like a "jiffie-counter" for the
keyboard driver, that stores the actual jiffies value whenever a
keyboard interrupt occurs.
Well the keyboard driver and the mouse driver are entirely
different devices.
The keyboard has a built-int CPU that generates scan-codes foryes, - I know
every key-press/key-release. It also performs auto-repeat. The
mouse generates mouse data at each interrupting event. This data
represents direction and three key events. Wheel mouse have may
have additional data, I haven't looked at them. They are not
related in any way.
yes, - I know =8))
I hope too, that there is a way to query that "jiffie-counter" from
another kernel driver, so that I can write something like
mymouse_module.c
...
void mouse_event(){
// get the current time in jiffies
int now=jiffies;
// get the jiffie value of the last kbd event
int last_kbd_event= ????; // ... but how to do that ...
if ((now - last_kbd_event) > delay) {
do_some_very_smart_things();
}
}
...
Now this pseudo-code shows a "last_kbd_event", not a mouse-
event as shown in:
yes, I know. But my question was: how can I get the timestamp of the last keyboard interrupt.
[... a quite detailed explanation on mouse interrupts, mouse data ...]
When your module is un-installed, it needs to restore theyes, - I know
previous (saved) value of that pointer.
Whatever code you make that pointer point-to, must beyes, - I know
interrupt-safe. It can get the jiffie-count and put it
into a buffer, then return.