Package: console-setup
Version: 1.15
Severity: normal
Tags: patch

Sorry, it was pretty fiddly to split these out into multiple patches. I
think this is probably more intelligible as a unit anyway.

Brazilian keyboards need to use the abnt2 keyboard model
(https://launchpad.net/bugs/66774). It would be a lot simpler if
console-setup would change the model for you if you try to use pc105;
this also means that it's possible to configure a Brazilian keyboard
correctly at a debconf priority where the model question isn't displayed
(e.g. d-i outside expert mode).

Similarly, Japanese keyboards need to use the jp106 keyboard model
(https://launchpad.net/bugs/66719).

Japanese users apparently prefer jp(latin),jp over us,jp
(https://launchpad.net/bugs/63915). This requires special cases in
various places in console-setup similar to those already present for
Czech; I just extended them in the obvious ways.

Apparently keycode 133 should be mapped to AT scancode 124 for Japanese
keyboards, otherwise they can't use the backslash key
(https://launchpad.net/bugs/97466). Jun Kobayashi submitted a patch for
this. While I can't find an authoritative reference confirming it, it
doesn't seem unreasonable.

Thanks,

-- 
Colin Watson                                       [EMAIL PROTECTED]
diff -Nru /tmp/0sP5oNcslC/console-setup-1.13/Keyboard/ckbcomp /tmp/7b6qVlOkaE/console-setup-1.13ubuntu14/Keyboard/ckbcomp
--- /tmp/0sP5oNcslC/console-setup-1.13/Keyboard/ckbcomp	2006-10-24 19:12:48.000000000 +0100
+++ /tmp/7b6qVlOkaE/console-setup-1.13ubuntu14/Keyboard/ckbcomp	2007-04-04 15:58:22.000000000 +0100
@@ -2889,7 +2889,7 @@
     128 => -1,  # fake key
     129 => -1,  # Japanese
     131 => -1,  # Japanese
-    133 => -1,  # Japanese
+    133 => 124, # Japanese
     134 => 121, # Brasilian ABNT2
     144 => -1,  # Japanese
     156 => -1,  # fake key
diff -Nru /tmp/0sP5oNcslC/console-setup-1.13/Keyboard/kbdcompiler /tmp/7b6qVlOkaE/console-setup-1.13ubuntu14/Keyboard/kbdcompiler
--- /tmp/0sP5oNcslC/console-setup-1.13/Keyboard/kbdcompiler	2006-09-28 08:00:03.000000000 +0100
+++ /tmp/7b6qVlOkaE/console-setup-1.13ubuntu14/Keyboard/kbdcompiler	2007-03-17 00:16:58.000000000 +0000
@@ -25,7 +25,7 @@
 
 # Don't forget to update also the list in config.proto
 my $nonlatin = ' am ara ben bd bg bt by deva ge gh gr guj guru \
-                 il in ir iku jp kan kh la lao lk mk mm mn mv mal \
+                 il in ir iku kan kh la lao lk mk mm mn mv mal \
                  ori pk ru scc sy syr tel th tj tam ua uz ';
 
 my %keymaps;
@@ -67,11 +67,13 @@
     next if ($layout eq 'nec_vndr/jp');
     my $actual_layout = (($layout eq 'cs')
 			 ? 'cs,cs'
-			 : (($nonlatin =~ / $layout /)
-			    ? "us,$layout"
-			    : $layout));
+			 : (($layout eq 'jp')
+			    ? 'jp,jp'
+			    : (($nonlatin =~ / $layout /)
+			       ? "us,$layout"
+			       : $layout)));
     if (! -f "$dir/$model-$layout") {
-	if ($layout eq 'cs') {
+	if ($layout eq 'cs' or $layout eq 'jp') {
 	    execute ("./ckbcomp -compact -I. -I${xkbdir} -rules xorg"
 		     ." -model $model"
 		     ." -layout $actual_layout -variant latin,"
@@ -98,6 +100,8 @@
 	    } else {
 		$actual_variant = "latin,$variant";
 	    }
+	} elsif ($actual_layout eq 'jp,jp') {
+	    $actual_variant = "latin,$variant";
 	} elsif ($actual_layout =~ /,/) {
 	    $actual_variant = ",$variant";
 	} else {
diff -Nru /tmp/0sP5oNcslC/console-setup-1.13/debian/config.proto /tmp/7b6qVlOkaE/console-setup-1.13ubuntu14/debian/config.proto
--- /tmp/0sP5oNcslC/console-setup-1.13/debian/config.proto	2006-11-13 16:55:11.000000000 +0000
+++ /tmp/7b6qVlOkaE/console-setup-1.13ubuntu14/debian/config.proto	2007-04-13 08:42:16.000000000 +0100
@@ -1053,7 +1053,7 @@
 	gb) XKBLAYOUT="gb";;
 	is) XKBLAYOUT="is";;
 	it) XKBLAYOUT="it";;
-	jp106) XKBLAYOUT="jp"; XKBVARIANT="jp106";;
+	jp106) XKBLAYOUT="jp"; XKBVARIANT="jp106"; XKBMODEL="jp106";;
 	la) XKBLAYOUT="latam";;
 	lt) XKBLAYOUT="lt";; 
 	lv-latin4) XKBLAYOUT="lv";;
@@ -1099,6 +1099,9 @@
 	    layout_priority=high
 	    ;;
 	*)
+	    if [ "$XKBMODEL" ]; then
+		default_model="$XKBMODEL"
+	    fi
 	    default_layout="$XKBLAYOUT"
 	    default_variant="$XKBVARIANT"
 	    layout_priority=medium
@@ -1120,7 +1167,7 @@
 
     case "$XKBLAYOUT" in
 	# TODO: make s.t. to not forget to update this list
-	cs,cs|us,am|us,ara|us,ben|us,bd|us,bg|us,bt|us,by|us,deva|us,ge|us,gh|us,gr|us,guj|us,guru|us,il|us,in|us,ir|us,iku|us,jp|us,kan|us,kh|us,la|us,lao|us,lk|us,mk|us,mm|us,mn|us,mv|us,mal|us,ori|us,pk|us,ru|us,scc|us,sy|us,syr|us,tel|us,th|us,tj|us,tam|us,ua|us,uz)
+	cs,cs|us,am|us,ara|us,ben|us,bd|us,bg|us,bt|us,by|us,deva|us,ge|us,gh|us,gr|us,guj|us,guru|us,il|us,in|us,ir|us,iku|jp,jp|us,jp|us,kan|us,kh|us,la|us,lao|us,lk|us,mk|us,mm|us,mn|us,mv|us,mal|us,ori|us,pk|us,ru|us,scc|us,sy|us,syr|us,tel|us,th|us,tj|us,tam|us,ua|us,uz)
 	    default_layout=${XKBLAYOUT#*,}
 	    default_variant="${XKBVARIANT#*,}"
 	    unsupported_layout=no
@@ -1267,9 +1267,28 @@
 	    else
 		STATE=$(($STATE - 1))
 	    fi
+	    # Adjust the keyboard model for some layouts requiring extra keys.
+	    case $model in
+		pc105|abnt2|jp106)
+		    case $layout in
+			br)
+			    model=abnt2
+			    db_set console-setup/modelcode "$model"
+			    ;;
+			jp)
+			    model=jp106
+			    db_set console-setup/modelcode "$model"
+			    ;;
+			*)
+			    model=pc105
+			    db_set console-setup/modelcode "$model"
+			    ;;
+		    esac
+		    ;;
+	    esac
 	    ;;
 	3)
 	    if [ "$unsupported_layout" = yes ]; then
@@ -1291,9 +1310,21 @@
 				;;
 			esac
 			;;
+		    jp)
+			case "$variant" in
+			    latin)
+				latin=yes
+				real_layout=$layout
+				;;
+			    *)
+				latin=no
+				real_layout=jp,jp
+				;;
+			esac
+			;;
 		    # TODO: make s.t. to not forget to update this list
 		    # Don't forget to update also the list in kbdcompiler
-		    am|ara|ben|bd|bg|bt|by|deva|ge|gh|gr|guj|guru|il|in|ir|iku|jp|kan|kh|la|lao|lk|mk|mm|mn|mv|mal|ori|pk|ru|scc|sy|syr|tel|th|tj|tam|ua|uz)
+		    am|ara|ben|bd|bg|bt|by|deva|ge|gh|gr|guj|guru|il|in|ir|iku|kan|kh|la|lao|lk|mk|mm|mn|mv|mal|ori|pk|ru|scc|sy|syr|tel|th|tj|tam|ua|uz)
 			latin=no
 			real_layout=us,$layout
 			;;
@@ -1320,6 +1351,8 @@
 				"latin,$variant"
 			    ;;
 		    esac
+		elif [ "$real_layout" = jp,jp ]; then
+		    db_set console-setup/variantcode "latin,$variant"
 		else
 		    db_set console-setup/variantcode ",$variant"
 		fi

Reply via email to