Technical article 126729

Can I make the OpenServer 6 Console NumLock key behave the way it did on OpenServer 5?

OpenServer 6.0.0

Written · Last revised

Problem

The behaviour of the Console NumLock is not the same on OpenServer 6.0.0 as on OpenServer 5.

On OpenServer 6 is it off by default and even if you switch it on, it will be switched off again the next time you log out of your console session.

Solution

One way to workaround this issue is to control the behaviour of the NumLock (and ScrollLock and CapsLock) key using the following sample source.

The following binary is available from:
ftp://ftpput.sco.com/tmp/lockkeys.tar.Z

Alternatively, you may wish to build this binary yourself and this detailed below.

Note you will need to have the OpenServer 6.0.0 development system installed on your OpenServer 6.0.0 system to build this source.

To use this program to set <NumLock> on on your current console screen, the command is:

lockkeys numlock on

To modify the <NUMLOCK> setting on any other console screen, simply use:

lockkeys numlock on < /dev/ttyXX

with XX ranging from 01 .. 12.

To set <NumLock> on when you login into the console simply add the command above to your $HOME/.profile.

You can also run the command with the "capslock" entry too.

---------------------<cut here>------------------------
/*
 * Program to control the console lock keys states
 *
 * Build with "cc -Kosr -o lockkeys lockkeys.c"
 */
#include <stdio.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/vtkd.h>
#define RDFD       0
#define CAPSLOCK   0x04
#define NUMLOCK    0x02
#define SCROLLLOCK 0x01

void main( argc, argv ) int argc; char *argv[]; { char c; int function, key;

if ( argc != 3 ) {
   fprintf( stderr, "Usage: lockkeys key on | off | toggle\n" );
   exit( 1 );
}

if ( !strcmp( argv[2], "off" )) function=0; else if ( !strcmp( argv[2], "on" )) function=1; else if ( !strcmp( argv[2], "toggle" )) function=2; else { fprintf( stderr, "lockkeys: function must be on, off, or toggle\n" ); exit( 1 ); }

if ( !strcmp( argv[1], "numlock" )) key=NUMLOCK; else if ( !strcmp( argv[1], "capslock" )) key=CAPSLOCK; else if ( !strcmp( argv[1], "scrolllock" )) key=SCROLLLOCK; else { fprintf( stderr, "lockkeys: key must be numlock, capslock, or scrolllock\n" ); exit( 1 ); }

        if ( ioctl( RDFD, KDGETLED, &c ) != 0 ) {
                perror( "lockkeys: can't get current lock state" );
                exit( 2 );
        }
        if ( function == 0 )
                c &= ~key;
        else if ( function == 1 )
                c |=  key;
        else
                c ^=  key;
        if ( ioctl( RDFD, KDSETLED, c ) != 0 ) {
                perror( "lockkeys: error setting lock state" );
                exit( 2 );
        }
        exit( 0 );
}
---------------------<cut here>------------------------

From the Xinuos technical article database, record 126729. Reproduced with permission. The original is at www.sco.com/ta/126729, which is reachable but blocked from search engines.

Next step

Need this fixed rather than explained?

Tell us the release, what the system runs and what it is doing. We will reply by email with what we would do next.

  • You deal with the people who do the work
  • No obligation, and no upgrade required before we will help
  • We tell you plainly if something is not worth doing

Send an enquiry

We reply by email. If a server is down, say so in the first line. You can also write to help@scoexpert.com.