Emitting a key event across nodes

I need to have an Photon application running on one node send
an key event to another Photon application running on a different
node. Does anyone know how to do this? Think of it as a virtual
keyboard running on the secondary node that when the user presses
a key ( like keypad key “2” ), the 2 would appear on the currently
focused widget in the application running on the primary node.

I would like to fake out Input somehow so that my application running
on node 2 sends a key press event to the Input process on node 1, that
way the application code on node 1 thinks it came from the keyboard
and not another application.

Thanks,
Rob Davidson

Rob Davidson <rdavidson@softwareremodeling.com> wrote:

I need to have an Photon application running on one node send
an key event to another Photon application running on a different
node. Does anyone know how to do this? Think of it as a virtual
keyboard running on the secondary node that when the user presses
a key ( like keypad key “2” ), the 2 would appear on the currently
focused widget in the application running on the primary node.

I would like to fake out Input somehow so that my application running
on node 2 sends a key press event to the Input process on node 1, that
way the application code on node 1 thinks it came from the keyboard
and not another application.

Talking to a Photon on another node is trivial – just pass the full
path to the appropriate Photon device to PtInit() or, even simpler, set
the PHOTON environment variable before doing the usual Photon
initialization.

What is much more tricky is to have one process talk to two Photons at
the same time. If I understand you correctly, you want your proram to
read key events from one Photon and then emit them into another – is
that right?

If it is, then I think the easiest solution is to use two processes and
have one send keys to the other. If you want to keep them as one
program that forks, remember to call fork() before initializing Photon
library.

\

Wojtek Lerch (wojtek@qnx.com) QNX Software Systems Ltd.

Wojtek Lerch wrote:

Talking to a Photon on another node is trivial – just pass the full
path to the appropriate Photon device to PtInit() or, even simpler, set
the PHOTON environment variable before doing the usual Photon
initialization.

Ok, so say I have a process running on node 2. You press a button on
this
application. If, instead of having photon run on node 2 as /dev/photon,
I
had photon running on node 2 as //1/dev/photon, then would my events
(including
keyboard) go to photon on node 1? Would this be intercepted
automatically
by an application on node1 that has a text widget in focus?

What is much more tricky is to have one process talk to two Photons at
the same time. If I understand you correctly, you want your proram to
read key events from one Photon and then emit them into another – is
that right?

Doesn’t have to be if the above would work.

If it is, then I think the easiest solution is to use two processes and
have one send keys to the other. If you want to keep them as one
program that forks, remember to call fork() before initializing Photon
library.

Two process would be fine as long as it works. How do node2 process
send keys to node1 process and make it appear as a actual keyboard
event (not a normal QNX message).

Thanks for your help so far.
Rob


Wojtek Lerch (> wojtek@qnx.com> ) QNX Software Systems Ltd.

Original msg:

I need to have an Photon application running on one node send
an key event to another Photon application running on a different
node. Does anyone know how to do this? Think of it as a virtual
keyboard running on the secondary node that when the user presses
a key ( like keypad key “2” ), the 2 would appear on the currently
focused widget in the application running on the primary node.

I would like to fake out Input somehow so that my application running
on node 2 sends a key press event to the Input process on node 1, that
way the application code on node 1 thinks it came from the keyboard
and not another application.

Rob Davidson wrote:

Wojtek Lerch wrote:
Talking to a Photon on another node is trivial – just pass the full
path to the appropriate Photon device to PtInit() or, even simpler, set
the PHOTON environment variable before doing the usual Photon
initialization.

Ok, so say I have a process running on node 2. You press a button on
this
application. If, instead of having photon run on node 2 as /dev/photon,
I
had photon running on node 2 as //1/dev/photon, then would my events
(including
keyboard) go to photon on node 1? Would this be intercepted
automatically
by an application on node1 that has a text widget in focus?


What is much more tricky is to have one process talk to two Photons at
the same time. If I understand you correctly, you want your proram to
read key events from one Photon and then emit them into another – is
that right?

Doesn’t have to be if the above would work.


If it is, then I think the easiest solution is to use two processes and
have one send keys to the other. If you want to keep them as one
program that forks, remember to call fork() before initializing Photon
library.

Two process would be fine as long as it works. How do node2 process
send keys to node1 process and make it appear as a actual keyboard
event (not a normal QNX message).

Thanks for your help so far.
Rob

\

Wojtek Lerch (> wojtek@qnx.com> ) QNX Software Systems Ltd.

Original msg:

I need to have an Photon application running on one node send
an key event to another Photon application running on a different
node. Does anyone know how to do this? Think of it as a virtual
keyboard running on the secondary node that when the user presses
a key ( like keypad key “2” ), the 2 would appear on the currently
focused widget in the application running on the primary node.

I would like to fake out Input somehow so that my application running
on node 2 sends a key press event to the Input process on node 1, that
way the application code on node 1 thinks it came from the keyboard
and not another application.

You MAY try:

(1) Use qnx_name_locate to get pid of your application on Node 1.

(2) In Node2, your application ( virtual keyborad ) sends keyboard information
by:

PtForwardWindowTaskEvent( connection_id, &event );

Regards

\

WeiBing Tong

Aquila Mining Systems Ltd.
1450 City Councillors, Suite 330
Montreal, QC
Canada H3A 2E6
Tel: (514) 874-9917 ext 239
Fax: (514) 874-4005
Email: wbtong@aquilamsl.com

Two process would be fine as long as it works. How do node2 process
send keys to node1 process and make it appear as a actual keyboard
event (not a normal QNX message).

A keyboard event is a “normal QNX message”. That is the point. In
fact, that is the whole point of QNX in general. To do a quick
experiment, run Input on a node different from the node that Photon is
running on, something like:

Input -d //2/dev/photon msoft fd -d/dev/ser1 &

(modify for your particular hardware and node numbers)

Assuming that Photon is running on node 2 (and that you really do have a
M$ mouse on ser1, then you can now move the pointer around on node 2).
All Input is doing, is what Wojtek suggests (it is opening the pathname
you provided as an arg to the -d option).

Rennie