/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Generic keyboard support: translation
*
* This module is project private. Please see PSARC/1998/176 and
* PSARC/1998/026 for references to the kbtrans module.
*
* It is believed that it is safe to call these functions within debugger mode
* except kbtrans_dprintf. Debugger mode is a single threaded mode where most
* kernel services are not available, including memory allocation. Debugger
* mode is for kmdb and OBP debugging, where the debugger calls back into the
* kernel to obtain console input.
*
* Please be _very_ careful about what external functions you call.
*/
#define KEYMAP_SIZE_VARIABLE
#include <sys/vuid_event.h>
#include "kbtrans_lower.h"
/*
* Internal Function Prototypes
*/
static void kbtrans_translate(struct kbtrans_lower *,
struct keyboard_callback *, kbtrans_key_t,
enum keystate);
/*
* kbtrans_processkey:
*
* lower - state information used by the calling driver
* this parameter is passed back to the callback routines.
* key - scancode
* state - KEY_PRESSED / KEY_RELEASED
*
* This routine checks to see if there is a raw callback, and calls it
* if it exists. If there is no raw callback, the key is translated.
* The raw callback allows the driver that called the translation module
* to be passed untranslated scancodes.
*/
void
struct keyboard_callback *cb,
{
/*
* If there is a raw routine, then call it and return.
*/
if (state == KEY_PRESSED) {
} else {
}
return;
}
/*
* translate the scancode into a key.
*/
}
/*
* kbtrans_translate:
*
* lower - state information used by the calling driver
* this parameter is passed back to the callback routines.
* key - scan code
* state - KEY_PRESSED / KEY_RELEASED
*
* Called to process key events if we are in TR_ASCII or TR_EVENT
* (sunview) mode. This routine will call the appropriate translation_callback
* for the character when it is done translating it.
*/
static void
struct keyboard_callback *cb,
{
unsigned shiftmask;
unsigned short *ke;
int i;
/*
* Nobody has told us about this keyboard yet.
*/
return;
}
/*
* Get the current state of the shiftmask
*/
/*
* If the key has been released, then or in the UPMASK flag.
*/
if (newstate == KEY_RELEASED)
/*
* Based on the shiftmask, lookup the keymap entry that we should
* be using for this scancode.
*/
/*
* This is a gross error. Cancel the repeat key and exit,
* we can not translate this scancode.
*/
return;
}
/*
* Get the key for this scancode.
*/
/*
* NONL appears only in the Num Lock table, and indicates that
* this key is not affected by Num Lock. This means we should
* ask for the table we would have gotten had Num Lock not been
* down, and translate using that table.
*/
key);
/*
* This is a gross error. Cancel the repeat key and
* exit, we can not translate this scancode.
*/
return;
}
/*
* Get the new key for this scancode.
*/
}
/*
* The entrytype indicates what category of key we are processing.
* Categories include shift keys, function keys, and numeric keypad
* keys.
*/
/*
* Handle the state of toggle shifts specially.
* Ups should be ignored, and downs should be mapped to ups if
* that shift is currently on.
*/
} else {
}
}
} else {
/*
* Handle Compose and floating accent key sequences
*/
switch (lower->kbtrans_state) {
case COMPOSE1:
if (newstate == KEY_RELEASED)
return;
if (entry < ASCII_SET_SIZE) {
return;
}
}
return;
case COMPOSE2:
if (newstate == KEY_RELEASED)
return;
/* next state is "normal" */
&result_iso);
if (good_compose) {
if (lower->kbtrans_compat)
result_iso += ISO_FIRST;
else
result_iso += EUC_FIRST;
}
return;
case FLTACCENT:
if (newstate == KEY_RELEASED)
return;
/* next state is "normal" */
for (i = 0;
!= lower->kbtrans_fltaccent_entry) ||
i++) {
== 0) {
/* Invalid second key: ignore key */
return;
}
}
return;
}
}
/*
* If the key is going down, and it's not one of the keys that doesn't
* auto-repeat, set up the auto-repeat timeout.
*
* The keys that don't auto-repeat are the Compose key,
* the shift keys, the "bucky bit" keys, the "floating accent" keys,
* and the function keys when in TR_EVENT mode.
*/
key);
}
/* key going up */
}
if (newstate == KEY_RELEASED) {
}
/*
* We assume here that keys other than shift keys and bucky keys have
* entries in the "up" table that cause nothing to be done, and thus we
* don't have to check for newstate == KEY_RELEASED.
*/
switch (entrytype) {
case 0x0: /* regular key */
break;
case SHIFTKEYS: {
/* Modify toggle state (see toggle processing above) */
if (newstate == KEY_RELEASED) {
} else if (shiftbit == NUMLOCKMASK) {
}
} else {
} else if (shiftbit == NUMLOCKMASK) {
}
}
}
if (newstate == KEY_RELEASED)
else
if (newstate == KEY_PRESSED) {
entry);
}
break;
}
case BUCKYBITS:
if (newstate == KEY_PRESSED) {
entry);
}
break;
case FUNNY:
switch (entry) {
case NOP:
break;
case IDLE:
/* Fall thru into RESET code */
/* FALLTHRU */
case RESET:
case ERROR:
entry);
break;
case COMPOSE:
break;
/*
* Remember when adding new entries that,
* if they should NOT auto-repeat,
* they should be put into the IF statement
* just above this switch block.
*/
default:
/* Ignore it */
break;
}
break;
case FA_CLASS:
}
break;
case STRING:
break;
case FUNCKEYS:
break;
/*
* Remember when adding new entries that,
* if they should NOT auto-repeat,
* they should be put into the IF statement
* just above this switch block.
*/
case PADKEYS:
break;
}
}
/*
* kbtrans_do_compose:
* Given a two key compose sequence, lookup the iso equivalent and put
* the result in the result_iso_ptr.
*/
static boolean_t
{
/*
* Validate the second keystroke.
*/
if (second_entry >= ASCII_SET_SIZE)
return (B_FALSE);
return (B_FALSE);
/*
* Get them in code order, rather than press order.
*/
if (first_entry > second_entry) {
tmp = first_entry;
second_entry = tmp;
}
return (B_TRUE);
}
ptr++;
}
return (B_FALSE);
}
/*
* kbtrans_find_entry:
* This routine finds the entry corresponding to the current shift
* state and keycode.
*/
unsigned short *
{
return (NULL);
return (NULL);
}
}
else if (mask & NUMLOCKMASK)
else if (mask & ALTGRAPHMASK)
return (&km[key_station]);
}
#ifdef DEBUG
/*ARGSUSED*/
void
{
}
#endif