Author Topic: Truly-Ergonomicís keycodes remapping  (Read 16038 times)

0 Members and 2 Guests are viewing this topic.

Offline addwyn

  • Thread Starter
  • Posts: 26
  • Location: Brest, France.
Truly-Ergonomicís keycodes remapping
« on: Sun, 06 January 2013, 11:32:28 »
Thanks to the recent opportunity to update the firmware of the Truly-Ergonomic keyboard, we can now begin to make personal remappings.  ;D

In the 209 firmware, I noticed that there is two tables of internal keycodes. These two tables are visible, for example, at the end of the TrulyErgonomic_209_v2.121127.hex file.
Keycodes from address 05AE to address 063D are used when DIP swith #2 is ON (Windows / Linux).
Keycodes from address 063E to address 06CD are used when DIP swith #2 is OFF (Mac OS).

I tried to change some Keycodes (Backspace to home raw (instead of Tab), Enter up (instead of Backspace), CTRL in the middle (instead of Enter), and some others) and it works fine:p Great ! (I only needed a simple formula in OpenOffice.org-Calc to recalculate the checksum-byte of each changed firmwareís HEX file linesÖ)

11306-0

This can make us to quietly wait for the arrival of the Truly-Ergonomicís programing softwareÖ
« Last Edit: Sun, 13 January 2013, 19:07:06 by addwyn »

Offline Burz

  • Posts: 337
  • maybe get a blister on yo' little finger...
Re: Truly-Ergonomicís keycodes remapping
« Reply #1 on: Mon, 07 January 2013, 11:08:36 »
Good find!

What is the formula to do the checksum? And how do you tell which codes correspond to which keys-- Is it based on a standard that you can link to?
Matias Mini QuietPro  \\ Dell AT101W - Black ALPS  \\ SIIG MiniTouch x2 White XM - Monterey  \\ Colemak layout.

Offline addwyn

  • Thread Starter
  • Posts: 26
  • Location: Brest, France.
Re: Truly-Ergonomicís keycodes remapping
« Reply #2 on: Mon, 07 January 2013, 12:35:04 »
Here is the OpenOffice.org-Calc file that calculate the lineís checksum

* TrulyErgonomic_209_Keycodes.ods (15.38 kB - downloaded 181 times.)

The codes are standard HID Keycodes (plus some "internal private" keycodes as, for exemple, the DF code which correspond to the [Fn] key that is used internally by the firmware but is never transmitted to the host ):
http://fr.scribd.com/doc/46294537/USB-HID-Translation-Code
Update:
The document with the HID keycodes can be downloaded from microsoft directly (no need for scribd pro account). http://download.microsoft.com/download/1/6/1/161ba512-40e2-4cc9-843a-923143f3456c/translate.pdf

The relevant numbers are in the third column, named HID USage ID.

For exemple, if you want the Right-Ctrl to become a Return key, you search for the Right-Ctrl and Return keycode in the HID doc (these codes are E4 and 28). Then your search for the E4 code in the Truly-Ergonomic keycodes (keycodes have white background in my OpenOffice.org file) and you put '28' instead of the original 'E4' code. The new checksum is then calculated for the modified line. When all your changes are done, you copy-paste the complete lines (with the new checksum) in the Truly-Ergonomic HEX file, over the original lines. Then, you can update the Truly-Ergonomic firmware using your personal HEX fileÖ  ;)

Be very carefull to NOT change any other line of the firmware HEX file BUT ONLY the 18 lines of keycodes !!!
And DO NOT change the nine first characters of each keycodesíline !



(Please, be indulgent with my poor English)
« Last Edit: Sat, 16 March 2013, 21:04:21 by addwyn »

Offline Tracer

  • Posts: 108
Re: Truly-Ergonomicís keycodes remapping
« Reply #3 on: Tue, 08 January 2013, 12:01:35 »
You are my Hero.

Thank you for doing something I was too lazy to do! :)

Off to try out the new goodness to permanently remap some keys.

P.T.

Offline Tracer

  • Posts: 108
Re: Truly-Ergonomicís keycodes remapping
« Reply #4 on: Tue, 08 January 2013, 12:56:10 »
Well ****.
I was trying to get the lower left and right international keys to work as control keys.
First attempt failed, but everything else worked.
Second attempt bricked the keyboard.
Shows up as unknown device and the firmware tool does nothing.

Any suggestions before I try to get this thing RMAed with TE?

Update:
Wow. Did a diff on the original firmware. Managed to delete 10 random lines from the file. Yay accidental VIM key mash apparently.
« Last Edit: Tue, 08 January 2013, 13:04:43 by Tracer »

Offline nomaded

  • Posts: 101
  • Location: Andover, MA
Re: Truly-Ergonomicís keycodes remapping
« Reply #5 on: Tue, 08 January 2013, 16:39:01 »
Well ****.
I was trying to get the lower left and right international keys to work as control keys.
First attempt failed, but everything else worked.
Second attempt bricked the keyboard.
Shows up as unknown device and the firmware tool does nothing.

Any suggestions before I try to get this thing RMAed with TE?

Update:
Wow. Did a diff on the original firmware. Managed to delete 10 random lines from the file. Yay accidental VIM key mash apparently.

Were you able to get the firmware to reflash to the bricked TECK?
Dvorak | TECK 209 (browns) | ErgoDox fullhand (clears) w/Penumbra | ErgoDox classic (on order) | TouchStream ST
Logitech Cordless Optical Trackman
Current Dvorak-based ErgoDox layout | Current Dvorak-based TECK layout

Offline Tracer

  • Posts: 108
Re: Truly-Ergonomicís keycodes remapping
« Reply #6 on: Tue, 08 January 2013, 17:20:34 »
I was at work so I didn't want to waste any more time.

I'm at home now. I've downloaded the SDK from Megawin.
The controller in this keyboard is a MG84FL54BD.
http://www.megawin.com.tw/megawin_EN/ProductShow.asp?ID=175

Took the keyboard apart to find this out. Sadly, no SPI interface leads and it's a surface mount chip so lifting the serial IO is beyond my skill. Going to see what I can do with the SDK.

Offline nomaded

  • Posts: 101
  • Location: Andover, MA
Re: Truly-Ergonomicís keycodes remapping
« Reply #7 on: Tue, 08 January 2013, 17:22:43 »
I wonder if it's worth taking the effort to try to remap all the keys into a Dvorak layout. I'm not seeing an obvious pattern with a quick glance at the hex file and the USB HID chart.
Dvorak | TECK 209 (browns) | ErgoDox fullhand (clears) w/Penumbra | ErgoDox classic (on order) | TouchStream ST
Logitech Cordless Optical Trackman
Current Dvorak-based ErgoDox layout | Current Dvorak-based TECK layout

Offline Tracer

  • Posts: 108
Re: Truly-Ergonomicís keycodes remapping
« Reply #8 on: Tue, 08 January 2013, 17:47:32 »
It's time consuming but not that hard.
My error was just brain fart stupid.

I've confirmed that both SPI and basic serial interfaces are not wired into anything. This most likely means that I need someone with surface mount soldering gear to wire in a 2 wire interface so I can re-program this thing.

Offline addwyn

  • Thread Starter
  • Posts: 26
  • Location: Brest, France.
Re: Truly-Ergonomic’s keycodes remapping
« Reply #9 on: Tue, 08 January 2013, 18:45:52 »
Second attempt bricked the keyboard.

:-(


Any suggestions before I try to get this thing RMAed with TE?

I  saw in the Megawin SDK doc that if the chip is Reset (RST-pin high) while the power is NOT interrupted, then it may restart in ISP mode (In System Programming) if the default Megawin ISP program is used in the chip's ISP memory. There is a (little) chance that Truly-Ergonomic used the default ISP program... MAY BE, it could be the way to by-pass the erroneous firmware and to be able to reflash a correct Firmware. I don't know....

« Last Edit: Thu, 10 January 2013, 11:16:45 by addwyn »

Offline Tracer

  • Posts: 108
Re: Truly-Ergonomicís keycodes remapping
« Reply #10 on: Tue, 08 January 2013, 19:12:10 »
:-(

I  saw in the Megawin SDK doc that if the chip is Reset (RST-pin high) while the power is NOT interrupted, then it may restart in ISP mode (In System Programming) if the default Megawin ISP program is used in the chip's ISP memory. There is a (little) chance that Truly-Ergonomic used the default ISP program... MAY BE, it could be the way to by-pass the erroneous firmware and to be able to reflash a correct Firmware. I don't know....

Actually there is a very good chance. Their DFU programming software is the same as the one supplied in the SDK ,except with their logo slapped onto it. I'll try this out now.
Thanks.

Offline Tracer

  • Posts: 108
Re: Truly-Ergonomicís keycodes remapping
« Reply #11 on: Tue, 08 January 2013, 19:26:40 »
:-(

I  saw in the Megawin SDK doc that if the chip is Reset (RST-pin high) while the power is NOT interrupted, then it may restart in ISP mode (In System Programming) if the default Megawin ISP program is used in the chip's ISP memory. There is a (little) chance that Truly-Ergonomic used the default ISP program... MAY BE, it could be the way to by-pass the erroneous firmware and to be able to reflash a correct Firmware. I don't know....

Yup. Shorting pin 1 (3.3v) with 36 reset the device as an SPI device. Stock firmware update tool worked. THANK YOU!

Also. My ability to read technical documentation is apparently poor as this was rather clear in the docs.

I owe you beer.
« Last Edit: Tue, 08 January 2013, 19:29:34 by Tracer »

Offline Tracer

  • Posts: 108
Re: Truly-Ergonomicís keycodes remapping
« Reply #12 on: Tue, 08 January 2013, 19:31:41 »
So now that I've resurrected my keyboard, on to re-programming this thing.
So I'm assuming that the bottom left and right international keys are 87 and 88. The thing is, those codes show up twice in the firmware.

Any ideas?


Offline Tracer

  • Posts: 108
Re: Truly-Ergonomicís keycodes remapping
« Reply #13 on: Tue, 08 January 2013, 19:41:22 »
For anyone interested, this is what the IC Controller looks like. Also, filthy keyboard.

Offline addwyn

  • Thread Starter
  • Posts: 26
  • Location: Brest, France.
Re: Truly-Ergonomicís keycodes remapping
« Reply #14 on: Tue, 08 January 2013, 20:06:35 »
Wow! You managed to inter-connect pins of such a microscopic thing !!!! Very good job  :cool:

I have no idea why there is two 87 and 88 codes in the Windows/Linux keycodes...
I suppose that the lower right and left buttons correspond to the keycode's positions that already have Ctrl codes (E0 E4) at the same position in the MacOS keycodes (because TE doc say that extrem left and right lower keys are Ctrl keys when DIP switch #2 is Off).

(is my poor English understandable ?)

« Last Edit: Wed, 09 January 2013, 03:48:09 by addwyn »

Offline Tracer

  • Posts: 108
Re: Truly-Ergonomicís keycodes remapping
« Reply #15 on: Wed, 09 January 2013, 07:23:27 »
Wow! You managed to inter-connect pins of such a microscopic thing !!!! Very good job  :cool:

Pine 1 and 36 are at the end of the package so they aren't that hard to short. But yes, :cool: for sure.

I have no idea why there is two 87 and 88 codes in the Windows/Linux keycodes...
I suppose that the lower right and left buttons correspond to the keycode's positions that already have Ctrl codes (E0 E4) at the same position in the MacOS keycodes (because TE doc say that extrem left and right lower keys are Ctrl keys when DIP switch #2 is Off).

Will play around with this later. I ran out of steam last night. Not going to try this again at work either!

(is my poor English understandable ?)

No problem at all.

Offline addwyn

  • Thread Starter
  • Posts: 26
  • Location: Brest, France.
Re: Truly-Ergonomic’s keycodes remapping
« Reply #16 on: Wed, 09 January 2013, 08:00:32 »
Shorting pin 1 (3.3v) with 36 reset the device as an SPI device.

This shows too that it would not have been difficult for TE to integrate a Reset push-button that would have done the same short, without requiring the opening of the housing. ;-)

« Last Edit: Thu, 10 January 2013, 11:17:07 by addwyn »

Offline Tracer

  • Posts: 108
Re: Truly-Ergonomicís keycodes remapping
« Reply #17 on: Wed, 09 January 2013, 08:42:42 »
Or provided the most basic leads for a two wire interface which is standard on a lot of electronics with firmware. Almost every router I've ever used has a two wire interface just beneath one of the ethernet jacks so you can salvage a bad flash.

Offline Tracer

  • Posts: 108
Re: Truly-Ergonomicís keycodes remapping
« Reply #18 on: Wed, 09 January 2013, 08:47:34 »
Here is the firmware file I ended up with: * TrulyErgonomic_209_mod.hex (18.25 kB - downloaded 57 times.)
Left Shift -> Tab
Right Shift -> Enter
Left Control -> Left Shift
Right Control -> Right Shift
Left International -> Left Control
Right International -> Right Control

Offline addwyn

  • Thread Starter
  • Posts: 26
  • Location: Brest, France.
Re: Truly-Ergonomicís keycodes remapping
« Reply #19 on: Wed, 09 January 2013, 09:13:47 »
Left Shift -> Tab
Right Shift -> Enter
Left Control -> Left Shift
Right Control -> Right Shift
Left International -> Left Control
Right International -> Right Control

Did you make these changes in the Windows/Linux AND MacOS keycodes groups ?


Offline Tracer

  • Posts: 108
Re: Truly-Ergonomicís keycodes remapping
« Reply #20 on: Wed, 09 January 2013, 09:17:57 »
Just Windows/Linux. Did not touch Mac.

Offline Gerk

  • Posts: 781
Re: Truly-Ergonomicís keycodes remapping
« Reply #21 on: Thu, 10 January 2013, 07:59:59 »
So in other words ... TE just took the basic firmware provided and slapped their logo into it.  Why am I not surprised.
Rosewill RK-9000RE (reds) | Das Keyboard Model S Professional Silent (browns) | Leopold TKL (browns) | F21-7D "Mechanical Keyboard" (Blue Alps) | TE 109 (reds) | Filco Majestouch TKL (blues) | Goldtouch V2 x 2

Offline Tracer

  • Posts: 108
Re: Truly-Ergonomicís keycodes remapping
« Reply #22 on: Thu, 10 January 2013, 11:54:19 »
So in other words ... TE just took the basic firmware provided and slapped their logo into it.  Why am I not surprised.

Not at all.
TE took the basic firmware remapping software and just slapped their logo on it.
The firmware itself is mostly custom. The SDK provides a default firmware, but that is for basic IO. The chip inside the board is a generic programmable IC. The HID implementation is all theirs, hence why the problems with the keyboard.

I've been talking to others more knowledgeable about HID implementations on #geekhack and will be taking a crack at my own implementation for firmware now that I know where to go. No promises on where I'll get and how fast I'll get there.

Also, sell me your keyboard already :)

Offline addwyn

  • Thread Starter
  • Posts: 26
  • Location: Brest, France.
Re: Truly-Ergonomicís keycodes remapping
« Reply #23 on: Sat, 02 February 2013, 13:51:47 »
Has anyone tried similar changes in the keycodes of a model 207 Truly Ergonomic keyboard ? Did it work fine too ?

Offline Azteca

  • Posts: 22
Re: Truly-Ergonomicís keycodes remapping
« Reply #24 on: Sat, 02 February 2013, 19:13:49 »
For anyone interested, this is what the IC Controller looks like.

Yup. Shorting pin 1 (3.3v) with 36 reset the device as an SPI device. Stock firmware update tool worked.


Wonder if you can show in your image which are pin1 and pin36 as all corners look alike :cool:

For how long you have to short these? (less than 1 sec or around 5 secs). I presume the keyboard has to be plugged while shorting?

Last, are terminals without clear paint or need to sand (scratch) to make contact.

Tks  :D

Offline oneproduct

  • Posts: 1057
  • Location: Montreal, Canada
  • @Ubisoft
Re: Truly-Ergonomicís keycodes remapping
« Reply #25 on: Sat, 02 February 2013, 21:07:56 »
I just did this with a 104 model and it worked perfectly. Since I never intend to use it with a Mac, I set the first set of 9 lines to Colemak layout and the second set of 9 lines to QWERTY layout. By flipping DIP switch #2 I can go between the two layouts now. :)
Filco Tenkeyless | Realforce Tenkeyless Variable Silent | Truly Ergonomic | Kinesis Contoured Advantage | IBM Model M SSK | Cherry G80-3600LYC | TG3 w/ trackpad | CM Storm QuickFire Rapid | Ducky Shine II | Ergodox
Kensington Slimblade | RollerMouse Free2 | Logitech M570 | Logitech G500 | Evoluent Vertical Mouse 3
Colemak

Offline addwyn

  • Thread Starter
  • Posts: 26
  • Location: Brest, France.
Re: Truly-Ergonomicís keycodes remapping
« Reply #26 on: Sun, 03 February 2013, 09:25:24 »
Wonder if you can show in your image which are pin1 and pin36 as all corners look alike

Pin 1 and pin 36 are the upper pins of each side of the chip when the round angle mark is at the top left.
12882-0

For how long you have to short these? (less than 1 sec or around 5 secs). I presume the keyboard has to be plugged while shorting?
Much less than a millisecond is sufficient.
Yes. Keyboard Has to be plugged (powered) while shorting.

All of this is only necessary if your keyboard is bricked ! Otherwise, simply toggle OFF the DIP switch #5 to allows firmware to be reprogrammedÖ

« Last Edit: Sun, 03 February 2013, 11:24:33 by addwyn »

Offline tekkendama

  • Posts: 4
Re: Truly-Ergonomicís keycodes remapping
« Reply #27 on: Thu, 07 February 2013, 20:10:37 »
hi, guys, amazing work.

if my capslock key acts a delete key can I do something to turn it back into a capslock key?  I think that's what Tracer is doing with the chips but I am not sure.

And what about the AppsKey? Is that the 5D on the last row of Windows/Linux keycodes?

Thanks a lot for any response. All of this is like ancient hyrulian to me but it's starting to make sense. Davkol mentioned Arduino in another thread and I've been looking that up and suddenly chips don't seem that scary anymore.

Offline SubGothius

  • Posts: 82
  • Location: Tucson, AZ USA
    • HTDoctor.com
Re: Truly-Ergonomicís keycodes remapping
« Reply #28 on: Mon, 11 February 2013, 21:57:00 »
Huzzah! I just remapped my TECK 207 firmware! :cool: Thanks so much for this guide and the checksum spreadsheet, addwyn.

FWIW, I moved the {[ and ]} keys to the opposite (left) end of their row, put '" and \| at the right end where [{ ]} used to be, and moved /? down where '" used to be. This puts /? and \| in their standard QWERTY locations, and '" is now only one key away (one row up) from standard. I also swapped Tab and Backspace, so now Backspace is adjacent to Delete (where I kept expecting it to be), and I expect this will help reduce inadvertent Tab strikes as well. I've attached my modified .hex file here in case anyone with a model 207 wants to try this remap.

* TrulyErgonomic_207-remap_v2.121127.hex (18.25 kB - downloaded 42 times.)
"In theory there's no difference between theory and practice, but in practice there is." -Jan L.A. van de Snepscheut

Offline ☠☠☠

  • Posts: 5
    • Neo Layout - German Ergonomic Keyboard Layout
Re: Truly-Ergonomicís keycodes remapping
« Reply #29 on: Wed, 13 February 2013, 17:23:43 »
Thank you very much.

By the way: The document with the HID keycodes can be downloaded from microsoft directly (no need for scribd pro account). http://download.microsoft.com/download/1/6/1/161ba512-40e2-4cc9-843a-923143f3456c/translate.pdf

The relevant numbers are in the third column, named HID Usage ID.


Or if you want to have it even easier, just execute this command in a linux terminal:

Code: [Select]
su -c "while true; do od --read-bytes=144 --width=144 -x /dev/input/event3 | awk 'NF > 1 { print \$12 }'; done"

This will print the USB HID ID number of every key pressed. See http://superuser.com/questions/550858/how-to-get-usb-hid-id-of-keyboard-keys/552026 for a detailed explanation.
« Last Edit: Sun, 17 February 2013, 12:59:29 by ☠☠☠ »