I'm trying to write a Linux keyboard driver that matches to any keyboard entering the system.
After the driver is connected with the device, I want to intercept the input, log it somewhere, then forward it to the system, so that it is actually displayed on the user's screen.
So far, I have tried copying a driver directly from the linux source code.I have tried both usbkbd and usbhid drivers, I managed to get them to probe a device (using its Vendor and Product ID), but I did not manage to receive any scancodes. No keys are being typed out when my driver matches (even if I copied and pasted the source code from linux).
These are the sources I tried:
usbkbd: https://github.com/torvalds/linux/blob/master/drivers/hid/usbhid/usbkbd.c
usbhid (did not manage to get it to compile): https://github.com/torvalds/linux/blob/master/drivers/hid/usbhid/hid-core.c
Any tips on how I should proceed?