set_keyboard_layout revision 7c478bd95313f5f23a4c958a745db2134aa03244
#! /usr/bin/sh
#
# 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
# or http://www.opensolaris.org/os/licensing.
# 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
#
#
# ident "%Z%%M% %I% %E% SMI"
#
# Copyright (c) 2001 by Sun Microsystems, Inc.
# All rights reserved.
#
KBD_TYPE=`/usr/bin/kbd -t`
# (Really, should pick this up from the keyboard device node keyboard-type
# value, or the 1275 PC keyboard binding "layout" property.)
KBD_LAYOUT_NAME="`/usr/sbin/eeprom kbd-type | /usr/bin/sed -n s/kbd-type=//p`"
case "$KBD_TYPE" in
"USB keyboard")
case "$KBD_LAYOUT_NAME" in
"") LAYOUT= ;;
"Czech" ) LAYOUT= ;;
"Danish" ) LAYOUT=6 ;;
"Dutch" ) LAYOUT=18 ;;
"French" ) LAYOUT=8 ;;
"French-Canadian" ) LAYOUT= ;;
"German" ) LAYOUT=9 ;;
"Greek" ) LAYOUT= ;;
"Hungarian" ) LAYOUT= ;;
"Italian" ) LAYOUT=14 ;;
"Japanese(106)" ) LAYOUT=15 ;;
"Japanese(J3100)" ) LAYOUT= ;;
"Latvian" ) LAYOUT= ;;
"Lithuanian" ) LAYOUT= ;;
"Polish" ) LAYOUT= ;;
"Korean" ) LAYOUT=16 ;;
"Norwegian" ) LAYOUT=19 ;;
"Portuguese" ) LAYOUT=22 ;;
"Russian" ) LAYOUT= ;;
"Spanish" ) LAYOUT=25 ;;
"Swedish" ) LAYOUT=26 ;;
"Swiss-French" ) LAYOUT=27 ;;
"Swiss-German" ) LAYOUT=28 ;;
"Taiwanese" ) LAYOUT=30 ;;
"Turkish" ) LAYOUT= ;;
"UK-English" ) LAYOUT=32 ;;
"US-English" ) LAYOUT=33 ;;
"US-English(Microsoft-Natural)" ) LAYOUT=33 ;;
"US-English(104-Key)" ) LAYOUT=33 ;;
*) LAYOUT= ;;
esac
;;
"PC")
case "$KBD_LAYOUT_NAME" in
"") LAYOUT= ;;
"Czech" ) LAYOUT=53 ;;
"Danish" ) LAYOUT=36 ;;
"Dutch" ) LAYOUT=39 ;;
"French" ) LAYOUT=35 ;;
"French-Canadian" ) LAYOUT=50 ;;
"German" ) LAYOUT=37 ;;
"Greek" ) LAYOUT=57 ;;
"Hungarian" ) LAYOUT=51 ;;
"Italian" ) LAYOUT=38 ;;
"Japanese(106)" ) LAYOUT=49 ;;
"Japanese(J3100)" ) LAYOUT=34 ;;
"Latvian" ) LAYOUT=55 ;;
"Lithuanian" ) LAYOUT=59 ;;
"Polish" ) LAYOUT=52 ;;
"Korean" ) LAYOUT=47 ;;
"Norwegian" ) LAYOUT=40 ;;
"Portuguese" ) LAYOUT=41 ;;
"Russian" ) LAYOUT=54 ;;
"Spanish" ) LAYOUT=42 ;;
"Swedish" ) LAYOUT=43 ;;
"Swiss-French" ) LAYOUT=44 ;;
"Swiss-German" ) LAYOUT=45 ;;
"Taiwanese" ) LAYOUT=48 ;;
"Turkish" ) LAYOUT=56 ;;
"UK-English" ) LAYOUT=46 ;;
"US-English" ) LAYOUT=1 ;;
"US-English(Microsoft-Natural)" ) LAYOUT=1001 ;;
"US-English(104-Key)" ) LAYOUT=1001 ;;
*) LAYOUT=0 ;;
esac
;;
esac
if test -n "$LAYOUT"
then
# Set the layout for a non-self-ID keyboard.
# loadkeys -s is a project private interface, and subject to change
# without notice.
/usr/bin/loadkeys -s $LAYOUT
fi