Vince Kim - 2009-02-19

<key-event-sample.c> is a sample code to show how keylib can use to read key event from virtual console. 

1. Build 
"make install" will install <key-event-lib.h> at /usr/include, and <libkeylib.so> to /usr/lib. 
"make sample" builds "key-event-sample" binary out of <key-event-sample.c>. 
This build is tested inside the scratchbox ARM target, and CROSS compile is not supported at this time, but simple Makfile modification will do the job. 

2. API 

<key-event-lib.h> defines all the necessary proto types and structures. 

/* open a virtual terminal and returns FD on success, and O on fail*/ 
/* event queue is created for storing key events */
int keylib_open(pKbdEventCtx ctx); 

/* close FD */ 
/* event queue is deleted here.*/
void keylib_close(pKbdEventCtx ctx); 

/* en-queue the key press event into event queue, and return number of event(s) */ 
int keylib_read(pKbdEventCtx ctx); 

/* pop an event from event queue */ 
pKeyEvent keylib_key_event_get(pKbdEventCtx ctx); 

/* caller must invoke this to free up the event, which is created by "keylib_key_event_get()" after the event is processed */ 
void keylib_key_event_free(pKeyEvent event);