[comp.unix.xenix.sco] Keyboard SCAN MODE

<ACPS2924@Ryerson.Ca> (06/18/91)

I'm using sco unix/386 and i'm trying to put the keyboard into something called
 raw mode. so i can read the keys in the dos fashion;

   key = getc();
   if (key == 0)  // extended key
   {
       key = getc();
       key = decode_key(0,key);
   } else
       key = decode_key(key,0);

 Im trying to read the decode the keyboard , reading all the Fxx ALTxx CTRLxx
and PGUP .... keys correctly.  THe code SCO sent me which was not in the docs
causes the entire system to crash.
Any code fragments or advice would be helpfull....

Peter


+----------------------------------------------------------------------+
acps2924@ryerson.ca ! Who is the  ! If plumbers designed toilets like
                    ! user,pray,  ! software professionals design tools,
                    ! and who is  ! we'd be up to our knees in crap.
                    ! the used ?  !                 - Charles A. Rovira
+----------------------------------------------------------------------+

joe@proto.com (Joe Huffman) (06/20/91)

<ACPS2924@Ryerson.Ca> writes:

>I'm using sco unix/386 and i'm trying to put the keyboard into something called
> raw mode. so i can read the keys in the dos fashion;

I did the port of the Zortech DOS compiler to SCO Unix.  The getch() and
getche() functions required that I do this.  A real pain -- it took me a
couple weeks to get it working almost right (London is still having problems
that I can't duplicate).

You will have to buy the source code from Zortech to see my implementation.
Look in sys.c for _bios_keybd() near the end of the file.
-- 
uunet!proto!joe
joe@proto.com

alberto@proa.es (Alberto Poblacion) (06/21/91)

In article <91169.102311ACPS2924@Ryerson.Ca> ACPS2924@Ryerson.Ca writes:
>I'm using sco unix/386 and i'm trying to put the keyboard into something called
> raw mode. so i can read the keys in the dos fashion;
> .....
> Im trying to read the decode the keyboard , reading all the Fxx ALTxx CTRLxx
>and PGUP .... keys correctly.
> .....


       There is a way to put the keyboard in raw mode, documented in the
Development System Library Guide, in the "Event Manager" chapter:

      #include <sys/vtkd.h>
      
      fd=open("/dev/console",O_RDWR);
      ioctl(fd,KDSKBMODE,arg);

      arg is either K_RAW to enter raw mode, or K_XLATE for normal mode.

      This is probably lower-level than what you require, because the
keyboard will send scan codes instead of ascii when in K_RAW mode.
      On way of interpreting the scan codes is making use of a table
similar to the ones in /usr/lib/keyboard. You will have to write a program
that interprets the table and loads it into an array. Then you pass the
scan codes through the array in order to get the desired key codes. You
will have to pass only the "make" scancodes, and filter out the "break"
ones.



-- 
Alberto Poblacion
E-mail: alberto@proa.es