I was wondering if anyone knew how to convert a key represented in ascii to linux input_event keycodes.
When I say ascii please refer to this graph: https://en.wikipedia.org/wiki/File:ASCII-Table.svg
When I say linux input_event keycodes please refer to this graph: https://elixir.bootlin.com/linux/v4.6/source/include/uapi/linux/input-event-codes.h
I understand I could just use a map between these but I was wondering if there was a more official way to do it. And yes I have taken a look at this solution: Convert ASCII character to x11 keycode but I'd like to not be dependent on X11 if possible for the solution.
Edit:
This question is not a duplicate of How can I translate Linux keycodes from /dev/input/event* to ASCII in Perl?. Explained in my answer below.