Microsoft Wireless Comfort Desktop 5000 Keyboard special keys

Solution 1:

I think the kernel is the lowest rational layer.

The kernel will identify keys using scan codes which you can see in sudo showkey -s by pressing that key. The kernel also converts these keys to key codes which you can see in sudo showkey -k. If you want to remap some keys, you can alsodo it with the setkeycodes utility.

If you want to go even lower, wireshark can intercept USB traffic.