How to make sure all the key codes available?

Asked by Nathan Campos

I'm starting a "just for fun" (aka pet project) to control my computer remotely using JSON (the server is already working), but in order for python-uinput to work I need to pass the list of key codes that I'll use to the uinput.Device().

Is there a way to pass a list with literally all the available key codes into uinput.Device? Also, is there a list of these KEY_ codes that uinput accepts available somewhere?

Question information

Language:
English Edit question
Status:
Answered
For:
python-uinput Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
a (tuomasjjrasanen) said :
#1

Hi!

Nice to hear that you are playing with python-uinput.

> Is there a way to pass a list with literally all the available key codes into uinput.Device?

As you probably have noticed, uinput.ev -module is generated during installation of python-uinput and it's based on your systems /usr/include/linux/input.h which enumerates all possible events. So uinput.ev has a assigned variables for all events. But unfortunately, there isn't any list variables holding all events per type yet. I need to add that to next release so that one could refer to create a device with all key events for example like this:

  d = uinput.Device(uinput.ALL_KEYS)

> Also, is there a list of these KEY_ codes that uinput accepts available somewhere?

All event codes are listed in /usr/include/linux/input.h (file is part of the Linux kernel). All keycodes are available also in uinput.ev.py -module as I described above.

Revision history for this message
Nathan Campos (eeepc904) said :
#2

Ahh. Thanks very much for your help. I'll be waiting for the next release so I can use uinput.ALL_KEYS. Could you please contact me when the next version becomes available?

Best Regards

Can you help with this problem?

Provide an answer of your own, or ask Nathan Campos for more information if necessary.

To post a message you must log in.