LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Linux and trapping keyboard input (https://www.linuxquestions.org/questions/programming-9/linux-and-trapping-keyboard-input-572101/)

jantman 07-25-2007 03:08 AM

Linux and trapping keyboard input
 
I'm designing a small embedded system. It will only have a serial terminal active, but has a PS/2 keyboard connector. I would like to use a keyboard to activate certain functions on the system.

My question is how do I go about trapping keyboard input from a daemon? Is there any way to directly access the raw keyboard input? Running as root is no problem.

Ideally the daemon will be coded in Python, but I have a feeling this is a task that can only be implemented in C... which isn't nice, being that I don't know C.

Ok, the in-depth description:

I'm making a hardware device that will have about six hardware switches on it. I'm probably using one of the ~$100 boards from a company like EWayCo (www.ewayco.com) and building it into a custom enclosure. The board doesn't offer GPIO, and from what I've heard, serial switches would require a custom made board to work. So I looked at the keyboard encoders from Hagstrom Electronics (http://www.hagstromelectronics.com/) which allow you to just wire up switches, and it hooks up to a PS/2 port.

The problem is that this device will have an LCD screen, an audio output, and pretty much nothing else - so the program to handle the keyboard inputs would need to run as a daemon.

Any thoughts?

emi_ramo 07-26-2007 06:08 AM

Take a look at /dev/input/by-path/ (ls -l). In that directory you can see the mice and keyboards devices (and may be some other) as links to real input devices.


All times are GMT -5. The time now is 03:51 AM.