Almost everyone modder here has looooong way to success.
Right way to understand keys response is read lua files in ED`s modules.
clickable_data file define what button will response to specific command (3001....)
you device.lua can handle this events (button press/unpress) by SetCommand function.
True, all those links between files are mindblown at first steps in modding. But you have to deal with it.
Just read, code, try, correct and again and again :)