1: /* Copyright 1985, Massachusetts Institute of Technology */
   2: /* util.c		Various utilities
   3:  *
   4:  *	SoundBell	Generate audible bell
   5:  *	SetKeyClick	Control key click
   6:  *	SetAutoRepeat	Control auto repeat
   7:  *	SetLockLED	Control Lock LED
   8:  *	SetVideo	Disable/enable video
   9:  *	QueryShape	Determine shapes
  10:  *	ResolveColors	does nothing
  11:  *	StoreColors	does nothing
  12:  */
  13: 
  14: #include <sys/types.h>
  15: #include <vaxuba/qvioctl.h>
  16: 
  17: #include "ddxqvss.h"
  18: 
  19: extern int vsdev;
  20: 
  21: #define LK_REPEAT_ON 0xe3   /* enable autorepeat across kbd */
  22: #define LK_REPEAT_OFF 0xe1  /* diable autorepeat across kbd */
  23: #define LK_ENABLE_CLICK 0x1b    /* enable keyclick / set volume	*/
  24: #define LK_DISABLE_CLICK 0x99   /* disable keyclick entirely	*/
  25: #define LK_ENABLE_BELL 0x23 /* enable bell / set volume 	*/
  26: #ifndef LK_RING_BELL        /* can go away after 1.2 is out */
  27: #define LK_RING_BELL 0xa7   /* command to ring a bell 	*/
  28: #define LED_1 0x81      /* led 1 on the keyboard	*/
  29: #define LED_2 0x82      /* led 2 on the keyboard	*/
  30: #define LED_3 0x84      /* led 3 on the keyboard	*/
  31: #define LED_4 0x88      /* led 4 on the keyboard	*/
  32: #define LK_LED_ENABLE 0x13  /* turn on led			*/
  33: #define LK_LED_DISABLE 0x11 /* turn off led			*/
  34: #endif
  35: 
  36: /* Sound bell, volume between 0 (quiet) and 7 (loud) */
  37: 
  38: SoundBell (volume)
  39:     int volume;
  40: {
  41:     struct qv_kpcmd ioc;
  42:     volume = volume & 7;
  43:     volume = 7 - volume;
  44: 
  45:     ioc.nbytes = 1;
  46:     ioc.cmd = LK_ENABLE_BELL;
  47:     ioc.par[0] = volume;
  48:     ioctl(vsdev, QIOCKPCMD, &ioc);
  49: 
  50:     ioc.nbytes = 0;
  51:     ioc.cmd = LK_RING_BELL;
  52:     return(ioctl(vsdev, QIOCKPCMD, &ioc));
  53: }
  54: 
  55: /* Set key click, volume between -1 (default), 0 (off) and 8 (loud) */
  56: 
  57: SetKeyClick (volume)
  58:     int volume;
  59: {
  60:     struct qv_kpcmd ioc;
  61:     int ret;
  62:     if(volume < 0) volume = 6;
  63:     if(volume > 0 ) {
  64:         volume -= 1;
  65:         if(volume > 7) volume = 7;
  66:         volume = 7 - volume;
  67: 
  68:         ioc.nbytes = 1;
  69:         ioc.cmd = LK_ENABLE_CLICK;
  70:         ioc.par[0] = volume;
  71:         ret = ioctl(vsdev, QIOCKPCMD, &ioc);
  72:     }
  73:     else if(volume == 0) {
  74:         ioc.nbytes = 0;
  75:         ioc.cmd = LK_DISABLE_CLICK;
  76:         ret = ioctl(vsdev, QIOCKPCMD, &ioc);
  77:     }
  78:     return(ret);
  79: }
  80: 
  81: /* Set autorepeat */
  82: 
  83: SetAutoRepeat (onoff)
  84:     int onoff;
  85: {
  86:     struct qv_kpcmd ioc;
  87:     register char *divsets;
  88:     divsets = onoff ? (char *) AutoRepeatLKMode () : (char *) UpDownLKMode ();
  89:     ioc.nbytes = 0;
  90:     while (ioc.cmd = *divsets++)
  91:         ioctl(vsdev, QIOCKPCMD, &ioc);
  92:     ioc.cmd = ((onoff > 0) ? LK_REPEAT_ON : LK_REPEAT_OFF );
  93:     return(ioctl(vsdev, QIOCKPCMD, &ioc));
  94: }
  95: 
  96: int SetVideo(onoff)
  97:     int onoff;
  98: {
  99:     return(0);
 100: }
 101: QueryShape (shape, width, height)
 102:     int shape;
 103:     short *width, *height;
 104: {
 105:     switch (shape) {
 106:     case CursorShape:   /* braindamaged qvss cursor.... */
 107:         if (*width > 16)
 108:         *width = 16;
 109:         if (*height > 16)
 110:         *height = 16;
 111:         break;
 112:     case TileShape:
 113:         *width = *height = 16;
 114:         break;
 115:     }
 116: }
 117: 
 118: SetLockLED (onoff)
 119:     int onoff;
 120: {
 121:     struct qv_kpcmd ioc;
 122:     if (onoff)
 123:         ioc.cmd = LK_LED_ENABLE;
 124:     else
 125:         ioc.cmd = LK_LED_DISABLE;
 126:     ioc.par[0] = LED_3;
 127:     ioc.par[1]  = 0;
 128:     ioc.nbytes = 1;
 129:     ioctl(vsdev, QIOCKPCMD, &ioc);
 130:     return;
 131: }
 132: 
 133: ResolveColor (red, green, blue)
 134:     unsigned short *red, *green, *blue;
 135: {
 136: }
 137: 
 138: StoreColors (count, entries)
 139:     int count;
 140:     ColorDef *entries;
 141: 
 142: {
 143: }

Defined functions

QueryShape defined in line 101; never used
ResolveColor defined in line 133; never used
SetAutoRepeat defined in line 83; never used
SetKeyClick defined in line 57; never used
SetLockLED defined in line 118; never used
SetVideo defined in line 96; never used
SoundBell defined in line 38; never used
StoreColors defined in line 138; never used

Defined macros

LED_1 defined in line 28; never used
LED_2 defined in line 29; never used
LED_3 defined in line 30; used 1 times
LED_4 defined in line 31; never used
LK_DISABLE_CLICK defined in line 24; used 1 times
  • in line 75
LK_ENABLE_BELL defined in line 25; used 1 times
  • in line 46
LK_ENABLE_CLICK defined in line 23; used 1 times
  • in line 69
LK_LED_DISABLE defined in line 33; used 1 times
LK_LED_ENABLE defined in line 32; used 1 times
LK_REPEAT_OFF defined in line 22; used 1 times
  • in line 92
LK_REPEAT_ON defined in line 21; used 1 times
  • in line 92
LK_RING_BELL defined in line 27; used 2 times
Last modified: 1986-01-28
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1207
Valid CSS Valid XHTML 1.0 Strict