[Contents] [Index] [Help] [Retrace] [Browse <] [Browse >]

Three primary steps are required to open the keyboard device:

   *  Create a message port using the createport() function.

   *  Create an extended I/O request structure using the createextio()
      function. CreateExtIO() will initialize the I/O request with your
      reply port.

   *  Open the keyboard device. Call opendevice(), passing the i/o request.


struct MsgPort  *KeyMP;         /* Pointer for Message Port */
struct IOStdReq *KeyIO;         /* Pointer for I/O request */

if (KeyMP=CreatePort(NULL,NULL))
  if (KeyIO=(struct IOStdReq *)CreateExtIO(KeyMP,sizeof(struct IOStdReq)))
    if (OpenDevice( "keyboard.device",NULL,(struct IORequest *)KeyIO,NULL))
        printf("keyboard.device did not open\n");