Author Topic: IBM 4704 Keyboard Converter  (Read 91052 times)

0 Members and 1 Guest are viewing this topic.

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
IBM 4704 Keyboard Converter
« on: Wed, 12 February 2014, 18:38:39 »
Acknowledgement
Without generous big help from 002 this would never happened. He helped me to obtain this keyboard, gave me one as a gift or donation more precisely. Thank you 002!

And without Soarer's help I would have given up this work at early stage of reverse eng.

Disclaimer
This converter is mainly for 'proof of concept' purpose. It may or not work for your everyday use. (I'm very confident of this converter now. It works well enough. :D)
Won't offer step by step tutorial and support. But feel free to tinker it yourself. Your improvements and new discoveries are welcomed, let me know. Enjoy!

Post your question here, DON'T PM/EMAIL ME unless you really need.



Converter
Source code:
https://github.com/tmk/tmk_keyboard/tree/master/converter/ibm4704_usb

PCB Design files:
TMK keyboard converter:
https://github.com/tmk/keyboard_converter
D-sub 9pin Adapter:
https://github.com/tmk/keyboard_converter_adapter_ibm4704

My album:
http://imgur.com/a/LaABs



Supported Keyboard
These keyboards are expected to be supported.

IBM capacitive switch models:
- 6019273 Model 100 50-key (grid layout)      http://kishy.ca/?p=894
- 6019284 Model 200 62-key Alpha(60% layout)  http://kishy.ca/?p=894 https://geekhack.org/index.php?topic=63267.0
- 6019303 Model 300 77-key Expanded Alpha     http://kbtalking.cool3c.com/article/23272
- 6020218 Model 400 107-key Full key          http://kishy.ca/?p=894 https://www.flickr.com/photos/triplehaata/sets/72157647943972746/comments/
 
Alps switch(vintage Green) models:
- 5954339 Japanese 102-key    http://deskthority.net/post87127.html#p87127
- 6112883 Japanese 102-key    http://geekhack.org/index.php?topic=52888.msg1194489#msg1194489
- 6112884 Japanese 102-key    http://geekhack.org/index.php?topic=50437.msg1193047#msg1193047                                       
- 6341739 Chinese 102-key     http://geekhack.org/index.php?topic=52888.msg1176566#msg1176566
- 6113442 Chinese 102-key    https://geekhack.org/index.php?topic=62628.0 https://imgur.com/gallery/ljxUiev (identical to above one)


IBM 4704 Keyboard Protocol
ibm4704.txt:
See the latest version at:
https://github.com/tmk/tmk_keyboard/blob/master/converter/ibm4704_usb/ibm4704.txt


NOTE
Audible Clicker
- With Alps models the converter cannot control clicker at all but you can change sound volume with dial on bottom.
- With capacitive models the converter doesn't support  clicker by default. You will hear beep while startup after plugin but no clicker at all when typing. See this post to enable key click.(2019-07-12)

Alt keys
Both keys next to space bar send identical scan code. You can remap the two keys but always they work as same key. For example, with default keymap both work as Left Alt key.

Not hot-pluggable
Do not plug keyobard into powered converter, you have to plug keyboard before connecting the converter to USB port. The IBM 4704 keyboards should be configured keys one by one every time it startups.


Debug
Use hid_listen to see debug outputs from the converter.

https://www.pjrc.com/teensy/hid_listen.html


Preassembled TMK Converter for IBM4704
You can buy it here.
https://geekhack.org/index.php?topic=72052.0

TMK IBM4704 converter


Precompiled  Firmware
You can use TMK keymap editor to remap keys fortunately.
http://www.tmk-kbd.com/tmk_keyboard/editor/

Use this link for 50-key: https://goo.gl/95HRna

« Last Edit: Wed, 08 July 2020, 20:55:35 by hasu »

Offline E TwentyNine

  • Posts: 884
    • Some of My Keyboards
Re: IBM 4704 Keyboard Converter
« Reply #1 on: Wed, 12 February 2014, 18:56:07 »
Waiting for first post to be filled in.  When it is if this point isn't covered, here's what I must ask:

Did you get this working with the stock controller? 
Daily driver: SSK or Tenkeyless IBM AT
1984 Model M Industrial Prototype ⌨ 1992 Black Oval Industrial SSK ⌨ 1982 5251 Beam Spring ⌨ 89 Key "SSK" ⌨ M13 triplets

Offline JPG

  • Posts: 1124
  • Location: Canada (Beloeil, near Montreal)
  • Model F is my new passion!
Re: IBM 4704 Keyboard Converter
« Reply #2 on: Wed, 12 February 2014, 19:17:48 »
I don't have one of these, but this is so much good news for those that have one!


I already see people bragging about using their Kishsaver!


Great work man!
IBM F122, IBM XT F X2, IBM AT F (all Soarer converted), Filco Camo TKL Browns

Offline dorkvader

  • Posts: 6288
  • Location: Boston area
  • all about the "hack" in "geekhack"
Re: IBM 4704 Keyboard Converter
« Reply #3 on: Thu, 13 February 2014, 19:41:12 »
Awesome! I have another teensy-size project box. I think instead of a panel mount dsub connector, I'll just chop up a serial cable and use that.

Offline Soarer

  • * Moderator
  • Posts: 1918
  • Location: UK
Re: IBM 4704 Keyboard Converter
« Reply #4 on: Fri, 14 February 2014, 17:00:13 »
Hasu succeeded where I failed; his reverse engineering was masterful :D

I've been playing with the protocol as well, following hasu's notes above. The FD command just seems to make the keyboard emit a short beep, presumably so the terminal can emit a BEL code.

The Chinese/Japanese IBMs with vintage Alps use the same protocol, and the same command sequence (FC, 80 .. F6, FF) enables release codes for all keys. Scan codes output are different to the KS for most keys. On powering up, both the 6113442 and the 6112884 send A6 as an ident code.

« Last Edit: Fri, 14 February 2014, 17:32:02 by Soarer »

Offline rindorbrot

  • Posts: 226
  • Location: Germany
Re: IBM 4704 Keyboard Converter
« Reply #5 on: Sat, 15 February 2014, 15:01:46 »
Well, I gotta get myself a Teensy I guess...

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: IBM 4704 Keyboard Converter
« Reply #6 on: Sat, 15 February 2014, 19:24:01 »
Thank you, Soarer. I'll fix my document later.


And...
For those who are interested, my converter has some limitations:
1. Keyboard(6019284) has only *3-byte* key buffer.
2. Keyboard has same scancode on both Alt key. You can't use different scancodes on those.
3. My converter is naively *polling* at not so fast speed.
Due to 1. and 3. you probably will see missing keys and transposing keys at very fast typing.(my wpm is less than 60 and I don't have a problem) To solve or mitigate this problem we can use *interrupt* method instead of polling.

Replacing controller board doesn't have these limitations. It is still very intriguig option to squeeze every last drop of its power out of this keyboard.


EDIT: 1. and 3. are no longer problem as of Mar 2015, see this post.
https://geekhack.org/index.php?topic=54706.msg2638926#msg2638926
« Last Edit: Sun, 15 July 2018, 17:41:23 by hasu »

Offline Soarer

  • * Moderator
  • Posts: 1918
  • Location: UK
Re: IBM 4704 Keyboard Converter
« Reply #7 on: Sun, 16 February 2014, 08:19:38 »
I can also confirm that the 50-key outputs A2 as its ID. (I didn't see it output it on startup, only after sending a reset command (FA) to the keyboard, but that might be because I'm sending commands before it has time to output it).

IDs so far...
A2 = 50-key
A3 = 62-key
A4 = 77-key (unconfirmed)
?? = 107-key
A6 = the vintage Alps CN/JP

The 107-key surely uses this protocol, but we don't know if it uses the same ROM image. It has no ID pads on the PCB -
http://kishy.dyndns.org/?attachment_id=1045 - if it does use the same ROM then the ID would A0, but A5 fits the sequence better!

Not that I would recommend it, but cutting the track to the ID pads ought to make the keyboard output raw matrix position codes rather than scan codes, which would then distinguish between the left and right alt keys.
« Last Edit: Sun, 16 February 2014, 08:23:39 by Soarer »

Offline rindorbrot

  • Posts: 226
  • Location: Germany
Re: IBM 4704 Keyboard Converter
« Reply #8 on: Tue, 18 February 2014, 23:59:25 »
Got my teensy yesterday and now the keyboard is alive. Thanks guys! but the missing scancode for the right alt really is a big loss for me, as I use it very frequently.

But it is definitely a good interim solution until the complete replacement controllers are here.

Offline dorkvader

  • Posts: 6288
  • Location: Boston area
  • all about the "hack" in "geekhack"
Re: IBM 4704 Keyboard Converter
« Reply #9 on: Wed, 19 February 2014, 01:20:54 »
Got my teensy yesterday and now the keyboard is alive. Thanks guys! but the missing scancode for the right alt really is a big loss for me, as I use it very frequently.

But it is definitely a good interim solution until the complete replacement controllers are here.
Unfortunately no HHKB layout model F until the controller project is done.

Offline bcg

  • Posts: 112
Re: IBM 4704 Keyboard Converter
« Reply #10 on: Thu, 20 February 2014, 21:42:44 »
Wow great work hasu!

Do you think this would work with my 3178?  It is like the top one here:



Here's a picture of the guts:



I just a couple Teensy 3.1 boards and was going to see if I could drive the matrix myself using the touch pins ... I'm probably not smart enough to pull it off so this looks great!
:wq!

Offline vivalarevolución

  • Posts: 2146
  • Location: Naptown, Indiana, USA
  • Keep it real b/c any other way is too stressful
Re: IBM 4704 Keyboard Converter
« Reply #11 on: Thu, 27 February 2014, 17:00:44 »
Hey, I'm a little confused about how I should load this onto the teensy.  Are the instructions somewhere in the files in that github link?
Wish I had some gif or quote for this space, but I got nothing

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: IBM 4704 Keyboard Converter
« Reply #12 on: Thu, 27 February 2014, 19:01:20 »
bcg, I don't know much about IBM keyboard models, though, I guess it uses diffrent protocol than 4704. It doesn't seem it is part of 4704 banking system.

prdlm2009, README didn't help you? You won't be able to find more detailed instructions in tmk repository. Maybe you need Googling of AVR and gcc toolchain, I guess.

EDIT: Note that tmk_firmware has also README file in root directory in addition to in each project directories. You need to read both README files.
https://github.com/tmk/tmk_keyboard
https://github.com/tmk/tmk_keyboard/tree/master/converter/ibm4704_usb
« Last Edit: Thu, 27 February 2014, 19:08:56 by hasu »

Offline vivalarevolución

  • Posts: 2146
  • Location: Naptown, Indiana, USA
  • Keep it real b/c any other way is too stressful
Re: IBM 4704 Keyboard Converter
« Reply #13 on: Thu, 27 February 2014, 19:19:08 »
bcg, I don't know much about IBM keyboard models, though, I guess it uses diffrent protocol than 4704. It doesn't seem it is part of 4704 banking system.

prdlm2009, README didn't help you? You won't be able to find more detailed instructions in tmk repository. Maybe you need Googling of AVR and gcc toolchain, I guess.

EDIT: Note that tmk_firmware has also README file in root directory in addition to in each project directories. You need to read both README files.
https://github.com/tmk/tmk_keyboard
https://github.com/tmk/tmk_keyboard/tree/master/converter/ibm4704_usb

Thanks, that's what I needed, I should be able to figure it out with that information.  This is my first time using any of your converter firmware.
Wish I had some gif or quote for this space, but I got nothing

Offline bcg

  • Posts: 112
Re: IBM 4704 Keyboard Converter
« Reply #14 on: Mon, 03 March 2014, 22:30:37 »
bcg, I don't know much about IBM keyboard models, though, I guess it uses diffrent protocol than 4704. It doesn't seem it is part of 4704 banking system.

Thanks hasu, you're probably right.  Guess I've got some hacking to do now :)
:wq!

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: IBM 4704 Keyboard Converter
« Reply #15 on: Sun, 02 November 2014, 21:51:50 »
On Deskthority TMK thread Ellipse and I were working on 107-key keyboard and it kind of work but still iffy and some problems remain. Check it out if your are interested.

http://deskthority.net/workshop-f7/tmk-keyboard-firmware-collection-t4478-90.html#p190725

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: IBM 4704 Keyboard Converter
« Reply #16 on: Mon, 18 May 2015, 11:10:22 »
Recently added keymaps for 77-key and 107-key. Thanks orihalcon.

And protocol handling bug was fixed today, it seems like this solves key stuck and drop problem.
https://github.com/tmk/tmk_keyboard/commit/81137b7a61ef11df023e1f542840a80bfc1ca090

Offline PicklesKill

  • Posts: 76
  • Location: LBC
Re: IBM 4704 Keyboard Converter
« Reply #17 on: Mon, 06 July 2015, 20:04:46 »
With your firmware does it matter what chipset the keyboard is running? I cracked open the 6112884 an my board is running a TI SN74159N. I was under the impression they had the intel 8048 or did I just misread other posts.

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: IBM 4704 Keyboard Converter
« Reply #18 on: Mon, 06 July 2015, 20:13:04 »
No, keyboard controller itself does not matter but keyboard protocol matters.

SN74159N is just one of 74 series IC - demuxer, not controller :D
http://www.ti.com/lit/ds/sdls059/sdls059.pdf

I think you can find other IC package of controller on the board, probably 8048 or compatibles.

Offline PicklesKill

  • Posts: 76
  • Location: LBC
Re: IBM 4704 Keyboard Converter
« Reply #19 on: Mon, 06 July 2015, 20:17:47 »
Awesome thats the same doc I pulled down.

Offline PicklesKill

  • Posts: 76
  • Location: LBC
Re: IBM 4704 Keyboard Converter
« Reply #20 on: Mon, 06 July 2015, 20:30:30 »
PM'd you as well

Offline PicklesKill

  • Posts: 76
  • Location: LBC
Re: IBM 4704 Keyboard Converter
« Reply #21 on: Mon, 06 July 2015, 20:41:21 »
With the Blanks on the 6112884 do you have any recommendations on the best way to go about starting to map those keys? IE. what did you use to find the hex for the original layout. My second question as I have never used a teensy how do you load your code on to that d**n thing.  :D

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: IBM 4704 Keyboard Converter
« Reply #22 on: Mon, 06 July 2015, 20:57:26 »
You can use 6020218 107-key keymap for start and I guess it works also on 6112884 probably. If it does not work or has wrong keymap you will have to change keymap file. I can tell the detail of investigation/debug in that case.

At first you need converter hardware, its wiring is explained in README on github.
https://github.com/tmk/tmk_keyboard/tree/master/converter/ibm4704_usb

Next compile firmware to get binary hex file and load the hex to Teensy.
https://github.com/tmk/tmk_keyboard/blob/master/doc/build.md

As for loading hex to you can find PJRC instruction on their site.

Offline PicklesKill

  • Posts: 76
  • Location: LBC
Re: IBM 4704 Keyboard Converter
« Reply #23 on: Mon, 06 July 2015, 21:17:03 »
Thanks Hasu from what I have seen you and Soarer have done an amazing job of helping everyone on this forum, I really appreciate it.

Offline Coin-op Adjutant

  • Posts: 10
  • Official Toga Llama
Re: IBM 4704 Keyboard Converter
« Reply #24 on: Mon, 27 July 2015, 19:34:45 »
Going to resurrect this thread since I'm having issues with my own converter for a 6112883 keyboard.

I was able to make and load the hex file for the plain layout onto a Teensy.  When I run hid_listen, all the keys respond to presses (there are one or two blanks on the far right cluster that are giving errors, but that's it)...but the keyboard won't actually function in Windows.  No Start Menu search results, no Notepad results, etc...but hid_listen works.

Am I missing some sort of step in this process?
KEYBOARDS OWNED:
CM Storm QuickFire Rapid (MX Blues)  ||  CM Storm QuickFire TK (MX Blues) || Model F XT (Capacitive buckling spring, repaired and spray-painted black) || Leopold FC660C (Topre 45g, white/gray dyesub)

MICE/OTHER PERIPHERALS OWNED:
Logitech G9X (x2)  ||  Razer Deathadder 2013  ||  CM Storm Spawn  ||  Razer Sabertooth  ||  Hori Fighting Stick VX (360/PC)  ||  CM Storm Reaper

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: IBM 4704 Keyboard Converter
« Reply #25 on: Mon, 27 July 2015, 20:04:27 »
The plain keymap is for capacitive switch models, your Alps switch model probably use different scancodes and you need to define keymap for the keyboard.

First, look into scan codes of all keys and make table like below. You'll see scan code on hid_listen when pressing or releasing a key.

Quote

    6019284 62-key:
    ,-----------------------------------------------------------.
    |  `|  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|???|BS |
    |-----------------------------------------------------------|
    |Tab  |  Q|  W|  E|  R|  T|  Y|  U|  I|  O|  P| ¢|  \|  PD2|
    |-----------------------------------------------------------|
    |Ctrl  |  A|  S|  D|  F|  G|  H|  J|  K|  L|  ;|  '| {}| PD3|
    |-----------------------------------------------------------|
    |Shif| <>|  Z|  X|  C|  V|  B|  N|  M|  ,|  ,|  /|???|Shift |
    |-----------------------------------------------------------|
    |Reset|blk|Alt  |         Space             |Alt  |blk|Enter|
    `-----------------------------------------------------------'
    +----------+---------------------+----------+----------+
    |`       00|PD1     04|Caps    20|LShift  30|Reset   31|
    |1       18|q       05|a       21|<>      3E|Rblank  41|
    |2       19|w       06|s       22|z       32|Alt     3F|
    |3       1A|e       13|d       23|x       33|Space   40|
    |4       10|r       14|f       24|c       34|Alt     3F|
    |5       11|t       15|g       25|v       35|Lblank  42|
    |6       12|y       16|h       26|b       36|Enter   2F|
    |7       08|u       17|j       27|n       37|          |
    |8       09|i       01|k       28|m       38|          |
    |9       0A|o       02|l       29|,       39|          |
    |0       0F|p       03|;       2A|.       3A|          |
    |-       1F|¢      1B|'       2B|/       3B|          |
    |=       0D|\       1C|{}      2C|???     3C|          |
    |???     0C|PD2     1D|PD3     2D|RShift  3D|          |
    |BS      0E|          |          |          |          |
    +----------+---------------------+----------+----------+
    Bit7 is 'press flag' which set 1 on press and 0 on release when break code is enabled.

Offline Coin-op Adjutant

  • Posts: 10
  • Official Toga Llama
Re: IBM 4704 Keyboard Converter
« Reply #26 on: Fri, 28 August 2015, 12:44:11 »
So, late response, but I have yet another question, Hasu:

I've been looking through your codes for the keymaps, and I'm wondering if I just overlooked it:  Is there a code for turning off a keyboard's solenoid/beeper?  (The IBM 6112883 has a speaker in it, and while it's cool to have on to show it off, I don't think I could stand to have it on all the time.  It's either this, or I'll need to desolder the blasted thing.)

I did notice "Volume up/down/mute" codes, but those are for media controls, not the keyboard itself, correct?

EDIT:  I can't read the Japanese characters on the keyboard, either, so if there was originally a designated key for doing this, I have no idea.  :x
« Last Edit: Fri, 28 August 2015, 12:46:12 by Coin-op Adjutant »
KEYBOARDS OWNED:
CM Storm QuickFire Rapid (MX Blues)  ||  CM Storm QuickFire TK (MX Blues) || Model F XT (Capacitive buckling spring, repaired and spray-painted black) || Leopold FC660C (Topre 45g, white/gray dyesub)

MICE/OTHER PERIPHERALS OWNED:
Logitech G9X (x2)  ||  Razer Deathadder 2013  ||  CM Storm Spawn  ||  Razer Sabertooth  ||  Hori Fighting Stick VX (360/PC)  ||  CM Storm Reaper

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: IBM 4704 Keyboard Converter
« Reply #27 on: Fri, 28 August 2015, 15:09:58 »
At least my 6019284 stops beep after sending FF at end of initialization. The code is located at enable_break,
() in  matrix.c
https://github.com/tmk/tmk_keyboard/blob/master/converter/ibm4704_usb/ibm4704.txt


Mine has no solenoid. If your keyboard has solenoid I think it has a command. But I don't know that.

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: IBM 4704 Keyboard Converter
« Reply #28 on: Fri, 28 August 2015, 15:14:40 »
Post pics of your keyboard and manual. I can read them for you.


Offline tai

  • Posts: 6
Re: IBM 4704 Keyboard Converter
« Reply #29 on: Fri, 04 September 2015, 15:11:19 »
Thread Res!

I have an IBM 4704 (6112884) version.
I've played around with the firmware, and I've put it on the teensy several times.
I will also dump the break codes below. I get scan codes in hid_listen on keypress for all keys except one of the macro keys.
I'm lost as to how to get this working as a keyboard. Any help from anyone would be super appreciated!

The scan code table will be below as well. They are in the order of how the keyboard is laid out.

Break Codes:
------------------------------------------------
Waiting for new device:...
Listening:
Keyboard ID: A6
Enable break: s00:rFD s01:rFD s02:rFD s03:rFD s04:rFD s05:rFD s06:rFD s07:rFD s08:rFD s09:rFD s0A:rFD s0B:rFD s0C:rFD s0D:rFD s0E:rFD s0F:rFD s10:rFD s11:rFD s12:rFD s13:rFD s14:rFD s15:rFD s16:rFD s17:rFD s18:rFD s19:rFD s1A:rFD s1B:rFD s1C:rFD s1D:rFD s1E:rFD s1F:rFD s20:rFD s21:rFD s22:rFD s23:rFD s24:rFD s25:rFD s26:rFD s27:rFD s28:rFD s29:rFD s2A:rFD s2B:rFD s2C:rFD s2D:rFD s2E:rFD s2F:rFD s30:rFD s31:rFD s32:rFD s33:rFD s34:rFD s35:rFD s36:rFD s37:rFD s38:rFD s39:rFD s3A:rFD s3B:rFD s3C:rFD s3D:rFD s3E:rFD s3F:rFD s40:rFD s41:rFD s42:rFD s43:rFD s44:rFD s45:rFD s46:rFD s47:rFD s48:rFD s49:rFD s4A:rFD s4B:rFD s4C:rFD s4D:rFD s4E:rFD s4F:rFD s50:rFD s51:rFD s52:rFD s53:rFD s54:rFD s55:rFD s56:rFD s57:rFD s58:rFD s59:rFD s5A:rFD s5B:rFD s5C:rFD s5D:rFD s5E:rFD s5F:rFD s60:rFD s61:rFD s62:rFD s63:rFD s64:rFD s65:rFD s66:rFD s67:rFD s68:rFD s69:rFD s6A:rFD s6B:rFD s6C:rFD s6D:rFD s6E:rFD s6F:rFD s70:rFD s71:rFD s72:rFD s73:rFD s74:rFD s75:rFD s76:rFD s77:rFD s78:rFD s79:rFD End
Keyboard start.

--------

Scan Codes:
------------------------------
00 0F 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 44 45 46 43 41 42 4A
10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 54 55 56 50 51 52 5A
20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 64 65 66 60 61 62 6B
30 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 74 75 76 70 71 72 (Error: 7B)
31 47 (BF 3F) 40 4F 48 2F 77 67 57 73 63 53 4E
---------------


-
Tai

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: IBM 4704 Keyboard Converter
« Reply #30 on: Fri, 04 September 2015, 18:08:29 »
hmm, all of 'enable break' commands are not accepted with your keyboard.
For example, this displays that the keyboard responds erroer FD(out of bound) when send the command for scan code '00'.
Code: [Select]
s00:rFD


Those Alps switch models probably work a little differently than cpacitive switch models. My code has depended largely on my 6019284 behaviour and it does not work your keyboard well.

I found Soarer mentioned earlier that your 6112884 accepts 'enable break' commands. You probably have to send 'FC' to start sending the commands.
Quote
The Chinese/Japanese IBMs with vintage Alps use the same protocol, and the same command sequence (FC, 80 .. F6, FF) enables release codes for all keys. Scan codes output are different to the KS for most keys. On powering up, both the 6113442 and the 6112884 send A6 as an ident code.



Try this patch to add 'FC' on top of commands. And this will fix the one bad key(7B).
Code: [Select]
diff --git a/converter/ibm4704_usb/matrix.c b/converter/ibm4704_usb/matrix.c
index 155df9c..5b91d49 100644
--- a/converter/ibm4704_usb/matrix.c
+++ b/converter/ibm4704_usb/matrix.c
@@ -68,8 +68,9 @@ uint8_t matrix_cols(void)
 static void enable_break(void)
 {
     print("Enable break: ");
+    while (ibm4704_send(0xFC)) { _delay_ms(10); }
     // valid scancode: 00-79h
-    for (uint8_t code = 0; code < 0x7A; code++) {
+    for (uint8_t code = 0; code < 0x7F; code++) {
         while (ibm4704_send(0x80|code)) _delay_ms(10);
         _delay_ms(5);   // wait for response
         // No response(FF) when ok, FD when out of bound
« Last Edit: Fri, 04 September 2015, 18:12:03 by hasu »

Offline tai

  • Posts: 6
Re: IBM 4704 Keyboard Converter
« Reply #31 on: Fri, 04 September 2015, 18:44:37 »
Fantastic! We're in business.

The new break codes are as follows:

------
Waiting for new device:...
Listening:
Keyboard ID: A6
Enable break: s00:rFF s01:rFF s02:rFF s03:rFF s04:rFF s05:rFF s06:rFF s07:rFF s08:rFF s09:rFF s0A:rFF s0B:rFF s0C:rFF s0D:rFF s0E:rFF s0F:rFF s10:rFF s11:rFF s12:rFF s13:rFF s14:rFF s15:rFF s16:rFF s17:rFF s18:rFF s19:rFF s1A:rFF s1B:rFF s1C:rFF s1D:rFF s1E:rFF s1F:rFF s20:rFF s21:rFF s22:rFF s23:rFF s24:rFF s25:rFF s26:rFF s27:rFF s28:rFF s29:rFF s2A:rFF s2B:rFF s2C:rFF s2D:rFF s2E:rFF s2F:rFF s30:rFF s31:rFF s32:rFF s33:rFF s34:rFF s35:rFF s36:rFF s37:rFF s38:rFF s39:rFF s3A:rFF s3B:rFF s3C:rFF s3D:rFF s3E:rFF s3F:rFF s40:rFF s41:rFF s42:rFF s43:rFF s44:rFF s45:rFF s46:rFF s47:rFF s48:rFF s49:rFF s4A:rFF s4B:rFF s4C:rFF s4D:rFF s4E:rFF s4F:rFF s50:rFF s51:rFF s52:rFF s53:rFF s54:rFF s55:rFF s56:rFF s57:rFF s58:rFF s59:rFF s5A:rFF s5B:rFF s5C:rFF s5D:rFF s5E:rFF s5F:rFF s60:rFF s61:rFF s62:rFF s63:rFF s64:rFF s65:rFF s66:rFF s67:rFF s68:rFF s69:rFF s6A:rFF s6B:rFF s6C:rFF s6D:rFF s6E:rFF s6F:rFF s70:rFF s71:rFF s72:rFF s73:rFF s74:rFF s75:rFF s76:rFF s77:rFF s78:rFF s79:rFF s7A:rFF s7B:rFF s7C:rFF s7D:rFF s7E:r00 End
Keyboard start.
-----

The scan codes that are actually mapped to keys function properly. Now all I have left is to make a keymap for the 102 layout!!!
Thanks so much Hasu, couldn't have done it without you. I'll also post or PM you a good default 102-key keymap if you'd like to add it to the configs.

--
Tai

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: IBM 4704 Keyboard Converter
« Reply #32 on: Fri, 04 September 2015, 19:01:36 »
Great. Thanks for the report back.

I confirmed that fix works also on my keybaord and pushed the fix to github now.

Offline tai

  • Posts: 6
Re: IBM 4704 Keyboard Converter
« Reply #33 on: Sat, 05 September 2015, 00:39:48 »
Alright, I've run into a few more issues. I've got a keymap, but the keys laid out in keymap_plain (for example) don't line up with the scan code values. For example, here's my keycode config in keymap_common.h

Code: [Select]
#define KEYMAP( \
    K00, K0F, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E,   K44, K45, K46,   K43, K41, K42, K4A, \
    K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D,      K1E,   K54, K55, K56,   K50, K51, K52, K5A, \
    K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D,      K2E,   K64, K65, K66,   K60, K61, K62, K6B, \
    K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D,           K3E,   K74, K75, K76,   K70, K71, K72, K7B, \
    K31, K47, KBF,                 K40,               K4F, K48,                K2F,   K77, K67, K57,   K73, K63, K53, K4E  \
) { \
    { KC_##K00, KC_##K0F, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K44, KC_##K45, KC_##K46, KC_##K43, KC_##K41, KC_##K42, KC_##K4A }, \
    { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K54, KC_##K55, KC_##K56, KC_##K50, KC_##K51, KC_##K52, KC_##K5A }, \
    { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K64, KC_##K65, KC_##K66, KC_##K60, KC_##K61, KC_##K62, KC_##K6B }, \
    { KC_##K30, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K74, KC_##K75, KC_##K76, KC_##K70, KC_##K71, KC_##K72, KC_##K7B }, \
    { KC_##K31, KC_##K47, KC_##KBF,                                                          KC_##K40,               KC_##K4F, KC_##K48,                KC_##K2F,   KC_##K77, KC_##K67, KC_##K57,   KC_##K73, KC_##K63, KC_##K53, KC_##K4E }  \

I have both an 8x16 matrix table and that one right there that matches exactly the keys on the keyboard.

What's weird is that even after I changed the keys in keymap_plain to match that layout, they don't match up. For example, where it should be the "1" key, it's printing the character "u". and where the character should be "2" it's printing "1".

I found that if I changed the key where it would normally say "u" to be "1" (reversing the process), the "1" key does indeed display "1", but that's not what I should be doing to fix this.

Any ideas guys? Any help is appreciated!!

--
Tai


Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: IBM 4704 Keyboard Converter
« Reply #34 on: Sat, 05 September 2015, 04:02:23 »
You have to define keymap macro for your Alps keyboard like definition for 107-key. Note that the latter part of the definition should be an array 16x8(keymap[16][8]) containing sequence of scan codes from KC_##K00 to 7F basically, but use KC_NO for scan codes not used in the frist part. The first part of your definition seems to be correct at a glance.
https://github.com/tmk/tmk_keyboard/blob/master/converter/ibm4704_usb/keymap_common.h#L44-L61

Code: [Select]
/* 107-key */
#define KEYMAP( \
    K46,K64,     K00,K18,K19,K1A,K10,K11,K12,K08,K09,K0A,K0F,K1F,K0D,K0C,K0E,   K6A,K6B,K6C,    K47,K48,K49,K4A, \
    K56,K66,     K04,K05,K06,K13,K14,K15,K16,K17,K01,K02,K03,K1B,K1C,K1D,       K6D,K6E,K6F,    K4B,K4C,K4D,K4E, \
    K71,K77,     K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,K2A,K2B,K2C,K2D,       K70,K65,K72,    K50,K51,K52,K53, \
    K44,K45,     K30,K3E,K32,K33,K34,K35,K36,K37,K38,K39,K3A,K3B,K3C,K3D,       K74,K75,K76,    K5E,K58,K59,K5A, \
    K54,K55,     K31,K41,K3F,        K40,                        K42,K2F,       K78,K67,K79,    K5B,K5C,K5D,K57  \
) { \
    { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_NO    }, \
    { KC_##K08, KC_##K09, KC_##K0A, KC_NO,    KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \
    { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
    { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_NO,    KC_##K1F }, \
    { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \
    { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_NO,    KC_##K2F }, \
    { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37 }, \
    { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F }, \
    { KC_##K40, KC_##K41, KC_##K42, KC_NO,    KC_##K44, KC_##K45, KC_##K46, KC_##K47 }, \
    { KC_##K48, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E, KC_NO    }, \
    { KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
    { KC_##K58, KC_##K59, KC_##K5A, KC_##K5B, KC_##K5C, KC_##K5D, KC_##K5E, KC_NO    }, \
    { KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_##K64, KC_##K65, KC_##K66, KC_##K67 }, \
    { KC_NO,    KC_NO,    KC_##K6A, KC_##K6B, KC_##K6C, KC_##K6D, KC_##K6E, KC_##K6F }, \
    { KC_##K70, KC_##K71, KC_##K72, KC_NO,    KC_##K74, KC_##K75, KC_##K76, KC_##K77 }, \
    { KC_##K78, KC_##K79, KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO    }  \
}

Offline tai

  • Posts: 6
Re: IBM 4704 Keyboard Converter
« Reply #35 on: Sun, 06 September 2015, 13:35:55 »
Alright! It's completely done! Thanks Hasu!

I'll post more stuff later, I actually made a script to make the scan code grid for you, but I have a few little things I want to fix with it first.

Below are the scan code matrix and key layout for the IBM 4704 6112884 (finally!) this may also work  with the CN model, but I'm not sure.

Code: [Select]
#define KEYMAP( \
    K00, K0F, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E,   K44, K45, K46,   K43, K41, K42, K4A, \
    K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D,      K1E,   K54, K55, K56,   K50, K51, K52, K5A, \
    K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D,      K2E,   K64, K65, K66,   K60, K61, K62, K6B, \
    K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D,           K3E,   K74, K75, K76,   K70, K71, K72, K7B, \
    K31, K47, K3F,                 K40,               K4F, K48,                K2F,   K77, K67, K57,   K73, K63, K53, K4E  \
) { \
{ KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
{ KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \
{ KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
{ KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_NO,   }, \
{ KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \
{ KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \
{ KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37 }, \
{ KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F }, \
{ KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_##K47 }, \
{ KC_##K48, KC_NO,    KC_##K4A, KC_NO,    KC_NO,    KC_NO,    KC_##K4E, KC_##K4F }, \
{ KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
{ KC_NO,    KC_NO,    KC_##K5A, KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,   }, \
{ KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_##K66, KC_##K67 }, \
{ KC_NO,    KC_NO,    KC_NO,    KC_##K6B, KC_NO,    KC_NO,    KC_NO,    KC_NO,   }, \
{ KC_##K70, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_##K77 }, \
{ KC_NO,    KC_NO,    KC_NO,    KC_##K7B, KC_NO,    KC_NO,    KC_NO,    KC_NO,   }  \
}


Thanks again to all the help from Hasu, I'll post my actual key layout (it has a mouse!) and the script to automagically make your scan code matrix later today.
Have a fantastic day! Happy Hacking!

--
Tai

Offline PicklesKill

  • Posts: 76
  • Location: LBC
Re: IBM 4704 Keyboard Converter
« Reply #36 on: Sun, 06 September 2015, 13:42:00 »
I'm stoked for you this will make it easier for us allow kids ;D hopefully your hard work pushes more people into picking one up.

Offline tai

  • Posts: 6
Re: IBM 4704 Keyboard Converter
« Reply #37 on: Tue, 15 September 2015, 14:26:15 »
Alright! I want to go a bit farther in this project.
I started thinking about making the keyboard wireless, and I saw that you actually had some bluefruit support in the firmware.

I want to pick up a bluefruit so that I can do the whole bluetooth thing (I wish I could just use RF, but beggars can't be choosers)

Does any significant code need to be modified to get the firmware working with a bluefruit? Or can I just wire it in and go? I have to power it of course.

I saw this article: https://learn.adafruit.com/convert-your-model-m-keyboard-to-bluetooth-with-bluefruit-ez-key-hid/use-it

where someone converted an IBM Model M using your firmware with an arduino micro (gross) and a bluefruit for the bluetooth part, but I didn't quite grock what he changed in the code for that part. Since I already have the working code for the 6112884 is it just plug and play?

Thanks for the help, and I'll keep everyone updated as I receive advice / make changes!

P.S. I also have the RF module from an old membrane keyboard, I don't see how I could get that to work with the current setup though, it has an 8x15 matrix (and the pins for it) on the PCB, but I just wanted to transmit the data through it....oh well..


--
Tai

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: IBM 4704 Keyboard Converter
« Reply #38 on: Tue, 15 September 2015, 21:30:59 »
Including protocol/bluefruit.mk instead of lufa.mk should work basically. Not so tedious job.
But I don't thave the module and haven't maintained it, I'm not sure it works with the latest code base.

BTW, I added keymap of Alps 102-key and update repository!
https://github.com/tmk/tmk_keyboard/commit/dc04983fd7905048c94366bce70f1288b323bfc9

Offline tai

  • Posts: 6
Re: IBM 4704 Keyboard Converter
« Reply #39 on: Tue, 15 September 2015, 22:58:28 »
Oh awesome! Thanks for the mention! It means a lot. I'll pick up a bluefruit soon and play around with it, I'll post the results here of course.

I never expected there to be actual community for old keyboards lmao


--
Tai

Offline __red__

  • Posts: 194
Re: IBM 4704 Keyboard Converter
« Reply #40 on: Sat, 06 February 2016, 00:03:25 »
Quick thread necromancy... anyone modified the code to send the correct (0xFD?) code to the keyboard controller to make the buzzer / bleeper inside buzz/bleep after every keypress?

Offline Dernubenfrieken

  • Posts: 471
  • Location: NJ/NY
Re: IBM 4704 Keyboard Converter
« Reply #41 on: Sat, 06 February 2016, 08:39:20 »
Quick thread necromancy... anyone modified the code to send the correct (0xFD?) code to the keyboard controller to make the buzzer / bleeper inside buzz/bleep after every keypress?

On my 6112884 Japanese 102-key the buzzer worked perfectly
    

Offline __red__

  • Posts: 194
Re: IBM 4704 Keyboard Converter
« Reply #42 on: Sat, 06 February 2016, 09:44:01 »
Quick thread necromancy... anyone modified the code to send the correct (0xFD?) code to the keyboard controller to make the buzzer / bleeper inside buzz/bleep after every keypress?

On my 6112884 Japanese 102-key the buzzer worked perfectly
Do you recall which keyboard / converter you compiled with?

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: IBM 4704 Keyboard Converter
« Reply #43 on: Sat, 06 February 2016, 10:32:38 »
Quick thread necromancy... anyone modified the code to send the correct (0xFD?) code to the keyboard controller to make the buzzer / bleeper inside buzz/bleep after every keypress?

I think Soarer did that and confirmed FD command works on his capacitive model keyboard.
https://geekhack.org/index.php?topic=54706.msg1228052#msg1228052

Vintage Alps models works differently, they emit beep themselves without FD command from converter.

Offline __red__

  • Posts: 194
Re: IBM 4704 Keyboard Converter
« Reply #44 on: Sat, 06 February 2016, 11:14:42 »
Quick thread necromancy... anyone modified the code to send the correct (0xFD?) code to the keyboard controller to make the buzzer / bleeper inside buzz/bleep after every keypress?

I think Soarer did that and confirmed FD command works on his capacitive model keyboard.
https://geekhack.org/index.php?topic=54706.msg1228052#msg1228052

Vintage Alps models works differently, they emit beep themselves without FD command from converter.
I guess I'm looking for the correct location to insert the send function call.

My first attempt was in the initialization section and it beeped a few times.  Last attempt I pot it in the debug util function and it didn't work at all.

I'll work it out eventually...

Offline Red October

  • Posts: 97
Re: IBM 4704 Keyboard Converter
« Reply #45 on: Tue, 09 February 2016, 16:42:39 »
Do forgive me if this is a stupid question; I've been looking over the documentation for a while now but I'm still trying to wrap my head around it; I received my Hasu's Converter today; it's lovely and I'm typing on my 6112884 right now; I'm thrilled to have spherical keycaps like the old VT100 I first used at age 4!  What I'm after now is the ability to re-map the keys.  I know this is something that is possible with this unit but I'm on Windows and I'm no programmer, so I'm afraid a lot of the information is lost on me.  I see that there is a keymap file on github which corresponds to the functions of the keys, and I gather that I'm supposed to be able to make my own version of this and somehow upload it to the microcontroller's RAM, but I simply don't know how to go about doing that.  If someone could be so kind to spell it out for someone who hasn't touched a Unix command prompt for ten years, I'd be quite appreciative. 

I feel that I should say that I'm exceptionally pleased with the converter; the only thing like a complaint I could raise is that the DE9 plug on it has the wrong type of locking screws for the mating connector on the keyboard, but this is easily overcome and shouldn't be anything like a major issue as I intend to put the whole board into a small box to keep it from damage and dust (does it get hot in operation?  Should I put vent holes in the box?)  Also, what is the purpose of the small button on the board?

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: IBM 4704 Keyboard Converter
« Reply #46 on: Tue, 09 February 2016, 22:16:59 »
Read these document if you didn't yet.
https://github.com/tmk/tmk_keyboard/blob/master/tmk_core/doc/build.md
https://github.com/tmk/tmk_keyboard/blob/master/tmk_core/doc/keymap.md

Procedure of remap looks like the below. I'm not usually on Windows, so I may pass by something improtant, though.

1. First, you need to install Toolchain to compile firmware(.hex) file from source code and Programmer app(FLIP) to download firmware into MCU(ATMeaga32u2) on converter.
https://github.com/tmk/tmk_keyboard/blob/master/tmk_core/doc/build.md#1-install-tools

2. Then open Cygwin terminal and compile firmware. You will see firmware file 'ibm4704_usb.hex'.
Quote
$ cd tmk_keyboard/converter/ibm4704_usb
$ make -f Makefile.tmk_rev2 clean
$ make -f Makefile.tmk_rev2

3. Open FLIP to program MCU(ATMega32u2) with the firmware.
Push small button on converter before run FLIP. The button on converter is program button, you have to push it when program it.

I dont think the MCU needs ventilation.

Offline Red October

  • Posts: 97
Re: IBM 4704 Keyboard Converter
« Reply #47 on: Thu, 11 February 2016, 16:42:30 »
Alright, I think I know what I've got to do; I've got all the tools and I've edited the keymap file; I'll post it at the end and hopefully someone with more experience at this than I can tell me if I've stuffed up before I go flashing ROMs or whatever it is that happens when the microcontroller is programmed.  Do I need to hold down the button while it programs or do I just press it once to put it into programming mode? If a single press, do I need to press again to return to normal operation?  Again, sorry if these are stupid questions, but in spite of spending a lifetime around computers, this is the first time I've done something like this.

Anyway, this is what keymap_alps102key.c looks like in the specified directory for me right now:
Code: [Select]
#include "keymap_common.h"


const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    /* Layer 0:
   

  * ,---------------------------------------------------------------.  ,-----------. ,---------------.
   

  * |  `|  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|BS |BS |DEL|  |PSC|SLK|PAU| |F1 |F2 |F3 |F4 |
   

  * |---------------------------------------------------------------|  |-----------| |---------------|
   

  * |Tab  |  Q|  W|  E|  R|  T|  Y|  U|  I|  O|  P|  [|  ]|    \|INS|  |KP7|KP8|KP9| |F5 |F6 |F7 |F8 |
   

  * |---------------------------------------------------------------|  |-----------| |---------------|
   

  * |Ctrl  |  A|  S|  D|  F|  G|  H|  J|  K|  L|  ;|  '|Ret|Ret |CTL|  |KP4|KP5|KP6| |F9 |F10|F11|F12|
   

  * |---------------------------------------------------------------|  |-----------| |---------------|
   

  * |Shift   |  Z|  X|  C|  V|  B|  N|  M|  ,|  ,|  /|Shf|Shift |CAP|  |KP1|KP2|KP3| |HOM|UP |END|PUP|
   

  * |---------------------------------------------------------------|  |-----------| |---------------|
   

  * |Fn0  |Gui|Alt  |         Space             |Alt* |Gui|KPENTER  |  |KP0|000|KP.| |LFT|DWN|RGH|PDN|
   

  * `---------------------------------------------------------------'  `-----------' `---------------'
   

  */
    KEYMAP_ALPS102(
    ESC, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL,

BSPC,BSPC,KC_DELETE,      PSCR,SLCK,PAUS,     F1,  F2,  F3,  F4,  \
    TAB, Q,   W,   E,   R,   T,   Y, 

 U,   I,   O,   P,   LBRC,RBRC,BSLS,     INS,      KC_P7, KC_P8,KC_P9,     F5,  F6,  F7,  F8,  \
   

LCTL,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,GRV, ENT,      KC_RCTL,      KC_P4, KC_P5,

KC_P6,     F9,  F10, F11, F12, \
    LSFT,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,RSFT,RSFT,   

      KC_CAPS,      KC_P1,  KC_P2,  KC_P3,       KC_HOME, KC_UP, KC_END, KC_PGUP, \
    FN0, LGUI,LALT,   

       SPC,                     RALT,RGUI,               KC_PENT,      KC_P0,MACRO( (T)KC_P0, (T)KC_P0,

(T)KC_P0, END),KC_PDOT,     KC_LEFT, KC_DOWN, KC_RIGHT, KC_PGDN  \
    ),

    /* Layer 1:
     *

,---------------------------------------------------------------.  ,-----------. ,---------------.
     *

|  `|  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|BS |BS |F21|  |VoD|VoU|Mut| |F1 |F2 |F3 |F4 |
     *

|---------------------------------------------------------------|  |-----------| |---------------|
     *

|Tab  |  Q|  W|  E|  R|  T|  Y|  U|  I|  O|  P|  [|  ]|    \|F22|  |Ins|Hom|PgU| |F5 |F6 |F7 |F8 |
     *

|---------------------------------------------------------------|  |-----------| |---------------|
     *

|Ctrl  |  A|  S|  D|  F|  G|  H|  J|  K|  L|  ;|  '|Ret|Ret |F23|  |Del|End|PgD| |F9 |F10|F11|F12|
     *

|---------------------------------------------------------------|  |-----------| |---------------|
     *

|Shift   |  Z|  X|  C|  V|  B|  N|  M|  ,|  ,|  /|Shf|Shift |F24|  |   |PgU|   | |F13|F14|F15|F16|
     *

|---------------------------------------------------------------|  |-----------| |---------------|
     *

|Fn0  |Gui|Alt  |         Space             |Alt* |Gui|Fn0      |  |Hom|PgD|End| |F17|F18|F19|F20|
     *

`---------------------------------------------------------------'  `-----------' `---------------'
     

*/
    KEYMAP_ALPS102(
   

TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,     VOLD,VOLU,MUTE,     

TRNS,TRNS,TRNS,TRNS, \
    TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,     

TRNS,     TRNS,TRNS,TRNS,     TRNS,TRNS,TRNS,TRNS, \
   

TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,     TRNS,     TRNS,TRNS,TRNS,     

TRNS,TRNS,TRNS,TRNS, \
    TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,         

TRNS,     TRNS,TRNS,TRNS,     TRNS,TRNS,TRNS,TRNS, \
    TRNS,TRNS,TRNS,          TRNS,                   

 TRNS,TRNS,               TRNS,     TRNS,TRNS,TRNS,      TRNS,TRNS,TRNS,TRNS  \
    ),
};

const uint16_t

PROGMEM fn_actions[] = {
    [0] = ACTION_LAYER_MOMENTARY(1),
};

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: IBM 4704 Keyboard Converter
« Reply #48 on: Thu, 11 February 2016, 18:19:44 »
Yes, you need to push a button just once before programming, pressing the button turns MCU into programming mode. No, you don't need to push the button to return normal mode, it usually works as a keyboard after programming but if not just replug.

'MACRO' doesn't work as you defined, except for it it looks good to me.
Unfortunately no document of 'MACRO' action is located around, you have to learn someone's keymaps or from trial and error.
This is my macro definition in my keymap, for example.
https://github.com/tmk/tmk_keyboard/blob/master/keyboard/hhkb/keymap_hasu.c#L233

You cannot break your hardware with programming mess up keymap, try it at ease!

EDIT:
If you mess up your converter program with this firmware with default keymap to recover it.
* ibm4704_usb_rev2_alps102key.hex (53.5 kB - downloaded 1504 times.)
« Last Edit: Thu, 11 February 2016, 18:30:02 by hasu »

Offline Red October

  • Posts: 97
Re: IBM 4704 Keyboard Converter
« Reply #49 on: Thu, 11 February 2016, 22:16:06 »
Yes, you need to push a button just once before programming, pressing the button turns MCU into programming mode. No, you don't need to push the button to return normal mode, it usually works as a keyboard after programming but if not just replug.

'MACRO' doesn't work as you defined, except for it it looks good to me.
Unfortunately no document of 'MACRO' action is located around, you have to learn someone's keymaps or from trial and error.
This is my macro definition in my keymap, for example.
https://github.com/tmk/tmk_keyboard/blob/master/keyboard/hhkb/keymap_hasu.c#L233

You cannot break your hardware with programming mess up keymap, try it at ease!

EDIT:
If you mess up your converter program with this firmware with default keymap to recover it.
(Attachment Link)

Thank you again for all your help with this;
This:
Quote
You cannot break your hardware with programming mess up keymap, try it at ease!

Reminds me of an old joke about a computer salesman who tells his worrisome client that "Nothing he can enter at the console can harm the system in any way".  The client, re-assured, buys the system.  A few weeks later, the salesman gets a call from the client, saying that he has indeed entered something at the console that damaged the system.  "what was it?"  the salesman asks.  "A can of coke..."