* Set the keyboard into "direct" mode and turn on * event translation.
* Save the original keyclick volume.
int decKbdProc (device, what)    DeviceIntPtr  device;	/* Keyboard to manipulate */    int	    	  what;	    	/* What to do to it */#endif{    int i;    DevicePtr pKeyboard = (DevicePtr) device;    decKbdPrivPtr pPriv;    KeybdCtrl*	ctrl = &device->kbdfeed->ctrl;    extern int XkbDfltRepeatDelay, XkbDfltRepeatInterval;    static CARD8 *workingModMap = NULL;    static KeySymsRec *workingKeySyms;    switch (what) {    case DEVICE_INIT:	if (pKeyboard != LookupKeyboardDevice()) {	    ErrorF ("Cannot open non-system keyboard\n");	    return (!Success);	}	    	if (!workingKeySyms) {	    workingKeySyms = &decKeySyms[decKbdPriv.type];#if 0	    if (decKbdPriv.type == KB_SUN4 && decSwapLkeys)		SwapLKeys(workingKeySyms);#endif#if MIN_KEYCODE > 0	    if (workingKeySyms->minKeyCode < MIN_KEYCODE) {		workingKeySyms->minKeyCode += MIN_KEYCODE;		workingKeySyms->maxKeyCode += MIN_KEYCODE;	    }#endif	    if (workingKeySyms->maxKeyCode > MAX_KEYCODE ||		workingKeySyms->maxKeyCode < workingKeySyms->minKeyCode)		workingKeySyms->maxKeyCode = MAX_KEYCODE;	}	if (!workingModMap) {	    workingModMap=(CARD8 *)xalloc(MAP_LENGTH);	    (void) memset(workingModMap, 0, MAP_LENGTH);	    for(i=0; decModMaps[decKbdPriv.type][i].key != 0; i++)		workingModMap[decModMaps[decKbdPriv.type][i].key +			      MIN_KEYCODE] = 		decModMaps[decKbdPriv.type][i].modifiers;	}	(void) memset ((void *) defaultKeyboardControl.autoRepeats,			~0, sizeof defaultKeyboardControl.autoRepeats);#if 0 /* XXX */#ifdef XKB	if (noXkbExtension) {	    decAutoRepeatInitiate = XkbDfltRepeatDelay * 1000;	    decAutoRepeatDelay = XkbDfltRepeatInterval * 1000;#endif	autoRepeatKeyDown = 0;#ifdef XKB	}#endif#endif /* 0 XXX */	pKeyboard->devicePrivate = (pointer)&decKbdPriv;	pKeyboard->on = FALSE;	InitKeyboardDeviceStruct(pKeyboard, 				 workingKeySyms, workingModMap,				 decBell, decKbdCtrl);	break;    case DEVICE_ON:	pPriv = (decKbdPrivPtr)pKeyboard->devicePrivate;	/*	 * Set the keyboard into "direct" mode and turn on	 * event translation.	 */#if 0 /* XXX */	if (decChangeKbdTranslation(pPriv->fd,TRUE) == -1)	    FatalError("Can't set keyboard translation\n");#endif /* 0 XXX */	(void) AddEnabledDevice(pPriv->fd);	pKeyboard->on = TRUE;	break;    case DEVICE_CLOSE:    case DEVICE_OFF:	pPriv = (decKbdPrivPtr)pKeyboard->devicePrivate;#if 0 /* XXX */	if (pPriv->type == KB_SUN4) {	    /* dumb bug in Sun's keyboard! Turn off LEDS before resetting */	    pPriv->leds = 0;	    ctrl->leds = 0;	    SetLights(ctrl, pPriv->fd);	}#endif /* 0 XXX */	/*	 * Restore original keyboard directness and translation.	 */#if 0 /* XXX */	if (decChangeKbdTranslation(pPriv->fd,FALSE) == -1)	    FatalError("Can't reset keyboard translation\n");#endif /* 0 XXX */	RemoveEnabledDevice(pPriv->fd);	pKeyboard->on = FALSE;	break;    default:	FatalError("Unknown keyboard operation\n");    }    return Success;}