index

the story of my patch for evdev (linux kernel)

Here's an explanation http://lkml.org/lkml/2005/10/6/92

Maybe netbsd has evdev equivalent: see "nanotime(&ev->time);" in wskbd.c. Documentation is in wsconsio.h

2.6.12.5 patch

2.6.14-rc3 http://lkml.org/lkml/diff/2005/10/6/92/1

2.6.15-rc7 patch

2.6.16.9 patch (no more need for patching kernel/posix-timers.c)

cd /usr/src/linux;  patch -p1 < the-saved-file.patch
make menuconfig
       -> enable   Device Drivers > Input > Event Interface  (as Module)
                  and                        > USB  > USB Human Interface Device (full HID) support
          (or just ps/2 keyboard)

Unfortunately, current kernel "core" does not export do_posix_clock_monotonic_gettime, so modules cannot use that function to obtain the monotonic time, so you will have to (re)boot a kernel with my patch applied. If it were exported you could simply reload the patched evdev module.

application to test if the feature is present:

XFree86 driver which exploits it

Making sure, the linux keyboard code does assign timestamp in "upper" half interrupt handler.

drivers/input/keyboard/atkbd.c

static irqreturn_t atkbd_interrupt(struct serio serio, unsigned char data, unsigned int flags)

calls: input_event

** drivers/input/input.c input_event -> calls

list_for_each_entry(handle, &dev->h_list, d_node) handle->handler->event(handle, type, code, value);

So I would suggest to get the time before calling all of them! But I can start experiment.....

.... so the question is, what are these handler->event ? let's start with Type?

DEV is input_dev dev

** include/linux/input.h

input_dev has indeed struct list_head h_list; Which tells us nothing !!!

What is input_link_handle ?

input_devices_seq_show

cat  bus/input/handlers 

N: Number=0 Name=kbd
N: Number=1 Name=mousedev Minor=32
N: Number=2 Name=tsdev Minor=128
N: Number=3 Name=evdev Minor=64