xref: /titanic_52/usr/src/cmd/loadkeys/set_keyboard_layout (revision d58fda4376e4bf67072ce2e69f6f47036f9dbb68)
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#pragma 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	"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