How to simulate arrow keys and key up / key down events to /dev/input
I have an embedded linux board with a twl4030 keypad. It is registered as /dev/input/keypad.
How can I simulate KEY_LEFT / KEY_RIGHT / KEY_UP / KEY_DOWN, etc with this device? I can't seem to be able to echo an escape sequence to the /dev/input/location.
Can I somehow do that under /sys/class? Thanks !
Not exactly sure, I'm totally unfamiliar with that type of keyboard.
However there's probably a bit or byte pattern you send to that to represent these motions.
Further, there's likely a /dev/input/input0 device that you can open from within your program and be able to write data to that device, so what you would write is the patterns to cause the key presses you desire.
What I'm drawing from is the following:
/dev/ttyUSB0 - I get if I plug in a serial USB device. I can read from that and write to it from within a program.
/dev/input/mouse1 - happens to be on my system. If I "cat /dev/input/mouse1", when I move my mouse, I see characters (odd looking ones, because it's binary) stream to the terminal from which I executed the cat command.
So, my tact on this would be to find the device that is mapped to your keyboard, likely input0 as you've said, but you can check this by viewing your system log and further test it if you can unplug and replug the keyboard and check how that affects your system log (dmesg). I'd learn the message format requirements, and port settings, if any; required to talk to, or interpret data from this keypad. In fact, you could run a test program and perform actual keypad actions, read them in, in your program and validate that the messages you see match what you'd expect.
|All times are GMT -5. The time now is 06:13 PM.|