xref: /illumos-gate/usr/src/cmd/loadkeys/set_keyboard_layout (revision 48784e40877057cd7d3ffdeabfb3a76bf5d980fc)
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
67c478bd9Sstevel@tonic-gate# Common Development and Distribution License, Version 1.0 only
77c478bd9Sstevel@tonic-gate# (the "License").  You may not use this file except in compliance
87c478bd9Sstevel@tonic-gate# with the License.
97c478bd9Sstevel@tonic-gate#
107c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
117c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
127c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
137c478bd9Sstevel@tonic-gate# and limitations under the License.
147c478bd9Sstevel@tonic-gate#
157c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
167c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
177c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
187c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
197c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
207c478bd9Sstevel@tonic-gate#
217c478bd9Sstevel@tonic-gate# CDDL HEADER END
227c478bd9Sstevel@tonic-gate#
237c478bd9Sstevel@tonic-gate#
247c478bd9Sstevel@tonic-gate# ident	"%Z%%M%	%I%	%E% SMI"
257c478bd9Sstevel@tonic-gate#
26*48784e40Sdm89450# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
27*48784e40Sdm89450# Use is subject to license terms.
287c478bd9Sstevel@tonic-gate#
297c478bd9Sstevel@tonic-gate
307c478bd9Sstevel@tonic-gateKBD_TYPE=`/usr/bin/kbd -t`
317c478bd9Sstevel@tonic-gate
327c478bd9Sstevel@tonic-gate# (Really,  should pick this up from the keyboard device node keyboard-type
337c478bd9Sstevel@tonic-gate# value, or the 1275 PC keyboard binding "layout" property.)
347c478bd9Sstevel@tonic-gateKBD_LAYOUT_NAME="`/usr/sbin/eeprom kbd-type | /usr/bin/sed -n s/kbd-type=//p`"
357c478bd9Sstevel@tonic-gate
367c478bd9Sstevel@tonic-gatecase "$KBD_TYPE" in
377c478bd9Sstevel@tonic-gate"USB keyboard")
387c478bd9Sstevel@tonic-gate	case "$KBD_LAYOUT_NAME" in
397c478bd9Sstevel@tonic-gate	"")			LAYOUT= ;;
40*48784e40Sdm89450	"Belgian" )             LAYOUT=2 ;;
417c478bd9Sstevel@tonic-gate	"Czech" )		LAYOUT= ;;
427c478bd9Sstevel@tonic-gate	"Danish" )		LAYOUT=6 ;;
437c478bd9Sstevel@tonic-gate	"Dutch" )		LAYOUT=18 ;;
44*48784e40Sdm89450	"Finnish" )             LAYOUT=7 ;;
457c478bd9Sstevel@tonic-gate	"French" )		LAYOUT=8 ;;
467c478bd9Sstevel@tonic-gate	"French-Canadian" ) 	LAYOUT= ;;
477c478bd9Sstevel@tonic-gate	"German" )		LAYOUT=9 ;;
487c478bd9Sstevel@tonic-gate	"Greek" )		LAYOUT= ;;
497c478bd9Sstevel@tonic-gate	"Hungarian" )		LAYOUT= ;;
507c478bd9Sstevel@tonic-gate	"Italian" )		LAYOUT=14 ;;
517c478bd9Sstevel@tonic-gate	"Japanese(106)" ) 	LAYOUT=15 ;;
527c478bd9Sstevel@tonic-gate	"Japanese(J3100)" ) 	LAYOUT= ;;
537c478bd9Sstevel@tonic-gate	"Latvian" )		LAYOUT= ;;
547c478bd9Sstevel@tonic-gate	"Lithuanian" )		LAYOUT= ;;
557c478bd9Sstevel@tonic-gate	"Polish" )		LAYOUT= ;;
567c478bd9Sstevel@tonic-gate	"Korean" )		LAYOUT=16 ;;
577c478bd9Sstevel@tonic-gate	"Norwegian" )		LAYOUT=19 ;;
587c478bd9Sstevel@tonic-gate	"Portuguese" )		LAYOUT=22 ;;
59*48784e40Sdm89450        "Russian" )             LAYOUT=23 ;;
607c478bd9Sstevel@tonic-gate	"Spanish" )		LAYOUT=25 ;;
617c478bd9Sstevel@tonic-gate	"Swedish" )		LAYOUT=26 ;;
627c478bd9Sstevel@tonic-gate	"Swiss-French" ) 	LAYOUT=27 ;;
637c478bd9Sstevel@tonic-gate	"Swiss-German" ) 	LAYOUT=28 ;;
647c478bd9Sstevel@tonic-gate	"Taiwanese" )		LAYOUT=30 ;;
657c478bd9Sstevel@tonic-gate	"Turkish" )		LAYOUT= ;;
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 ;;
707c478bd9Sstevel@tonic-gate	*)			LAYOUT= ;;
717c478bd9Sstevel@tonic-gate	esac
727c478bd9Sstevel@tonic-gate	;;
737c478bd9Sstevel@tonic-gate"PC")
747c478bd9Sstevel@tonic-gate	case "$KBD_LAYOUT_NAME" in
757c478bd9Sstevel@tonic-gate	"")			LAYOUT= ;;
76*48784e40Sdm89450	"Belgian" )             LAYOUT=2 ;;
777c478bd9Sstevel@tonic-gate	"Czech" )		LAYOUT=53 ;;
787c478bd9Sstevel@tonic-gate	"Danish" )		LAYOUT=36 ;;
797c478bd9Sstevel@tonic-gate	"Dutch" )		LAYOUT=39 ;;
80*48784e40Sdm89450	"Finnish" )             LAYOUT=7 ;;
817c478bd9Sstevel@tonic-gate	"French" )		LAYOUT=35 ;;
827c478bd9Sstevel@tonic-gate	"French-Canadian" ) 	LAYOUT=50 ;;
837c478bd9Sstevel@tonic-gate	"German" )		LAYOUT=37 ;;
847c478bd9Sstevel@tonic-gate	"Greek" )		LAYOUT=57 ;;
857c478bd9Sstevel@tonic-gate	"Hungarian" )		LAYOUT=51 ;;
867c478bd9Sstevel@tonic-gate	"Italian" )		LAYOUT=38 ;;
877c478bd9Sstevel@tonic-gate	"Japanese(106)" ) 	LAYOUT=49 ;;
887c478bd9Sstevel@tonic-gate	"Japanese(J3100)" ) 	LAYOUT=34 ;;
897c478bd9Sstevel@tonic-gate	"Latvian" )		LAYOUT=55 ;;
907c478bd9Sstevel@tonic-gate	"Lithuanian" )		LAYOUT=59 ;;
917c478bd9Sstevel@tonic-gate	"Polish" )		LAYOUT=52 ;;
927c478bd9Sstevel@tonic-gate	"Korean" )		LAYOUT=47 ;;
937c478bd9Sstevel@tonic-gate	"Norwegian" )		LAYOUT=40 ;;
947c478bd9Sstevel@tonic-gate	"Portuguese" )		LAYOUT=41 ;;
957c478bd9Sstevel@tonic-gate	"Russian" )		LAYOUT=54 ;;
967c478bd9Sstevel@tonic-gate	"Spanish" )		LAYOUT=42 ;;
977c478bd9Sstevel@tonic-gate	"Swedish" )		LAYOUT=43 ;;
987c478bd9Sstevel@tonic-gate	"Swiss-French" ) 	LAYOUT=44 ;;
997c478bd9Sstevel@tonic-gate	"Swiss-German" ) 	LAYOUT=45 ;;
1007c478bd9Sstevel@tonic-gate	"Taiwanese" )		LAYOUT=48 ;;
1017c478bd9Sstevel@tonic-gate	"Turkish" )		LAYOUT=56 ;;
1027c478bd9Sstevel@tonic-gate	"UK-English" )		LAYOUT=46 ;;
1037c478bd9Sstevel@tonic-gate	"US-English" )		LAYOUT=1 ;;
1047c478bd9Sstevel@tonic-gate	"US-English(Microsoft-Natural)" ) LAYOUT=1001 ;;
1057c478bd9Sstevel@tonic-gate	"US-English(104-Key)" ) LAYOUT=1001 ;;
1067c478bd9Sstevel@tonic-gate	*)			LAYOUT=0 ;;
1077c478bd9Sstevel@tonic-gate	esac
1087c478bd9Sstevel@tonic-gate	;;
1097c478bd9Sstevel@tonic-gateesac
1107c478bd9Sstevel@tonic-gate
1117c478bd9Sstevel@tonic-gate
1127c478bd9Sstevel@tonic-gateif test -n "$LAYOUT"
1137c478bd9Sstevel@tonic-gatethen
1147c478bd9Sstevel@tonic-gate	# Set the layout for a non-self-ID keyboard.
1157c478bd9Sstevel@tonic-gate	# loadkeys -s is a project private interface, and subject to change
1167c478bd9Sstevel@tonic-gate	# without notice.
1177c478bd9Sstevel@tonic-gate	/usr/bin/loadkeys -s $LAYOUT
1187c478bd9Sstevel@tonic-gatefi
119