1

i need to make a driver to emulate keypresses into a particular process in linux, can anyone help me with that?

It doesn't need to be a driver, but i believe there's no other way to do it, the OS is running with no screen manager and is using directfb to handle input

user615741
  • 43
  • 5
  • +1 for running Linux with no screen manager – contactmatt May 12 '11 at 14:44
  • get a 4X4 Keypad and interface it with the parallel port.Yes you are right it can be a user land application as well making ioctl calls to read the key press codes you get when you interface the keypad with teh PC's parallel port. – Raulp May 23 '12 at 18:21

2 Answers2

0

try xdotool-- it's for writing mouse/keyboard macros.

$ xdotool type "hello world"

$ xdotool keydown x

etc

captainandcoke
  • 1,085
  • 2
  • 13
  • 16
  • From the main website:"It does this using X11's XTEST extension and other Xlib functions" so, as i just said X is not running – user615741 May 12 '11 at 19:18
0

If you have the proper permissions, then you can use any of the read()/write() commands to interact with an arbitrary process in Linux.

Look at the /proc/ directory and you will see a file structure representation of the various components of each running process.

root@netbook:~# ll /proc/
total 4
dr-xr-xr-x 153 root       root                0 2011-06-19 23:14 ./
drwxr-xr-x  22 root       root             4096 2011-04-29 03:52 ../
dr-xr-xr-x   7 root       root                0 2011-06-22 15:58 1/
dr-xr-xr-x   7 root       root                0 2011-06-22 15:58 11/
...

I used ls for this example, but you can do this pragmatically with standard Linux libraries. Find the process you want to send keys to and open (with fopen or similar) the file /proc/{pid}/fd/0. This is the standard in (stdin) in Linux and anything you write to this character device will be interpreted as input.

CodePoet
  • 704
  • 5
  • 20