xref: /illumos-gate/usr/src/cmd/loadkeys/set_keyboard_layout (revision 577f006c50d564d2f93145b2f2044a942d47f314)
17c478bd9Sstevel@tonic-gate#! /usr/bin/sh
27c478bd9Sstevel@tonic-gate#
37c478bd9Sstevel@tonic-gate# CDDL HEADER START
47c478bd9Sstevel@tonic-gate#
57c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
6*577f006cSdm89450# Common Development and Distribution License (the "License").
7*577f006cSdm89450# You may not use this file except in compliance with the License.
87c478bd9Sstevel@tonic-gate#
97c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate# and limitations under the License.
137c478bd9Sstevel@tonic-gate#
147c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate#
207c478bd9Sstevel@tonic-gate# CDDL HEADER END
217c478bd9Sstevel@tonic-gate#
22f95bda13Sdm89450#pragma ident	"%Z%%M%	%I%	%E% SMI"
237c478bd9Sstevel@tonic-gate#
2448784e40Sdm89450# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
2548784e40Sdm89450# Use is subject to license terms.
267c478bd9Sstevel@tonic-gate#
277c478bd9Sstevel@tonic-gate
287c478bd9Sstevel@tonic-gateKBD_TYPE=`/usr/bin/kbd -t`
297c478bd9Sstevel@tonic-gate
307c478bd9Sstevel@tonic-gate# (Really,  should pick this up from the keyboard device node keyboard-type
317c478bd9Sstevel@tonic-gate# value, or the 1275 PC keyboard binding "layout" property.)
327c478bd9Sstevel@tonic-gateKBD_LAYOUT_NAME="`/usr/sbin/eeprom kbd-type | /usr/bin/sed -n s/kbd-type=//p`"
337c478bd9Sstevel@tonic-gate
347c478bd9Sstevel@tonic-gatecase "$KBD_TYPE" in
357c478bd9Sstevel@tonic-gate"USB keyboard")
367c478bd9Sstevel@tonic-gate	case "$KBD_LAYOUT_NAME" in
377c478bd9Sstevel@tonic-gate	"")			LAYOUT= ;;
3848784e40Sdm89450	"Belgian" )             LAYOUT=2 ;;
397c478bd9Sstevel@tonic-gate	"Czech" )		LAYOUT= ;;
407c478bd9Sstevel@tonic-gate	"Danish" )		LAYOUT=6 ;;
417c478bd9Sstevel@tonic-gate	"Dutch" )		LAYOUT=18 ;;
4248784e40Sdm89450	"Finnish" )             LAYOUT=7 ;;
437c478bd9Sstevel@tonic-gate	"French" )		LAYOUT=8 ;;
447c478bd9Sstevel@tonic-gate	"French-Canadian" ) 	LAYOUT= ;;
457c478bd9Sstevel@tonic-gate	"German" )		LAYOUT=9 ;;
467c478bd9Sstevel@tonic-gate	"Greek" )		LAYOUT= ;;
477c478bd9Sstevel@tonic-gate	"Hungarian" )		LAYOUT= ;;
487c478bd9Sstevel@tonic-gate	"Italian" )		LAYOUT=14 ;;
497c478bd9Sstevel@tonic-gate	"Japanese(106)" ) 	LAYOUT=15 ;;
507c478bd9Sstevel@tonic-gate	"Japanese(J3100)" ) 	LAYOUT= ;;
517c478bd9Sstevel@tonic-gate	"Latvian" )		LAYOUT= ;;
527c478bd9Sstevel@tonic-gate	"Lithuanian" )		LAYOUT= ;;
537c478bd9Sstevel@tonic-gate	"Polish" )		LAYOUT= ;;
547c478bd9Sstevel@tonic-gate	"Korean" )		LAYOUT=16 ;;
557c478bd9Sstevel@tonic-gate	"Norwegian" )		LAYOUT=19 ;;
567c478bd9Sstevel@tonic-gate	"Portuguese" )		LAYOUT=22 ;;
5748784e40Sdm89450        "Russian" )             LAYOUT=23 ;;
587c478bd9Sstevel@tonic-gate	"Spanish" )		LAYOUT=25 ;;
597c478bd9Sstevel@tonic-gate	"Swedish" )		LAYOUT=26 ;;
607c478bd9Sstevel@tonic-gate	"Swiss-French" ) 	LAYOUT=27 ;;
617c478bd9Sstevel@tonic-gate	"Swiss-German" ) 	LAYOUT=28 ;;
627c478bd9Sstevel@tonic-gate	"Taiwanese" )		LAYOUT=30 ;;
637c478bd9Sstevel@tonic-gate	"Turkish" )		LAYOUT= ;;
64*577f006cSdm89450	"TurkishQ" )		LAYOUT=31 ;;
65*577f006cSdm89450	"TurkishF" )		LAYOUT=35 ;;
667c478bd9Sstevel@tonic-gate	"UK-English" )		LAYOUT=32 ;;
677c478bd9Sstevel@tonic-gate	"US-English" )		LAYOUT=33 ;;
687c478bd9Sstevel@tonic-gate	"US-English(Microsoft-Natural)" ) LAYOUT=33 ;;
697c478bd9Sstevel@tonic-gate	"US-English(104-Key)" ) LAYOUT=33 ;;
70f95bda13Sdm89450	"Slovenian" )		LAYOUT=256 ;;
71f95bda13Sdm89450	"Slovakian" )		LAYOUT=24 ;;
72f95bda13Sdm89450	"Serbia-And-Montenegro")	LAYOUT=257 ;;
73f95bda13Sdm89450	"Icelandic" )		LAYOUT=258 ;;
74f95bda13Sdm89450	"Croatian" )		LAYOUT=259 ;;
75f95bda13Sdm89450	"Bulgarian" )		LAYOUT=260 ;;
76f95bda13Sdm89450	"Belarusian" )		LAYOUT=261 ;;
77f95bda13Sdm89450	"Malta_US" )		LAYOUT=262 ;;
78f95bda13Sdm89450	"Malta_UK" )		LAYOUT=263 ;;
79f95bda13Sdm89450	"Albanian" )		LAYOUT=264 ;;
807c478bd9Sstevel@tonic-gate	*)			LAYOUT= ;;
817c478bd9Sstevel@tonic-gate	esac
827c478bd9Sstevel@tonic-gate	;;
837c478bd9Sstevel@tonic-gate"PC")
847c478bd9Sstevel@tonic-gate	case "$KBD_LAYOUT_NAME" in
857c478bd9Sstevel@tonic-gate	"")			LAYOUT= ;;
8648784e40Sdm89450	"Belgian" )             LAYOUT=2 ;;
877c478bd9Sstevel@tonic-gate	"Czech" )		LAYOUT=53 ;;
887c478bd9Sstevel@tonic-gate	"Danish" )		LAYOUT=36 ;;
897c478bd9Sstevel@tonic-gate	"Dutch" )		LAYOUT=39 ;;
9048784e40Sdm89450	"Finnish" )             LAYOUT=7 ;;
917c478bd9Sstevel@tonic-gate	"French" )		LAYOUT=35 ;;
927c478bd9Sstevel@tonic-gate	"French-Canadian" ) 	LAYOUT=50 ;;
937c478bd9Sstevel@tonic-gate	"German" )		LAYOUT=37 ;;
947c478bd9Sstevel@tonic-gate	"Greek" )		LAYOUT=57 ;;
957c478bd9Sstevel@tonic-gate	"Hungarian" )		LAYOUT=51 ;;
967c478bd9Sstevel@tonic-gate	"Italian" )		LAYOUT=38 ;;
977c478bd9Sstevel@tonic-gate	"Japanese(106)" ) 	LAYOUT=49 ;;
987c478bd9Sstevel@tonic-gate	"Japanese(J3100)" ) 	LAYOUT=34 ;;
997c478bd9Sstevel@tonic-gate	"Latvian" )		LAYOUT=55 ;;
1007c478bd9Sstevel@tonic-gate	"Lithuanian" )		LAYOUT=59 ;;
1017c478bd9Sstevel@tonic-gate	"Polish" )		LAYOUT=52 ;;
1027c478bd9Sstevel@tonic-gate	"Korean" )		LAYOUT=47 ;;
1037c478bd9Sstevel@tonic-gate	"Norwegian" )		LAYOUT=40 ;;
1047c478bd9Sstevel@tonic-gate	"Portuguese" )		LAYOUT=41 ;;
1057c478bd9Sstevel@tonic-gate	"Russian" )		LAYOUT=54 ;;
1067c478bd9Sstevel@tonic-gate	"Spanish" )		LAYOUT=42 ;;
1077c478bd9Sstevel@tonic-gate	"Swedish" )		LAYOUT=43 ;;
1087c478bd9Sstevel@tonic-gate	"Swiss-French" ) 	LAYOUT=44 ;;
1097c478bd9Sstevel@tonic-gate	"Swiss-German" ) 	LAYOUT=45 ;;
1107c478bd9Sstevel@tonic-gate	"Taiwanese" )		LAYOUT=48 ;;
1117c478bd9Sstevel@tonic-gate	"Turkish" )		LAYOUT=56 ;;
1127c478bd9Sstevel@tonic-gate	"UK-English" )		LAYOUT=46 ;;
1137c478bd9Sstevel@tonic-gate	"US-English" )		LAYOUT=1 ;;
1147c478bd9Sstevel@tonic-gate	"US-English(Microsoft-Natural)" ) LAYOUT=1001 ;;
1157c478bd9Sstevel@tonic-gate	"US-English(104-Key)" ) LAYOUT=1001 ;;
1167c478bd9Sstevel@tonic-gate	*)			LAYOUT=0 ;;
1177c478bd9Sstevel@tonic-gate	esac
1187c478bd9Sstevel@tonic-gate	;;
1197c478bd9Sstevel@tonic-gateesac
1207c478bd9Sstevel@tonic-gate
1217c478bd9Sstevel@tonic-gate
1227c478bd9Sstevel@tonic-gateif test -n "$LAYOUT"
1237c478bd9Sstevel@tonic-gatethen
1247c478bd9Sstevel@tonic-gate	# Set the layout for a non-self-ID keyboard.
1257c478bd9Sstevel@tonic-gate	# loadkeys -s is a project private interface, and subject to change
1267c478bd9Sstevel@tonic-gate	# without notice.
1277c478bd9Sstevel@tonic-gate	/usr/bin/loadkeys -s $LAYOUT
1287c478bd9Sstevel@tonic-gatefi
129