2005-03-29 11:55:32

by Mister Google

[permalink] [raw]
Subject: Keystroke simulator

Is there a way to simulate a keystroke to a program, ie. have a program send
it something so that as far as it's concerned, say, the "P" key has been
pressed?



Thanks,
The Nomad.

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


2005-03-29 16:05:49

by Vernon Mauery

[permalink] [raw]
Subject: Re: Keystroke simulator

Mister Google wrote:
> Is there a way to simulate a keystroke to a program, ie. have a program
> send it something so that as far as it's concerned, say, the "P" key has
> been pressed?
>
Look at the input system. Documentation/input/input-programming.txt has a great tutorial on how to do this.

--Vernon

2005-03-29 16:21:44

by Dmitry Torokhov

[permalink] [raw]
Subject: Re: Keystroke simulator

On Tue, 29 Mar 2005 08:06:53 -0800, Vernon Mauery <[email protected]> wrote:
> Mister Google wrote:
> > Is there a way to simulate a keystroke to a program, ie. have a program
> > send it something so that as far as it's concerned, say, the "P" key has
> > been pressed?
> >
> Look at the input system. Documentation/input/input-programming.txt has a great tutorial on how to do this.
>

You probably will want to write a program using uinput driver to
inject events into input subsystem from userspace. Then the rest of
the world will not be able to recognize whether the data comes from
your program of from a real keyboard.

--
Dmitry

2005-03-29 18:46:11

by Pavel Machek

[permalink] [raw]
Subject: Re: Keystroke simulator

On ?t 29-03-05 11:53:32, Mister Google wrote:
> Is there a way to simulate a keystroke to a program, ie. have a program
> send it something so that as far as it's concerned, say, the "P" key has
> been pressed?

See /dev/input/uinput

Pavel

--
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!

2005-03-29 20:21:10

by Bodo Eggert

[permalink] [raw]
Subject: Re: Keystroke simulator

Mister Google <[email protected]> wrote:

> Is there a way to simulate a keystroke to a program, ie. have a program send
> it something so that as far as it's concerned, say, the "P" key has been
> pressed?

Yes. That's what programs like telnetd do.

Look for man 4 pts.