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