The hid.c was available in kernel 2.4.9 and older versions, but is now splited in multiple files
The HID keyboard / mouse/ joysticks events can be monitored / change at kernel level
Get the kernel source file of your kernel version.
http://lxr.linux.no/linux+v2.6.27.14/drivers/
for HID (hid.o) linux kernel module, rename the source files as
my-hiddraw.c
*
my-hid-core.c
*
my-hid-input.c
*
my-hid-input-quirk.c
Makefile:
obj-m := myhid.o
myhid-objs := my-hiddraw.o my-hid-core.o my-hid-input.o my-hid-input-quirk.o
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default:
$(MAKE) -C $(KDIR) M=$(PWD) modules
Add module in kernel as
$ sudo rmmod usbhid; sudo rmmod hid; sudo insmod myhid.ko; sudo insmod /[MODULE PATH]/usbhid.ko
***********************************************************************
The hid-input.c is responsiable to send the events to input subsystem / hiddev.c
For reference look at the documentation Linux hiddev.txt and input.txt
In hid-input.c the hidinput _ hid _ event () is responsiable to send the events
- void hidinput _ hid _ event(struct
hid _ device *hid, struct hid _ field
*field, struct hid_usage *usage, __s32 value)
Use at the end of function before input _ event (input, usage->type, usage->code, value);
printk("\n hidinput _ hid _ event %i, %i, %i",usage->type, usage->code, value);
Get/Modify those values and pass it to input _ events ()
***********************************************************************
Regards
mmadni[AT]gmail[DOT]com