键盘输入解析算法的参考?

I am working on software for an embedded system where I need to parse the values of a USB device which is recognized by the Linux OS as a keyboard. The issue is that I need to convert the various keyboard events to actual text.

To me this seems like a fairly common task that should exist out there somewhere. Is there any projects or references that explain a good algorithm for implementing this? Stuff like when modifier keys are pressed, what the values become and stuff like that.

If it matters I am using Golang but implementations or references in other languages would be fine too.

I think this tool can solve your problem: termbox