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