▼QNX RTPと日本語106キーボードのためのdevc-con▼

Keywords: QNX japanese 106 keyboard map devc-con console driver

$Id: devc-con-jp.html,v 1.5 2009-09-30 15:43:33+09 kabe Exp $

▼これは何か?

QNX RTP / Momentics では、 生コンソール(非Photon) 時の キーボードマップは英語101に固定されています。 これはコンソールドライバの devc-con の仕様。 (何とかするとは言われていたが たぶん忘れ去られている)

日本語106などの他のキーマップにするには devc-con を 改造する必要があります。 のでその改造用パッチ。

RTOS 6.4.1以上の devc-con では、ようやく キーマップ変更可能 になっていますが、96以上のスキャンコードを収容できません。 やっぱり改造が必要です。 (未確認)

▼作る

QNXRTP 6.1 の CDROM に入っている Character DDK に、 以下のパッチを当ててコンパイルします。 できたバイナリやパッケージは 6.2 でも使える。

devc-con だけ作っても、ブート時から使えるようにするには /etc/system/package/packages に細工したりしなければ ならなかったのですが、 色々試してパッケージ作って突っ込むだけで済むようにできました。 devc/package/ で make すれば、インストールするだけで使える パッケージのできあがり。

▼使う

なおパッケージでインストールすると、 /.altboot を使っても F1 (safe modes) にしても オリジナルの英語101用devc-con には戻りません。 F8 (Enable a previous package configuration) を使えば無効にできますが、 packages.1, packages.2 ... のうちどれが正解かはすぐにはわからんので あまり役に立たんでしょう。

▼改造点

devc-con-jp106-1.1-x86.qpr


かべ@sra-tohoku.co.jp
Index: devc-con-jp/devc/CHANGES diff -u /dev/null devc-con-jp/devc/CHANGES:1.3 --- /dev/null Mon Dec 23 20:39:16 2002 +++ devc-con-jp/devc/CHANGES Mon Dec 23 20:39:11 2002 @@ -0,0 +1,27 @@ +==== Changes from RELEASE_6_1_0 === + +* Remapped keycodes for Japanese 106 keyboard. + As jp keyboards have nearly 128 scancodes, scan code table + was expanded to maximum. +* CapsLock will be Ctrl/CapsLock. +* Henkan/MaeKouho is mapped to BackSpace/Delete rather than nothing. +* added package/ directory to make a *.qpr package. + +==== TAGS ==== +QNX +RELEASE_6_1_0 + original, devc-con subset + +JP106_STD + standard mappings, muhenkan/henkan mapped to space + capslock mapped to ctrl + +JP106_KLUDGEPAK + Kludgy package/Makefile to generate qnx/os/jp106-1.0 installation + +====== TODO ==== + +====== memo ==== +package should be created as .../x86/sbin/devc-con, +not /sbin/devc-con-jp106, as diskboot will always scan for /sbin/devc-con + Index: devc-con-jp/devc/con/intr.c diff -u devc-con-jp/devc/con/intr.c:1.1.1.1 devc-con-jp/devc/con/intr.c:1.3 --- devc-con-jp/devc/con/intr.c:1.1.1.1 Thu Dec 19 03:31:41 2002 +++ devc-con-jp/devc/con/intr.c Thu Dec 19 04:10:58 2002 @@ -149,49 +149,79 @@ /* * Base codes */ -static unsigned short kbtable[5*96] ={ +/* + * Changed around for Japanese 106 type keyboard + */ +#define KBTABSIZE 0x80 +static unsigned short kbtable[5*KBTABSIZE] ={ 0x8000,0x001B,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036, /* 00 */ - 0x0037,0x0038,0x0039,0x0030,0x002D,0x003D,0x007F,0x0009, + 0x0037,0x0038,0x0039,0x0030,0x002D, '^',0x007F,0x0009, 0x2071,0x2077,0x2065,0x2072,0x2074,0x2079,0x2075,0x2069, /* 10 */ - 0x206F,0x2070,0x005B,0x005D,0x000D,0x0202,0x2061,0x2073, + 0x206F,0x2070, '@', '[',0x000D,0x0202,0x2061,0x2073, 0x2064,0x2066,0x2067,0x2068,0x206A,0x206B,0x206C,0x003B, /* 20 */ - 0x0027,0x0060,0x0201,0x005C,0x207A,0x2078,0x2063,0x2076, + ':',0x001B,0x0201, ']',0x207A,0x2078,0x2063,0x2076, 0x2062,0x206E,0x206D,0x002C,0x002E,0x002F,0x0208,0x002A, /* 30 */ - 0x0204,0x0020,0x0804,0x0181,0x0182,0x0183,0x0184,0x0185, + 0x0204,0x0020,0x0202,0x0181,0x0182,0x0183,0x0184,0x0185, 0x0186,0x0187,0x0188,0x0189,0x018A,0x0802,0x0801,0x05A0, /* 40 */ 0x05A1,0x05A2,0x05A3,0x05A4,0x05A5,0x05A6,0x05A7,0x05A8, 0x05A9,0x05AA,0x05AB,0x05AC,0x8000,0x8000,0x8000,0x01AE, /* 50 */ 0x01AF,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000, +/* Japanese-106 additional codes: + * 0x29 Hankaku/Zenkaku (map Esc for now) + * 0x70 Hiragana/Katakana (map invalid) + * 0x73 Backslash/Underbar + * 0x79 Henkan/MaeKouho (map Backspace/Del) + * 0x7B Muhenkan (map space) + * 0x7D Yen/Verticalbar + * + * Note that this keyboard's scancode generates above 0x60. + * + * Other maps: + * Shift-Capslock mapped to CapsLock + * plain Capslock mapped to Ctrl + */ + 0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000, /* 60 */ + 0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000, + 0x8000,0x8000,0x8000, '\\',0x8000,0x8000,0x8000,0x8000, /* 70 */ + 0x8000,0x007F,0x8000, ' ',0x8000, '\\',0x8000,0x8000, /* * Shift codes */ - 0x8000,0x001B,0x0021,0x0040,0x0023,0x0024,0x0025,0x005E, /* 00 */ - 0x0026,0x002A,0x0028,0x0029,0x005F,0x002B,0x01FC,0x0180, + 0x8000,0x001B,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026, /* 00 */ + 0x0027,0x0028,0x0029, '~', '=', '~',0x01FC,0x0180, 0x2051,0x2057,0x2045,0x2052,0x2054,0x2059,0x2055,0x2049, /* 10 */ - 0x204F,0x2050,0x007B,0x007D,0x01E0,0x0202,0x2041,0x2053, - 0x2044,0x2046,0x2047,0x2048,0x204A,0x204B,0x204C,0x003A, /* 20 */ - 0x0022,0x007E,0x0201,0x007C,0x205A,0x2058,0x2043,0x2056, + 0x204F,0x2050, '`', '{',0x01E0,0x0202,0x2041,0x2053, + 0x2044,0x2046,0x2047,0x2048,0x204A,0x204B,0x204C, '+', /* 20 */ + '*',0x001B,0x0201, '}',0x205A,0x2058,0x2043,0x2056, 0x2042,0x204E,0x204D,0x003C,0x003E,0x003F,0x0208,0x01AD, /* 30 */ - 0x0204,0x0020,0x8000,0x018B,0x018C,0x018D,0x018E,0x018F, + 0x0204,0x0020,0x0804,0x018B,0x018C,0x018D,0x018E,0x018F, 0x0190,0x0191,0x0192,0x0193,0x0194,0x8000,0x8000,0x0437, /* 40 */ 0x0438,0x0439,0x042D,0x0434,0x0435,0x0436,0x042B,0x0431, 0x0432,0x0433,0x0430,0x042E,0x8000,0x8000,0x8000,0x01DB, /* 50 */ 0x01DC,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000, + 0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000, /* 60 */ + 0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000, + 0x8000,0x8000,0x8000, '_',0x8000,0x8000,0x8000,0x8000, /* 70 */ + 0x8000,0x01AC,0x8000, ' ',0x8000, '|',0x8000,0x8000, /* * Cntl codes */ - 0x8000,0x001B,0x8000,0x0000,0x8000,0x8000,0x8000,0x001E, /* 00 */ - 0x8000,0x8000,0x8000,0x8000,0x001F,0x8000,0x01DE,0x019F, + 0x8000,0x001B,0x8000,0x1022,0x8000,0x8000,0x8000,0x001E, /* 00 */ + 0x1027,0x8000,0x8000,0x8000,0x8000,0x105E,0x01DE,0x019F, 0x0011,0x0017,0x0005,0x0012,0x0014,0x0019,0x0015,0x0009, /* 10 */ - 0x000F,0x0010,0x001B,0x001D,0x01D0,0x0202,0x0001,0x0013, + 0x000F,0x0010,0x0000,0x001B,0x01D0,0x0202,0x0001,0x0013, 0x0004,0x0006,0x0007,0x0008,0x000A,0x000B,0x000C,0x8000, /* 20 */ - 0x1027,0x8000,0x0201,0x001C,0x001A,0x0018,0x0003,0x0016, + 0x8000,0x8000,0x0201,0x001D,0x001A,0x0018,0x0003,0x0016, 0x0002,0x000E,0x000D,0x8000,0x8000,0x8000,0x0208,0x01BD, /* 30 */ - 0x0204,0x0020,0x8000,0x0195,0x0196,0x0197,0x0198,0x0199, + 0x0204,0x0020,0x0202,0x0195,0x0196,0x0197,0x0198,0x0199, 0x019A,0x019B,0x019C,0x019D,0x019E,0x8000,0x4012,0x01B0, /* 40 */ 0x01B1,0x01B2,0x01B3,0x01B4,0x01B5,0x01B6,0x01B7,0x01B8, 0x01B9,0x01BA,0x01BB,0x01BC,0x8000,0x8000,0x8000,0x01BE, /* 50 */ 0x01BF,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000, + 0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000, /* 60 */ + 0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000, + 0x8000,0x8000,0x8000,0x001C,0x8000,0x8000,0x8000,0x8000, /* 70 */ + 0x8000,0x8000,0x8000,0x8000,0x8000,0x001C,0x8000,0x8000, /* * Alt codes */ @@ -202,26 +232,34 @@ 0x01E4,0x01E6,0x01E7,0x01E8,0x01EA,0x01EB,0x01EC,0x8000, /* 20 */ 0x8000,0x8000,0x0201,0x8000,0x01FA,0x01F8,0x01E3,0x01F6, 0x01E2,0x01EE,0x01ED,0x8000,0x8000,0x8000,0x0208,0x01CD, /* 30 */ - 0x0204,0x8000,0x8000,0x01D1,0x01D2,0x01D3,0x01D4,0x01D5, + 0x0204,0x8000,0x0202,0x01D1,0x01D2,0x01D3,0x01D4,0x01D5, 0x01D6,0x01D7,0x01D8,0x01D9,0x01DA,0x8000,0x8000,0x01C0, /* 40 */ 0x01C1,0x01C2,0x01C3,0x01C4,0x01C5,0x01C6,0x01C7,0x01C8, 0x01C9,0x01CA,0x01CB,0x01CC,0x01DD,0x8000,0x8000,0x01CE, /* 50 */ 0x01CF,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000, + 0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000, /* 60 */ + 0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000, + 0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000, /* 70 */ + 0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000, /* * Ctl-Alt codes */ 0x8000,0x4002,0x4005,0x4006,0x4007,0x4008,0x4009,0x400A, /* 00 */ 0x400B,0x400C,0x400D,0x400E,0x8000,0x8000,0x4004,0x8000, 0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000, /* 10 */ - 0x8000,0x8000,0x8000,0x8000,0x4003,0x0202,0x8000,0x8000, + 0x8000,0x8000,0x1060,0x8000,0x4003,0x0202,0x8000,0x8000, 0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000, /* 20 */ 0x8000,0x8000,0x0201,0x8000,0x8000,0x8000,0x8000,0x8000, 0x8000,0x8000,0x8000,0x4010,0x400F,0x4011,0x0208,0x4020, /* 30 */ - 0x0204,0x8000,0x8000,0x4021,0x4022,0x4023,0x4024,0x4025, + 0x0204,0x8000,0x0202,0x4021,0x4022,0x4023,0x4024,0x4025, 0x4026,0x4027,0x4028,0x4029,0x402A,0x8000,0x8000,0x8000, /* 40 */ 0x8000,0x8000,0x4004,0x8000,0x8000,0x8000,0x4003,0x8000, 0x8000,0x8000,0x8000,0x4001,0x4020,0x8000,0x8000,0x8000, /* 50 */ 0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000, + 0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000, /* 60 */ + 0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000, + 0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000, /* 70 */ + 0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000, }; static unsigned short *kb_base = &kbtable[0]; @@ -566,13 +604,13 @@ { if( flag & KB_ALT) { if( flag & KB_CTL) - return(&kbtable[4*96]); /* Ctl + Alt */ - return(&kbtable[3*96]); /* Alt */ + return(&kbtable[4*KBTABSIZE]); /* Ctl + Alt */ + return(&kbtable[3*KBTABSIZE]); /* Alt */ } if( flag & KB_CTL) - return(&kbtable[2*96]); /* Ctl */ + return(&kbtable[2*KBTABSIZE]); /* Ctl */ if( flag & KB_SHIFT) - return(&kbtable[1*96]); /* Shift */ + return(&kbtable[1*KBTABSIZE]); /* Shift */ return(&kbtable[0]); /* Normal */ } @@ -665,28 +703,34 @@ key = *(kb_base + c); op = (key >> 8); - if( c >= 0x60 ) { + if( c >= KBTABSIZE ) { /* - * Process special codes + * Ignore all other codes + * (KBTABSIZE==0x80, so no-op here...) */ - if( s == 0xFA ) { - /* - * A received ACK from keyboard allows us to - * send another byte from the transmit queue - */ - rcv_ack(); - goto done; - } - if( s == 0xE0 ) { - /* - * Extended scan-code follows - */ - kbflag &= ~KB_EXTENDED; - kbflag |= KB_EXT_ARM; - goto done; - } + goto done; + } + + if( s == 0xFA ) { /* - * Ignore all other codes + * A received ACK from keyboard allows us to + * send another byte from the transmit queue + */ + rcv_ack(); + goto done; + } + if( s == 0xE0 ) { + /* + * Extended scan-code follows + */ + kbflag &= ~KB_EXTENDED; + kbflag |= KB_EXT_ARM; + goto done; + } + + if( op == 0x80 ) { + /* + * Ignore invalid key */ goto done; } Index: devc-con-jp/devc/con/options.c diff -u devc-con-jp/devc/con/options.c:1.1.1.1 devc-con-jp/devc/con/options.c:1.2 --- devc-con-jp/devc/con/options.c:1.1.1.1 Thu Dec 19 03:31:41 2002 +++ devc-con-jp/devc/con/options.c Thu Dec 19 03:47:03 2002 @@ -11,7 +11,7 @@ */ /* #ifdef __USAGE -%C - Console driver for PC keyboard/VGA display +%C - Console driver for PC keyboard/VGA display (jp106 key mapping) %C [options] & Options: Index: devc-con-jp/devc/package/Makefile diff -u /dev/null devc-con-jp/devc/package/Makefile:1.8 --- /dev/null Mon Dec 23 20:39:16 2002 +++ devc-con-jp/devc/package/Makefile Mon Dec 23 20:28:06 2002 @@ -0,0 +1,23 @@ +all: repack + +# NEVER make VEND "public"; it'll wipe out ./public!! +VEND=qnx +CMPN=kbd-jp106 +PVERS=1.0 +#PNAME=os / PNAME=os-jp106 + +../con/x86/o/devc-con: + cd ../con; make + +os-$(PVERS)-x86-$(VEND).qpr: ../con/x86/o/devc-con + D=`pwd`; D=`basename $$D`; cd ..; packager $$D/package.qpg + mv ../$@ . + +repack: os-$(PVERS)-x86-$(VEND).qpr + cp -p os-$(PVERS)-x86-$(VEND).qpr devc-con-jp106-$(PVERS)-x86.qpr + +clean:: + rm -fr *.qpm *.qpk os-*.qp? $(VEND) + +veryclean: clean + rm -f *.qpr Index: devc-con-jp/devc/package/package.qpg diff -u /dev/null devc-con-jp/devc/package/package.qpg:1.6 --- /dev/null Mon Dec 23 20:39:16 2002 +++ devc-con-jp/devc/package/package.qpg Mon Dec 23 20:28:06 2002 @@ -0,0 +1,93 @@ +<QPG:Generation> + <QPG:Owner file="owner.qpg"/> + <QPG:Values> + <QPG:Files> + <QPG:Add file="*/*/*/*.map" handling="exclude"/> + <QPG:Add file="*/*/*/*.pinfo" handling="exclude"/> + <QPG:Add file="*/*/*/devc-con" pinfo="$" install="/sbin/devc-con" component="kbd-jp106"/> + </QPG:Files> + + <QPG:PackageFilter> + <QPM:PackageManifest> + <QPM:PackageDescription> + <QPM:PackageName>kbd-jp106-1.0</QPM:PackageName> + <QPM:PackageType>Application</QPM:PackageType> + <QPM:PackageReleaseNumber>1</QPM:PackageReleaseNumber> + <QPM:PackageRepository/> + <QPM:FileVersion>1.01</QPM:FileVersion> + </QPM:PackageDescription> + + <QPM:ProductDescription> + <QPM:ProductName>devc-con for Japanese 106 keyboard</QPM:ProductName> + <QPM:VendorInstallName>qnx</QPM:VendorInstallName> + <QPM:ProductIdentifier>os</QPM:ProductIdentifier> + <QPM:ProductEmail/> + <QPM:VendorName>kabe</QPM:VendorName> + <QPM:VendorURL/> + <QPM:VendorEmbedURL/> + <QPM:VendorEmail>kabe#sra-tohoku.co.jp</QPM:VendorEmail> + <QPM:AuthorName>Taketo Kabe</QPM:AuthorName> + <QPM:ProductIconSmall/> + <QPM:ProductIconLarge/> + <QPM:ProductDescriptionShort>devc-con for jp106</QPM:ProductDescriptionShort> + <QPM:ProductDescriptionLong>Modified devc-con with Japanese 106 keyboard mapping, + for use in the raw console. You don't need this if you only use jp106 keyboard in Photon. + </QPM:ProductDescriptionLong> + <QPM:ProductDescriptionURL/> + <QPM:ProductDescriptionEmbedURL/> + </QPM:ProductDescription> + + <QPM:ReleaseDescription> + <QPM:ReleaseVersion>1.0</QPM:ReleaseVersion> + <QPM:ReleaseUrgency>Medium</QPM:ReleaseUrgency> + <QPM:ReleaseStability>Stable</QPM:ReleaseStability> + <QPM:ReleaseNoteMinor/> + <QPM:ReleaseNoteMajor/> + <QPM:ReleaseBuild>1</QPM:ReleaseBuild> + <QPM:CountryExclude/> + <QPM:ReleaseCopyright>QNX Community License</QPM:ReleaseCopyright> + </QPM:ReleaseDescription> + + <QPM:LicenseUrl/> + + <QPM:ContentDescription> + <QPM:ContentTopic>System/Device Specific/Input Device/Keyboard and Keypad</QPM:ContentTopic> + <QPM:ContentKeyword>devc-con,japanese,jp106,keyboard</QPM:ContentKeyword> + <QPM:DisplayEnvironment>Console</QPM:DisplayEnvironment> + <QPM:TargetAudience>Administrator</QPM:TargetAudience> + <QPM:RequiresLibrary>libc.so.2</QPM:RequiresLibrary> + </QPM:ContentDescription> + + <QPM:ProductInstallationProcedure> + <QPM:OrderDependency> + <QPM:Order>InstallOver</QPM:Order> + <QPM:Product>os-drivers</QPM:Product> + </QPM:OrderDependency> + </QPM:ProductInstallationProcedure> + + <QPM:QNXLicenseDescription/> + </QPM:PackageManifest> + </QPG:PackageFilter> + + + <QPG:PackageFilter proc="x86"> + <QPM:PackageManifest> + <QPM:PackageDescription> + <QPM:PackageName>kbd-jp106-1.0-x86</QPM:PackageName> + </QPM:PackageDescription> + + <QPM:ProductDescription> + <QPM:ProductName>devc-con for Japanese 106 keyboard</QPM:ProductName> + </QPM:ProductDescription> + + <QPM:ProductInstallationProcedure> + <QPM:OrderDependency> + <QPM:Order>InstallOver</QPM:Order> + <QPM:Product>os-drivers-host_x86</QPM:Product> + </QPM:OrderDependency> + </QPM:ProductInstallationProcedure> + + </QPM:PackageManifest> + </QPG:PackageFilter> + </QPG:Values> +</QPG:Generation>