xref: /titanic_41/usr/src/cmd/loadkeys/set_keyboard_layout (revision 02e56f3f1bfc8d9977bafb8cb5202f576dcded27)
1#! /usr/bin/sh
2#
3# CDDL HEADER START
4#
5# The contents of this file are subject to the terms of the
6# Common Development and Distribution License, Version 1.0 only
7# (the "License").  You may not use this file except in compliance
8# with the License.
9#
10# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11# or http://www.opensolaris.org/os/licensing.
12# See the License for the specific language governing permissions
13# and limitations under the License.
14#
15# When distributing Covered Code, include this CDDL HEADER in each
16# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17# If applicable, add the following below this CDDL HEADER, with the
18# fields enclosed by brackets "[]" replaced with your own identifying
19# information: Portions Copyright [yyyy] [name of copyright owner]
20#
21# CDDL HEADER END
22#
23#
24# ident	"%Z%%M%	%I%	%E% SMI"
25#
26# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
27# Use is subject to license terms.
28#
29
30KBD_TYPE=`/usr/bin/kbd -t`
31
32# (Really,  should pick this up from the keyboard device node keyboard-type
33# value, or the 1275 PC keyboard binding "layout" property.)
34KBD_LAYOUT_NAME="`/usr/sbin/eeprom kbd-type | /usr/bin/sed -n s/kbd-type=//p`"
35
36case "$KBD_TYPE" in
37"USB keyboard")
38	case "$KBD_LAYOUT_NAME" in
39	"")			LAYOUT= ;;
40	"Belgian" )             LAYOUT=2 ;;
41	"Czech" )		LAYOUT= ;;
42	"Danish" )		LAYOUT=6 ;;
43	"Dutch" )		LAYOUT=18 ;;
44	"Finnish" )             LAYOUT=7 ;;
45	"French" )		LAYOUT=8 ;;
46	"French-Canadian" ) 	LAYOUT= ;;
47	"German" )		LAYOUT=9 ;;
48	"Greek" )		LAYOUT= ;;
49	"Hungarian" )		LAYOUT= ;;
50	"Italian" )		LAYOUT=14 ;;
51	"Japanese(106)" ) 	LAYOUT=15 ;;
52	"Japanese(J3100)" ) 	LAYOUT= ;;
53	"Latvian" )		LAYOUT= ;;
54	"Lithuanian" )		LAYOUT= ;;
55	"Polish" )		LAYOUT= ;;
56	"Korean" )		LAYOUT=16 ;;
57	"Norwegian" )		LAYOUT=19 ;;
58	"Portuguese" )		LAYOUT=22 ;;
59        "Russian" )             LAYOUT=23 ;;
60	"Spanish" )		LAYOUT=25 ;;
61	"Swedish" )		LAYOUT=26 ;;
62	"Swiss-French" ) 	LAYOUT=27 ;;
63	"Swiss-German" ) 	LAYOUT=28 ;;
64	"Taiwanese" )		LAYOUT=30 ;;
65	"Turkish" )		LAYOUT= ;;
66	"UK-English" )		LAYOUT=32 ;;
67	"US-English" )		LAYOUT=33 ;;
68	"US-English(Microsoft-Natural)" ) LAYOUT=33 ;;
69	"US-English(104-Key)" ) LAYOUT=33 ;;
70	*)			LAYOUT= ;;
71	esac
72	;;
73"PC")
74	case "$KBD_LAYOUT_NAME" in
75	"")			LAYOUT= ;;
76	"Belgian" )             LAYOUT=2 ;;
77	"Czech" )		LAYOUT=53 ;;
78	"Danish" )		LAYOUT=36 ;;
79	"Dutch" )		LAYOUT=39 ;;
80	"Finnish" )             LAYOUT=7 ;;
81	"French" )		LAYOUT=35 ;;
82	"French-Canadian" ) 	LAYOUT=50 ;;
83	"German" )		LAYOUT=37 ;;
84	"Greek" )		LAYOUT=57 ;;
85	"Hungarian" )		LAYOUT=51 ;;
86	"Italian" )		LAYOUT=38 ;;
87	"Japanese(106)" ) 	LAYOUT=49 ;;
88	"Japanese(J3100)" ) 	LAYOUT=34 ;;
89	"Latvian" )		LAYOUT=55 ;;
90	"Lithuanian" )		LAYOUT=59 ;;
91	"Polish" )		LAYOUT=52 ;;
92	"Korean" )		LAYOUT=47 ;;
93	"Norwegian" )		LAYOUT=40 ;;
94	"Portuguese" )		LAYOUT=41 ;;
95	"Russian" )		LAYOUT=54 ;;
96	"Spanish" )		LAYOUT=42 ;;
97	"Swedish" )		LAYOUT=43 ;;
98	"Swiss-French" ) 	LAYOUT=44 ;;
99	"Swiss-German" ) 	LAYOUT=45 ;;
100	"Taiwanese" )		LAYOUT=48 ;;
101	"Turkish" )		LAYOUT=56 ;;
102	"UK-English" )		LAYOUT=46 ;;
103	"US-English" )		LAYOUT=1 ;;
104	"US-English(Microsoft-Natural)" ) LAYOUT=1001 ;;
105	"US-English(104-Key)" ) LAYOUT=1001 ;;
106	*)			LAYOUT=0 ;;
107	esac
108	;;
109esac
110
111
112if test -n "$LAYOUT"
113then
114	# Set the layout for a non-self-ID keyboard.
115	# loadkeys -s is a project private interface, and subject to change
116	# without notice.
117	/usr/bin/loadkeys -s $LAYOUT
118fi
119