Re: raw keyboard mode

Search this archive.

From: Jay Link (jlink@interlink-bbs.com)
Date: Thu 09 Mar 2000 - 14:19:16 IST


> My question is what is the raw keyboard mode? Is it the default?

No, it is NOT the default. Raw keyboard mode allows you to scan for
"special" keys, like the four directional arrows or "Print Screen". You
must deliberately enter raw keyboard mode, and then you must exit it
before your program ends.

You will find a list of "scancodes" in /usr/include/vgakeyboard.h, or
where ever your SVGAlib header files are. Plug in these scancodes just
like you'd use a screen mode as an arguement to vga_setmode().

Here's a brief summary:

   if (keyboard_init())
   {
        vga_setmode(TEXT);
        printf("Could not initialize keyboard.\n");
        exit(1);
   }

   while (/* some condition exists */)
   {
      keyboard_update();
      /* This is what reads in the buffer. You must constantly update
         your knowledge of the buffer by calling this */

      if (keyboard_keypressed(SCANCODE_PRINTSCREEN))
      {
         /* Someone has pressed "Print Screen" */
         /* See vgakeyboard.h for other scancodes */
      }
   }

   keyboard_close();
   /* Don't forget this part! */


HTH,

-Jay Link


This archive was generated by hypermail 2.1.4 : Wed 21 Jan 2004 - 22:10:23 IST