Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 10-16-2012, 04:03 PM   #1
LQ Newbie
Registered: Jun 2012
Posts: 2

Rep: Reputation: Disabled
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 !
# pwd
# ls
bind            module          twl4030_keypad  uevent          unbind
Old 10-17-2012, 03:56 PM   #2
Registered: Mar 2011
Location: Sutton, MA. USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu
Posts: 5,712
Blog Entries: 12

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Alternatives to key event from /dev/input/eventX Xeratul Linux - General 1 05-24-2012 02:12 PM
[SOLVED] How can I simulate key strokes events in other processes in linux? RonBigman Programming 2 02-06-2011 01:42 PM
[problem] frequency log causes /dev/ttyS0 console freeze until any key input masue Linux - Embedded & Single-board computer 6 06-22-2010 07:55 PM
If 2 keys are held down, no input from 3rd key frem Linux - Hardware 3 01-10-2006 01:24 PM
Tab Key and arrow key zillah Solaris / OpenSolaris 12 05-26-2005 02:51 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:54 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration