1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628
|
Edward Flottwell <edward@mudhoney.mitropa.com> wrote the following
about his kernel patch for allowing the kernel to work with an
adapted AS400 keyboard.
(In fact no kernel patch is required - the utility setkeycodes will do.
But the technical info below might be useful for somebody.)
----aeb
"Keyboard.c patch for IBM Keyboards" (Aug 9, 20:04):
> The last 2 Weekends I spent on hacking a little bit in the keyboard code to
> make a keyboard from a IBM AS400 Terminal work with LinuX. It's a very nice
> piece of hardware, 122 keys and 2 kg :-), mostly used in Banks and
> Companies. I got mine from a bank service company for 10 Marks (aprox.
> 7.5$).
>
> The patch against keyboard.c from 1.3.15 and a README is following:
>
> --------------------------------schnipp-----------------------------------
--- keyboard.1.3.15.orig Wed Aug 9 12:51:28 1995
+++ keyboard.c Wed Aug 9 13:11:56 1995
@@ -39,6 +39,11 @@
#define KBD_REPORT_ERR
#define KBD_REPORT_UNKN
/* #define KBD_IS_FOCUS_9000 */
+/* #define KBD_IS_IBM_AS400 */
+
+/* When using an original IBM AS_400 Keyboard you should enable both
+ * KBD_IS_FOCUS_9000 and KBD_IS_IBM_AS400
+ */
#ifndef KBD_DEFMODE
#define KBD_DEFMODE ((1 << VC_REPEAT) | (1 << VC_META))
@@ -228,6 +233,29 @@
#define E1_PAUSE 119
+#ifdef KBD_IS_IBM_AS400
+#define E0_GR 105
+#define E0_SIGN 43
+#define E0_LINE 108
+#define IBM_PF9 112
+#define IBM_PF10 113
+#define IBM_PF11 114
+#define IBM_PF12 115
+#define IBM_PF13 116
+#define IBM_PF14 117
+#define IBM_PF15 118
+#define IBM_PF16 120
+#define IBM_PF17 121
+#define IBM_PF18 122
+#define IBM_PF19 123
+#define IBM_PF20 124
+#define IBM_PF21 125
+#define IBM_PF22 126
+#define IBM_PF23 127
+#define IBM_PF24 119
+#endif
+
+
/*
* The keycodes below are randomly located in 89-95,112-118,120-127.
* They could be thrown away (and all occurrences below replaced by 0),
@@ -262,6 +290,7 @@
#define RGN3 126
#define RGN4 127
+#ifndef KBD_IS_IBM_AS400
static unsigned char high_keys[128 - SC_LIM] = {
RGN1, RGN2, RGN3, RGN4, 0, 0, 0, /* 0x59-0x5f */
0, 0, 0, 0, 0, 0, 0, 0, /* 0x60-0x67 */
@@ -270,6 +299,20 @@
FOCUS_PF4, FOCUS_PF5, FOCUS_PF6, FOCUS_PF7, /* 0x78-0x7b */
FOCUS_PF8, JAP_86, FOCUS_PF10, 0 /* 0x7c-0x7f */
};
+#endif
+#ifdef KBD_IS_IBM_AS400
+static unsigned char high_keys[128 - SC_LIM] = {
+ FOCUS_PF2, FOCUS_PF3, FOCUS_PF4, FOCUS_PF5, FOCUS_PF6,
+ FOCUS_PF7, FOCUS_PF8, /* 0x59-0x5f */
+ IBM_PF9, IBM_PF10, IBM_PF11, IBM_PF12,
+ IBM_PF13, IBM_PF14, IBM_PF15, IBM_PF16, /* 0x60-0x67 */
+ IBM_PF17, IBM_PF18, IBM_PF19, IBM_PF20, IBM_PF21,
+ IBM_PF22, IBM_PF23, E0_PGUP, /* 0x68-0x6f */
+ E0_GR, E0_RCTRL, E0_RALT, 0, E0_SIGN, 0, IBM_PF24, E0_LINE, /* 0x70-0x77 */
+ E0_UP, E0_DEL, E0_END, E0_INS, /* 0x78-0x7b */
+ 0, E0_RIGHT, E0_PGDN, E0_HOME /* 0x7c-0x7f */
+};
+#endif
/* BTC */
#define E0_MACRO 112
--------------------------------schnipp-----------------------------------
This is an explaining README. ( README.AS400 )
--------------------------------schnipp-----------------------------------
Connecting and using a non standard IBM keyboard
by
Edward von Flottwell
edward@mudhoney.mitropa.com
If you would like to use an old IBM 122-key AS400 Terminal keyboard with Linux,
you should to do some small things:
1. Get your 'new' keyboard from a recycling company.
If you haven't done this already :-)
2. Solder a new 5pin DIN Connector instead of the RJ/??? Plug to the wire.
3. Patch the kernel and build an new one.
4. Load a new keymap and fit it to your needs.
I hope you managed the first step - so I'll continue with the second one:
Get a keyboard connector from your nearest electronic-shop, cut off the
original plug and you will hopefully find 4 colored wires: black, red,
yellow and white. Connect them in the following way with the DIN Plug:
Wire Signal DIN ___
Black +5V 4 / 3 \ Soldering
White GND 2 (2 4) View
Red Data 3 \1^5/
Yellow Clock 1
BUT BE VERY CAREFUL!!! Connecting the wrong signals can damage or blow up
your keyboard or your mainboard! The table above comes with NO warranty,
because I don't believe IBM always use the same type of cable :-}
You should open the keyboard and trace the wires to find the matching out.
And you should consult your mainboard for the keyboard-plug layout!
Now you're ready to switch on the computer... Some mainboard bioses will
produce a keyboard error. You can ignore this :-) BTW the F1 key is the
very left of the function-key group near the tabulator key.
O.K., now you can try to type something, e.g. LILO: linux :-)
You will find out that some keys are swapped, others are dead. To make all
of the keys work apply the kernel-patch to
/usr/src/linux/drivers/char/keyboard.c and comment the lines with
/* #define KBD_IS_FOCUS_9000 */
/* #define KBD_IS_IBM_AS400 */
out. Recompile and install the new kernel.
Now you need the last missing part: the keymap. At the end of this README
you will find an example for German users. How to make it fit to your
national keyboard is explained in the Keystroke-HOWTO. Most other questions
about keymaps, scancodes,... are explained there, too.
I would also suggest you read the manpages of showkey and loadkeys.
Don't forget to load the keymap every time you boot,
I prefer the rc.local shellscript doing this for me :-)
The keymap:
#
# File: AS400.map
#
keycode 0 =
keycode 1 = Escape Escape
alt keycode 1 = Meta_Escape
shift alt keycode 1 = Meta_Escape
keycode 2 = one exclam
alt keycode 2 = Meta_one
shift alt keycode 2 = Meta_exclam
keycode 3 = two quotedbl twosuperior
control keycode 3 = nul
alt keycode 3 = Meta_two
shift alt keycode 3 = Meta_quotedbl
keycode 4 = three section threesuperior
control keycode 4 = Escape
alt keycode 4 = Meta_three
keycode 5 = four dollar dollar
control keycode 5 = Control_backslash
alt keycode 5 = Meta_four
shift alt keycode 5 = Meta_dollar
keycode 6 = five percent
control keycode 6 = Control_bracketright
alt keycode 6 = Meta_five
shift alt keycode 6 = Meta_percent
keycode 7 = six ampersand
control keycode 7 = Control_asciicircum
alt keycode 7 = Meta_six
shift alt keycode 7 = Meta_ampersand
keycode 8 = seven slash braceleft
control keycode 8 = Control_underscore
alt keycode 8 = Meta_seven
shift alt keycode 8 = Meta_slash
keycode 9 = eight parenleft bracketleft
control keycode 9 = Delete
alt keycode 9 = Meta_eight
shift alt keycode 9 = Meta_parenleft
keycode 10 = nine parenright bracketright
alt keycode 10 = Meta_nine
control altgr keycode 10 = Control_bracketright
shift alt keycode 10 = Meta_parenright
keycode 11 = zero equal braceright
alt keycode 11 = Meta_zero
shift alt keycode 11 = Meta_equal
keycode 12 = ssharp question backslash
control keycode 12 = Control_underscore
alt keycode 12 = Meta_minus
control altgr keycode 12 = Control_backslash
shift alt keycode 12 = Meta_question
alt altgr keycode 12 = Meta_backslash
keycode 13 = apostrophe grave
alt keycode 13 = Meta_equal
shift alt keycode 13 = Meta_grave
keycode 14 = Delete Delete
alt keycode 14 = Meta_Delete
keycode 15 = Tab Tab
alt keycode 15 = Meta_Tab
keycode 16 = q
altgr keycode 16 = at
control keycode 16 = Control_q
alt keycode 16 = Meta_q
shift alt keycode 16 = Meta_Q
altgr alt keycode 16 = Meta_at
keycode 17 = w
control keycode 17 = Control_w
alt keycode 17 = Meta_w
shift alt keycode 17 = Meta_W
keycode 18 = e
control keycode 18 = Control_e
alt keycode 18 = Meta_e
shift alt keycode 18 = Meta_E
keycode 19 = r
control keycode 19 = Control_r
alt keycode 19 = Meta_r
shift alt keycode 19 = Meta_R
keycode 20 = t
control keycode 20 = Control_t
alt keycode 20 = Meta_t
shift alt keycode 20 = Meta_T
keycode 21 = z
control keycode 21 = Control_z
alt keycode 21 = Meta_z
shift alt keycode 21 = Meta_Z
keycode 22 = u
control keycode 22 = Control_u
alt keycode 22 = Meta_u
shift alt keycode 22 = Meta_U
keycode 23 = i
alt keycode 23 = Meta_i
shift alt keycode 23 = Meta_I
keycode 24 = o
control keycode 24 = Control_o
alt keycode 24 = Meta_o
shift alt keycode 24 = Meta_O
keycode 25 = p
control keycode 25 = Control_p
alt keycode 25 = Meta_p
shift alt keycode 25 = Meta_P
keycode 26 = +udiaeresis +Udiaeresis
control keycode 26 = Escape
alt keycode 26 = Meta_bracketleft
shift alt keycode 26 = Meta_braceleft
keycode 27 = plus asterisk asciitilde
control keycode 27 = Control_bracketright
alt keycode 27 = Meta_bracketright
shift alt keycode 27 = Meta_braceright
keycode 28 = Return
alt keycode 28 = 0x080d
keycode 29 = Caps_Lock
keycode 30 = a
control keycode 30 = Control_a
alt keycode 30 = Meta_a
shift alt keycode 30 = Meta_A
keycode 31 = s
control keycode 31 = Control_s
alt keycode 31 = Meta_s
shift alt keycode 31 = Meta_S
keycode 32 = d
control keycode 32 = Control_d
alt keycode 32 = Meta_d
shift alt keycode 32 = Meta_D
keycode 33 = f
control keycode 33 = Control_f
alt keycode 33 = Meta_f
shift alt keycode 33 = Meta_F
keycode 34 = g
control keycode 34 = Control_g
alt keycode 34 = Meta_g
shift alt keycode 34 = Meta_G
keycode 35 = h
alt keycode 35 = Meta_h
shift alt keycode 35 = Meta_H
keycode 36 = j
alt keycode 36 = Meta_j
shift alt keycode 36 = Meta_J
keycode 37 = k
control keycode 37 = Control_k
alt keycode 37 = Meta_k
shift alt keycode 37 = Meta_K
keycode 38 = l
control keycode 38 = Control_l
alt keycode 38 = Meta_l
shift alt keycode 38 = Meta_L
keycode 39 = +odiaeresis +Odiaeresis
alt keycode 39 = Meta_semicolon
shift alt keycode 39 = Meta_colon
shift keycode 39 = Odiaeresis
keycode 40 = +adiaeresis +Adiaeresis
control keycode 40 = Control_g
alt keycode 40 = Meta_apostrophe
shift alt keycode 40 = Meta_quotedbl
keycode 41 = asciicircum degree
control keycode 41 = nul
alt keycode 41 = Meta_grave
shift alt keycode 41 = Meta_asciitilde
keycode 42 = Shift
keycode 43 = numbersign apostrophe
control keycode 43 = Control_backslash
alt keycode 43 = Meta_backslash
shift alt keycode 43 = Meta_apostrophe
keycode 44 = y
control keycode 44 = Control_y
alt keycode 44 = Meta_y
shift alt keycode 44 = Meta_Y
keycode 45 = x
control keycode 45 = Control_x
alt keycode 45 = Meta_x
shift alt keycode 45 = Meta_X
keycode 46 = c
control keycode 46 = Control_c
alt keycode 46 = Meta_c
shift alt keycode 46 = Meta_C
keycode 47 = v
control keycode 47 = Control_v
alt keycode 47 = Meta_v
shift alt keycode 47 = Meta_V
keycode 48 = b
control keycode 48 = Control_b
alt keycode 48 = Meta_b
shift alt keycode 48 = Meta_B
keycode 49 = n
control keycode 49 = Control_n
alt keycode 49 = Meta_n
shift alt keycode 49 = Meta_N
keycode 50 = m
altgr keycode 50 = mu
control keycode 50 = Control_m
alt keycode 50 = Meta_m
shift alt keycode 50 = Meta_M
keycode 51 = comma semicolon
alt keycode 51 = Meta_comma
alt shift keycode 51 = Meta_semicolon
keycode 52 = period colon
alt keycode 52 = Meta_period
alt shift keycode 21 = Meta_colon
keycode 53 = minus underscore
control keycode 53 = Delete
alt keycode 53 = Meta_slash
shift control keycode 53 = Control_underscore
keycode 54 = Shift
keycode 55 = KP_Multiply
keycode 56 = Control
keycode 57 = space space
control keycode 57 = nul
alt keycode 57 = Meta_space
keycode 58 = Control
keycode 59 = Escape Escape
alt keycode 1 = Meta_Escape
shift alt keycode 1 = Meta_Escape
keycode 60 = Control_z
keycode 61 =
keycode 62 = Last_Console
keycode 63 = Control_a
keycode 64 = Up
keycode 65 = Control_backslash
control keycode 99 = Control_backslash
alt keycode 99 = Control_backslash
keycode 66 = Control_c
keycode 67 = Control_q
keycode 68 = Control_s
keycode 69 = Num_Lock
keycode 70 = Control_r
keycode 71 = KP_7
alt keycode 71 = Ascii_7
keycode 72 = KP_8
alt keycode 72 = Ascii_8
keycode 73 = KP_9
alt keycode 73 = Ascii_9
keycode 74 = KP_Subtract
keycode 75 = KP_4
alt keycode 75 = Ascii_4
keycode 76 = KP_5
alt keycode 76 = Ascii_5
keycode 77 = KP_6
alt keycode 77 = Ascii_6
keycode 78 = KP_Enter
keycode 79 = KP_1
alt keycode 79 = Ascii_1
keycode 80 = KP_2
alt keycode 80 = Ascii_2
keycode 81 = KP_3
alt keycode 81 = Ascii_3
keycode 82 = KP_0
alt keycode 82 = Ascii_0
keycode 83 = KP_Comma
altgr control keycode 83 = Boot
control alt keycode 83 = Boot
keycode 84 = slash
keycode 85 = Down
keycode 86 = Left
keycode 87 = F11 F11 Console_23
control keycode 87 = F11
alt keycode 87 = Console_11
control alt keycode 87 = Console_11
keycode 88 = F1 F11 Console_13
control keycode 88 = F1
alt keycode 88 = Console_1
control alt keycode 88 = Console_1
keycode 89 = F2 F12 Console_14
control keycode 89 = F2
alt keycode 89 = Console_2
control alt keycode 89 = Console_2
keycode 90 = F3 F13 Console_15
control keycode 90 = F3
alt keycode 90 = Console_3
control alt keycode 90 = Console_3
keycode 91 = F4 F14 Console_16
control keycode 91 = F4
alt keycode 91 = Console_4
control alt keycode 91 = Console_4
keycode 92 = F5 F15 Console_17
control keycode 92 = F5
alt keycode 92 = Console_5
control alt keycode 92 = Console_5
keycode 93 = F6 F16 Console_18
control keycode 93 = F6
alt keycode 93 = Console_6
control alt keycode 93 = Console_6
keycode 94 = F7 F17 Console_19
control keycode 94 = F7
alt keycode 94 = Console_7
control alt keycode 94 = Console_7
keycode 95 = F8 F18 Console_20
control keycode 95 = F8
alt keycode 95 = Console_8
control alt keycode 95 = Console_8
keycode 96 = KP_Enter
keycode 97 = Alt
keycode 98 = KP_Divide
keycode 99 =
keycode 100 = AltGr
keycode 101 = Break
keycode 102 = Find
keycode 103 = Up
keycode 104 = Prior
shift keycode 104 = Scroll_Backward
keycode 105 = less greater bar
alt keycode 86 = Meta_less
shift alt keycode 86 = Meta_greater
altgr alt keycode 86 = Meta_bar
keycode 106 = Right
keycode 107 = Select
keycode 108 = F25
keycode 109 = Next
shift keycode 109 = Scroll_Forward
keycode 110 = Insert
keycode 111 = Remove
altgr control keycode 111 = Boot
control alt keycode 111 = Boot
keycode 112 = F9
keycode 113 = F10
keycode 114 = F11
keycode 115 = F12
keycode 116 = Console_1
keycode 117 = Console_2
keycode 118 = Console_3
keycode 119 =
keycode 120 = Console_4
keycode 121 = Console_5
keycode 122 = Console_6
keycode 123 = Console_7
keycode 124 = Console_8
keycode 125 = F21
keycode 126 = F22
keycode 127 = F23
# mom
string F1 = "\033[[A"
string F2 = "\033[[B"
string F3 = "\033[[C"
string F4 = "\033[[D"
string F5 = "\033[[E"
string F6 = "\033[17~"
string F7 = "\033[18~"
string F8 = "\033[19~"
string F9 = "\033[20~"
string F10 = "\033[21~"
string F11 = "\033[23~"
string F12 = "\033[24~"
string F13 = "\033[25~"
string F14 = "\033[26~"
string F15 = "\033[28~"
string F16 = "\033[29~"
string F17 = "\033[31~"
string F18 = "\033[32~"
string F19 = "\033[33~"
string F20 = "\033[34~"
string Find = "\033[1~"
string Insert = "\033[2~"
string Remove = "\033[3~"
string Select = "\033[4~"
string Prior = "\033[5~"
string Next = "\033[6~"
string F21 = ""
string F22 = ""
string F23 = ""
string F24 = ""
string F25 = ""
string F26 = ""
|