Tuesday, January 22, 2013

Keeping up with the keys.

While I've done next to nothing since my last blog entry, Slug over at Engine12 has been busy cranking out openwrt jffs release candidates at a furious pace.  And he seems to have a fairly clear vision of precisely how to properly utilize the zipit keyboard.  Since I'm far too lazy to clarify my own blurry vision, I've been attempting to guide him ever so slightly, so as not to completely destroy what little work I've done along with Dronz towards a unified zipit keymap incorporating the Latin 15 character set.

So far I've given up the volume keys on the side of the zipit for use as global controls for the headphone and speaker volume, as well as dimmers for the LCD and keyboard backlight.  I've always wanted direct access to those functions, and the volume keys are difficult to reach with your thumbs, so this plan seemed as good as anything I'd have come up with.  Probably better.  Now I just have to build a new ebindkeys executable for IZ2S to support this.

Meanwhile some of the other keys have changed their meanings slightly in order to homogenize the usage conventions in the various SDL apps currently popular in the openwrt distro.  Slug has some preliminary documentation in text form.  But I need pictures so I grabbed the latest zipit keymap pdf file, converted it to png and started editing so I could keep track of the changes and eventually incorporate them into the IZ2S keymap when it all starts to stabilize.  Here's what I have so far.
I've been using the Windows XP version of paint to update this.  So far I've added the scan codes using the Courier New Bold font, and updated some of the key definitions in various sizes of Ariel Bold.  I've also recolored some of the squares to make room for the new key settings.  It's now got the Latin characters and dead key accents from dronz's IZ2S keymap and the names of the scripts in /usr/local/sbin called by slug's ebindkeys setup.  There's currently a conflict between the F5 key and the tilde dead key accent on ctrl-shift-T, but I see there's an open spot on the N button for the tilde dead key.  According to wikipedia the tilde originally was the letter N, so maybe that's a reasonable match?

 Feel free to add any of the many of the bits I've left out so far.

As a small bonus, all of this keyboard work got me inspired to attempt a fix for the sticky alt key problem in SDL.  The one weird symptom of this problem was SDL reporting the alt key as a left alt key instead of altgr, or even right alt.  So I hacked SDL_keyboard.c and SDL_fbevents.c to force any alt key to be an altgr, despite whatever the console says it is.  It should be fine on the zipit because the one and only alt key must be an altgr if we want to use the red labels on the keyboard buttons.  Anyhow, the hack seems to make the SDL unicode translator pick the correct key mapping based on the altgr modifier.    I need to do some more work to make the sticky part work and then perhaps add compose key support, but at least now I shouldn't have to switch to a non-stick keymap just to run an SDL program.  So that's a small win.

Still needs lots of testing to make sure I didn't break something else.


The patch is here.

The original keymap diagram pdf is here.


  1. I hope that my empiric work is not vain, at least it works and frees some keys for who wants them.

  2. ...and here are the keymap files, before all is an updated z2_kbd.zip file in the goodibag.

  3. Thanks. I will update the image above with your changes. Can you describe the small bug in pspmaps with the ctrl-shift-a key combo? I'd like to see if I can fix that before I attempt to fix the sticky keys in the SDL lib.

  4. In pspmaps'edition, Ctrl+Shift+a adds a weird square char before the acute accented char. Other keys have no problem.

  5. Another little issue I found with pspmaps is that we must have 'next' and 'prior' mapped to a pair of keys without modifier (shift,...) to have a working zoom.

  6. I think that's an easy fix. I just need to add cases for SDLK_HOME and SDLK_END to pspmaps.c to do the exact same thing as SDLK_PAGEUP and SDLK_PAGEDOWN. Then recompile pspmaps. HOME and END are unshifted on slugs keymap so it should work. Also I'll apply slugs patch to put zoom on the comma and period keys. But I'll do all this when I feel like slugs keymap has stabilized. Meanwhile, leave the current key bindings on the volume keys.