Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!wuarchive!udel!mmdf From: badger@sn411.sintef.no (Kristin Utheim) Newsgroups: comp.os.minix Subject: (none) Message-ID: <55996@nigel.ee.udel.edu> Date: 11 Jun 91 16:55:14 GMT Sender: mmdf@ee.udel.edu Lines: 848 To: info-minix@udel.edu Subject: International keyboards for PC MINIX CONFIGUREABLE INTERNATIONAL KEYBOARD SUPPORT FOR MINIX. ------------------------------------------------------- Minix Version: 1.5.10 (Prentice Hall 1.5) for PC. Format: uuencoded tar file. Extracting the tar file from / puts diffs in the appropriate directories (see below). Affected Files: /usr/include/minix/boot.h - Changed default scancode. /usr/src/kernel/keyboard.c - Keyboard routine changes. /usr/src/kernel/Makefile - Added boot.h dependency for keyboard.c. /usr/src/tools/menu.c - New boot options for keyboard. /usr/src/tools/Makefile - Added boot.h dependency for menu.c. New Files: /usr/include/minix/keymap.h - Where the maps are. What's It All About? -------------------- Having bought Minix and installed it on my home PC I had a problem. I live in Norway, therefore my keyboard is Norwegian. The nearest I could get was the Dutch support, but that was far from perfect. So I looked at keyboard.c and thought to myself - 'Shouldn't be too difficult to replace one of these keymaps'. Which is what I did. Fair enough I thought, but why hard-wire the keyboard maps in this way? What if I was German or Canadian? So I thought out a more configureable system. What Have We Got? ----------------- We've got a system where, once the new versions of keyboard.c, menu.c and boot.h are installed, the keyboard translations can be modified through one header file - keymap.h. A quick re-compile and you've got a Danish keyboard or a deliberately scrambled keymap for those who think its funny. How Did I Do It? ---------------- Look at the diff's. But seriously, keymap.h defines an array of keyboard names when included by menu.c and an array of keyboard maps when included by keyboard.c. I know that's a bit kludgy but it saves compiling the keymaps into menu and it keeps the relationship between the keymaps and their names in one file. When menu runs (during booting) a new option 'k' allows you to choose your keyboard from the list of names. This yields a small sequential integer which is passed back in boot_params and in bx in place of the old scancode. (I didn't look deeply enough into the code to work out why this is passed around in bx - maybe that could be tidied up). When init_keyboard (in keyboard.c) looks at boot_params it finds the value placed in the 'scan code' field. If this is 0 then nothing is done, otherwise the appropriate keymaps are overlaid upon the default maps. The system is now up and running with the user's choice of keymaps. But a problem remains - many national keyboards need the alt key. In the standard Minix keyboard.c a distinction is made between keyboards that use alt (i.e. Dutch) and those that don't. For those that don't, alt causes 0200 to be OR'ed with the normal keyboard character. For those that do, a separate keymap is looked up. This gave a problem, as most of the entries in the Dutch alt keymap were 0. This meant that alt-a for example returned 0 (or NULL, causing you to be logged out). Annoying to say the least. My system tests the alt keymap for all keyboard choices. If the entry is non-zero it is used. If it is zero then 0200 is OR'ed with the non-alt keymap entry. This restores AST's default alt action, whilst allowing national keyboards to use the alt key in the way they expect. But Is It Configurable? ----------------------- Decide for yourself. Its a lot better than having everything hard-wired in keyboard.c and menu.c. keymap.h contains four sample sets of keymaps to get you started. Added Bonuses? -------------- This system actually lets you save a smidgin of kernel memory. The 1.5.10 release holds four keymaps permanently in memory. In my version, I know that I will only use the Norwegian set-up. Therefore the kernel only holds two keymaps in memory (I chose to make option 0 - U.S. standard keyboard a permanent option but this could be changed as well). Have We Lost Anything? ---------------------- I suppose there had to be something. AST's special hacks for getting the Dutch numeric keypad right are gone. This only affects the slash key (I think) and all the actual number keys work fine. My system is too generic (ha, ha) to support such hardware dependencies). Anybody want to work out an keyboard independent way of trapping individual keys that don't play by the rules? What Next? ---------- I hope someone can use my ideas. It works for me. I can now use my Norwegian PC to run Minix, and know that it is easily configurable. % whoami badger@cray.sintef.no % finger -l badger In Real Life: Andy Walker. Job: Database Hack. Where: Kvaerner Engineering a.s. Lysaker, Norway. Interests: UN*X, Minix, X, Comms, Gnu (all the things a good hack is supposed to like). Thought for the day: "Life is swell in a padded cell, You can wash you blues away. You can trade your gloom for a rubber room, And injections twice a day" The Joker - From 'Batman: The Killing Joke' ----------------------------------------------------------------------------- WARNING: At least two PC's running Messy-DOS are used to get this too you - I don't have interactive access to the Cray so I mail by batch from a PC. This means that the dreaded ^M's may have got into these files. Try vi, you can always see them there at the end of every line. If they show up then you need to do the following: cat infile | sed -e 's/^M$//' > outfile That has to be a literal ctrl-M so quote it in whichever way your shell likes best (or use octal, or put the commands in a file). Hopefully you won't need this anyway. table !"#$%&'()*+,-./0123456789:;<=>? @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_ begin 644 keyboard.tar M=7-R+P z M y M # P,#0 !Ui M2!M86YA9V5R+"!F:6QE( HM+2T@,S4L-#$@+2TM+0H@( E 96-H;R Bv M4W1A7!E+F@B"B @"BL@(V1E9FEN90E)3E]-14Y5u M"0D)+RH@1V5T('1H92!N86UE2!O;B!F:7)S="!P87-S('1HB \(#D@?'P@8WEL2!O;B!F:7)S="!P87-S('1Hv MB \(#D@?'P@8WEL5]M87!S6V-N="TQ72D[t M"BL@("!PPHK( EC:'(@/2!G971C*"D["BL@"6EF("AC:'(@/3T@)S G*7L**R )r M"7!U=&,H8VAR*3L**R )"6=E=&YE=VQI;F4H*3L**R )"6ME>6)N86UE(#T@q M=7-K97EB;F%M93L**R )"7)E='5R;B@P*3L**R )"7T**R )96QS92!I9B Hp M8VAR(#X@)S G("8F(&-H6)N86UE(#T@:V5Y7VUAn M<'-;8VAR("T@)S$G73L**R )"7)E='5R;BAC:'(@+2 G,2<@*R Q*3L**R )m M"7T**R )?0HK('T**R *("!G971?<&%R=&ET:6]N*"D*("!["B @+RH@07-Kl M(&9O0 c M !U6)O87)D+F1I9F8 w M v M P,# V-C8@ # P,#$T-2 ,# P,30Tu M( P,# P,# S,30U-2 P-3 R,C6)O87)D+F,Nl M;W)I9PE4=64@2G5N(" T(#$Y.C,T.C(W(#$Y.3$*+2TM(&ME>6)O87)D+F,)k M5'5E($IU;B @-" Q.3HS,#HP,R Q.3DQ"BHJ*BHJ*BHJ*BHJ*BHJ*@HJ*BH@j M-2PQ," J*BHJ"BTM+2 U+#$Q("TM+2T*(" C:6YC;'5D92 \"]C;VTN:#X**R C:6YC;'5D92 \;6EN:7@O:V5Y;6%P+F@^"B @(VEN8VQUg M9&4@(G1T>2YH(@H@( H@("\J(%-T86YD87)D(&%N9"!!5"!K97EB;V%R9"X@f M("A04R\R($U#02!I;7!L:65S($%4('1H2!C87!T=7)E9"!B>2!M87!Sc M+B J+PH@("-D969I;F4@1$5,7U-#04X)(" X,PDO*B!$14P@9F]R('5S92!Ib M;B!#5%),+4%,5"U$14P@6)Dt M("HO"B$@(V1E9FEN92!.54U?4TQ!4TA?1%4),'@U-PDO*B!N=6UE7!A9"!S;&%S:"!O;B!$=71C:"!E>'1E;F1E9"!K8B J+PHA("-D969I;F4@r M3TQ)5D545$E?4T-!3@D@(#$R"2\J("<])R!K97D@;VX@;VQI=F5T=&D@*B\*q M(2 C9&5F:6YE(%-#3T1%,0D)(" W,0DO*B!(;VUE(&]N(&YU;65R:6,@<&%Dp M("HO"B$@(V1E9FEN92!30T]$13()"2 @.#$)+RH@4&=$;B!O;B!N=6UE6)O87)D('1Y<&5S+B J+PHA("-D969I;F4@24)-7U!#"0D@(" Qi M"2\J(%-T86YD87)D($E"32!K97EB;V%R9" J+PHA("-D969I;F4@3TQ)5D54h M5$D)(" @,@DO*B!/;&EV971T:2!K97EB;V%R9" J+PHA("-D969I;F4@1%54g M0TA?15A4"2 @(#,)+RH@1'5T8V@@97AT96YD960@24)-(&ME>6)O87)D("HOf M"B$@(V1E9FEN92!54U]%6%0)"2 @(#0)+RH@52Y3+B!E>'1E;F1E9"!K97EBe M;V%R9" J+PH@( H@("\J($UI7!E(&]F(&ME>6)O87)Dn M(&%T=&%C:&5D("HO"B$@4%))5D%412!I;G0@;6EN=7-?8V]D93L)"2\J(&YUm M;65R:6,@;6EN=7,@;VX@9'5T8V@@97AT96YD960@:V5Y8F]A6)Oh M87)D("HO"B @4%))5D%412!I;G0@6)O87)D*2 J+PHM(%!2d M259!5$4@8VAAPHM+2T@-3@L-S @+2TM+0H@( H@(%!2259!5$4@:6YT(&%L=#L)z M"2\J(&%L="!K97D@2!S=&%T92 J+PH@(%!2259!r M5$4@:6YT('-H:69T,CL)"2\J(')I9VAT('-H:69T(&ME>2!S=&%T92 J+PH@q M( H@( H@("\J(%-C86X@8V]D97,@=&\@05-#24D@9F]R('5NBR2"PHM(" P+# L,"PR-3,L,"PQ-S(L,3%M.4E]30T%.7T-/1$5372 ]('L*+2 @,"PG8"'1E;F1E9"!K8F0@*B\*+2!0v M4DE6051%(&-H87(@PHM(" P+# Su M,RPG(2)RP@(" @(" @("#,U+B J+PHM( D):68@*&-O9&4@/3T@;6EN=7-?8V]D92D@8V]Di M92 ](&YU;5]S;&%S:#L*+2 )"65S8R ]($9!3%-%.PHM( E](&5L2!R96QE87-E("HOf M"B @("!I9B H:R ^(# I('L*(" )+RH@02!K97D@:&%S(&)E96X@2!R96QE87-E9" J+PH@( HA(" @:68@*&%L=" F)B!K97EB7W1Y<&4@z M/3T@1%540TA?15A4*0HA( EC;V1E(#T@86QT7V-;8UT["B$@("!E;'-E"B$@y M"6-O9&4@/2 H2!R96QE87-E("HO"B @("!M86ME(#T@*&-H("8@,#(P," _(# @.B Qt M*3L)+RH@,2!W:&5N(&ME>2!D97!R97-S960L(# @=VAE;B!K97D@6)?='EP92 A/2!$551#2%]%6%0I(&-O9&4@?#T@,#(P,#L@("\J(&%L="!/j M4G,@:6X@,#(P," J+PH@( EI9B H8V]N=')O;"D@8V]D92 F/2 P,S<["B @i M"6EF("AM86ME(#T](# I(&-O9&4@/2 M,3L)+RH@:V5Y(')E;&5A7!E(&%N("<])RX@(%1H92!S8V%N(&-O9&5S(&9O6)O87)D(&ENx M('5S92X*(" @(" J+PHA(" @PHA( EC87-Ew M(%-404Y$05)$7U-#04XZ"6ME>6)?='EP92 ]($E"35]00SL@8G)E86L["B$@v M"6-A7!E(#T@3TQ)5D545$D[(&QOu M861?;VQI=F5T=&DH*3L@8G)E86L["B$@"6-A6)?='EP92 ]($155$-(7T585#L*(2 )"0D);&]A9%]D=71C:%]T86)Ls M92@I.R!B7!E(#T@r M55-?15A4.PHA( D)"0EL;V%D7W5S7V5X="@I.R!B6)O87)D+B J+PH@( H@g M(" @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]D92!T;R!!4T-)22!T86)L92!F;W(@97AT96YD960@9'5T8V@@f M:V5Y8F]A6)Om M87)D+G,Z"21H+V-O;2YH"BL@:V5Y8F]A6)O87)D+B Ji M+PH@( H@(" @5]Mf M87!S6W-C86Y?8V]U0 !U6)O87)D+F,N(%1H:7,@:7,@82!K;'5D9V4@r M=&\@6)O87)D(&YA;65S+"!S:&]U;&0@5]M87!So M6TU!4%]-05A=(#T@>PHO*@DB52Y3+B!%>'1E;F1E9"(L("HO"B\J"2)$=71Cn M:"!%>'1E;F1E9"(L("HO"@DB3F]R=V5G:6%N($5X=&5N9&5D(BP*+RH)(D]Lm M:79E='1I($TR-"(@*B\*"7T["@HC96QS90H*+RH@1&5F:6YE($Y27U-#04Y?l M0T]$15,@=&\@=&AE(&YU;6)E7,N("HO"@E]"6MEf M>6UA<#L*"FME>6UA< EK97E?;6%P'1E;F1E9" J+PHO*B!["GLP+"=@)RPG,2"'1E;F1E9" Je M+PHO*B!["GLP+# S,RPG,2"'1E;F1E9" J+PI["GLP+# S,RPG,2"RS L,"PP+# L,"PP+# Lh M,"P)"3 L,"PP+# L,"PP+# L,"P*(# L,"PP+# L,"PP+# L,"P)"3 L,"PPg M+# L,"PP+# L,"P*(# L,"PP+# L,"PP+# L,"P)"3 L,"PP+# L,"PP+# Lf M,"P*(# L,"PP+# L,"PP+# L,"P)"3 L,"PP+# L,"PP+# L,"P*(# L,"PPe M+# L,"PP+# L,"P)"3 L,"PP+# L,"PP+# L,"P*(# L,"PP+# L,"PP+# Ld M,"PP+ D),"PP+# L,"PP+# L,"PP+ H@,"PP+# L,"PP+# L,"PP"B!]"GT@c M*B\*?3L*(V5N9&EF"BPG/B$9&j M1D8*+2TM(#(T+#,Q("TM+2T*(" @*B\*(" C9&5F:6YE($1204U325I%(" @i M, H@( HA("\J($1E9F%U;'0@:V5Y8F]A7!E(&9O