A long time ago someone posted the "SendKey" code that will properly wake up Audrey.
This code was also merged into the Audrey Caller ID (ACID) application. I am not sure if any changes were required, but this may be a good place to get the working code from http://www.timemocksme.com/acid
Here is the original code - I think it came from the http://qdn.qnx.com web site:
/* Toolkit headers */
#include <Ph.h>
#include <Pt.h>
#include <Ap.h>
#include <photon/PkKeyDef.h>
static void send_key( long key )
{
PhEvent_t event;
PhKeyEvent_t key_event;
PhRect_t rect;
rect.ul.x = rect.ul.y = 1;
rect.lr.x = rect.lr.y = 1;
memset( &event , 0, sizeof(event) );
memset( &key_event, 0, sizeof(key_event) );
event.type = Ph_EV_KEY;
event.emitter.rid = Ph_DEV_RID;
event.num_rects = 1;
event.data_len = sizeof(key_event);
event.input_group = 1;
key_event.key_cap = key;
key_event.key_sym = key;
key_event.key_flags = Pk_KF_Sym_Valid | Pk_KF_Cap_Valid | Pk_KF_Key_Down;
PhEventEmit( &event, &rect, &key_event );
key_event.key_flags &= ~(Pk_KF_Key_Down | Pk_KF_Sym_Valid);
PhEventEmit( &event, &rect, &key_event );
return;
}
int main( int argc, char *argv[]) {
long k;
PtWidget_t *window;
/* Init photon environment, even though I'm doing nothing with it. */
if ((window = PtAppInit(NULL, &argc, argv, 0, NULL))
== NULL)
PtExit(EXIT_FAILURE);
printf("Sending Key
");
send_key(Pk_F4);
}