Author Topic: Keyboard Mod  (Read 6358 times)

greguu

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 455
    • View Profile
    • http://github.com/greguu
Keyboard Mod
« on: April 08, 2018, 11:25:26 pm »
Interesting keyboard Mod. The howto is for Android but can be done also for other platforms.

Source : https://egg.5ch.net/test/read.cgi/notepc/1520308917/750

Google Translate :
Quote
Changing the key mapping on Android
Because it is a file rewrite in the / system partition, you need root privilege as a prerequisite.
There is a definition file in / system / usr / keylayout and / system / usr / keychars.
If you simply replace the key, rewrite the keylayout and restart it OK.
In my case, because I want to replace ". ↑, ← ↓" in the bottom two columns with US array, I need to create the following 5 lines of Generic.kl

key 51 COMMA
key 52 PERIOD
key 103 DPAD_UP
key 105 DPAD_LEFT
key 108 DPAD_DOWN

Rewrite as follows.

key 51 DPAD_LEFT
key 52 COMMA
key 103 PERIOD
key 105 DPAD_DOWN
key 108 DPAD_UP

It will become such an arrangement if restarted. comfortable.
https://imgur.com/a/ufief

I do not have it so I do not know what the definition file of the Japanese keyboard is.
IME on / off code should be different for IME.
In Droid 4 + ATOK, it assigns GRAVE and switches with one SYM key.
Since Gemini does not have a good key, I plan to go with the default Alt + Space.

Photo:

[img]https://i.imgur.com/3IPpmKt.jpg\" border=\"0\" class=\"linked-image\" /]
Gemini-PDA (Sailfish X and Android) / LG Nexus 5 (Android 11) / Nokia N9 (MeeGo/Harmattan)
Sharp Zaurus C3100 (Borzoi) - Void Linux (voidz) Kernel 5.0.0 - Hardware (Buffalo CF LAN, DLink 660 CF WiFi, ASIX AX88772 USB Ethernet)

Varti

  • Administrator
  • Hero Member
  • *****
  • Posts: 1279
    • View Profile
Keyboard Mod
« Reply #1 on: April 09, 2018, 05:26:39 am »
Thanks for sharing. So basically they have rearranged the keys in this way (key -> place):

question mark -> up
up -> down
down -> left and
left -> question mark.

Interesting mod, it reminds me of the cursor keys layout over the 5, 6, 7 and 8 keys on the ZX Spectrum (yes, I'm old  ). The above instructions of the fixes in Generic.kl are also useful for any type of key remapping.

Varti
Planet Gemini PDA WiFi/LTE with Mediatek x27
SL-C1000 running Arch Linux ARM May2017, K30225 Wi-Fi CF Card, 64GB SDXC card
and many other Zauruses!

jakfish

  • Sr. Member
  • ****
  • Posts: 394
    • View Profile
Keyboard Mod
« Reply #2 on: July 10, 2018, 10:22:57 am »
I'm pondering this mod. I do feel the comma is misplaced, though I'm not certain I want the Up arrow on the same row as the rest of the arrows. Might be too much of a jumble.

Anybody else rearranged their physical keys, or considered it?

gidds

  • Sr. Member
  • ****
  • Posts: 324
    • View Profile
Keyboard Mod
« Reply #3 on: July 10, 2018, 03:39:16 pm »
Quote from: Varti
it reminds me of the cursor keys layout over the 5, 6, 7 and 8 keys on the ZX Spectrum (yes, I'm old  ).
It's also like the key mappings in the vi/vim editor (H, J, K, L = ←, ↓, ↑, →).  Which are apparently based on arrows printed on those keytops on the terminal Bill Joy was using when he wrote it.

(And that predates the Spectrum by a few years!  Though I didn't get to use it until many years later; our first computer was a ZX81.  After that we got a BBC Micro — now that was an amazing machine!  [Half-hour reminiscence redacted])
   Andy/
Psion 3a → Psion 5 → Psion 5mx → Gemini → Astro

abliss

  • Newbie
  • *
  • Posts: 32
    • View Profile
Keyboard Mod
« Reply #4 on: August 29, 2018, 10:08:41 pm »
Quote from: gidds
Quote from: Varti
it reminds me of the cursor keys layout over the 5, 6, 7 and 8 keys on the ZX Spectrum (yes, I'm old  ).
It's also like the key mappings in the vi/vim editor (H, J, K, L = ←, ↓, ↑, →).  Which are apparently based on arrows printed on those keytops on the terminal Bill Joy was using when he wrote it.

(And that predates the Spectrum by a few years!  Though I didn't get to use it until many years later; our first computer was a ZX81.  After that we got a BBC Micro — now that was an amazing machine!  [Half-hour reminiscence redacted])

I've been tweaking my Generic.kl for weeks trying to find the best layout. My problem is that I really want to change Capslock to Ctrl and right shift to z (for dvorak) and I can't seem to make it happen. Has anyone had any luck with those? Or does it require a kernel change?

abliss

  • Newbie
  • *
  • Posts: 32
    • View Profile
Keyboard Mod
« Reply #5 on: September 05, 2018, 11:56:03 pm »
Quote from: abliss
Quote from: gidds
Quote from: Varti
it reminds me of the cursor keys layout over the 5, 6, 7 and 8 keys on the ZX Spectrum (yes, I'm old :) ).
It's also like the key mappings in the vi/vim editor (H, J, K, L = ←, ↓, ↑, →).  Which are apparently based on arrows printed on those keytops on the terminal Bill Joy was using when he wrote it.

(And that predates the Spectrum by a few years!  Though I didn't get to use it until many years later; our first computer was a ZX81.  After that we got a BBC Micro — now that was an amazing machine!  [Half-hour reminiscence redacted])

I've been tweaking my Generic.kl for weeks trying to find the best layout. My problem is that I really want to change Capslock to Ctrl and right shift to z (for dvorak) and I can't seem to make it happen. Has anyone had any luck with those? Or does it require a kernel change?
Good news, I've been able to (a) switch Tab/Caps and Control, and (b) turn the right-hand Shift key into a "normal" (mappable, character) key! The necessary changes to this file were pretty obvious: https://github.com/zevv/gemini-android-kern...23/aw9523_key.c and the instructions to build and flash a new bootimage were very clear and easy to follow: https://github.com/zevv/gemini-android-kern...aster/README.md

Thanks zevv!

edit: in order for my changes to Generic.kcm and Generic.kl to fully take effect, I found I had to delete /system/priv-app/GeminiInputDevices and /vendor/operator/app/Gemini_Keyboard, and also /system/usr/keychars/Virtual.kcm. And even then, I can only change the "fn" key mapping for some of the keys, not others.
« Last Edit: September 06, 2018, 11:14:44 pm by abliss »

abliss

  • Newbie
  • *
  • Posts: 32
    • View Profile
Keyboard Mod
« Reply #6 on: September 08, 2018, 10:15:23 pm »
Okay, I'm at my wit's end. Has anyone managed to get a non-qwerty layout to work properly with ctrl and fn?

Some keys have fn-chords with behavior, like play, volume, brightness. And some keys have ctrl-chords with behavior, like ctrl-c for copy and ctrl-v for paste.

As far as I can see, both of these are implemented atop the android key codes, not the mapped characters. So KEY_V, while it may be emitted from any of the physical key switches (via kernel patch and/or kl file), and may have any different physical label on the keycap, and may be mapped to another character for typing (via kcm file), is still the key you use with ctrl for paste, and the key you use with fn for volume-up.

But some keyboards, like dvorak, have the volume-up label on a different keycap than the letter V. No amount of messing with the kernel scancode map, or the kcm character map, or the kl keylayout, seems able to rectify this. It seems I need to make a change somewhere in android's input layer, and Planet hasn't released the source for their build (have they?).

For example, I'm guessing they may have added code here:
https://android.googlesource.com/platform/f...nager.java#2660
to take the screenshot only when KEYCODE_R is pressed. But on the dvorak layout, the key that takes a screenshot is P. So they must be using kcm to tell android that KEY R has base: 'p'. But then you won't be able to use ctrl-c/ctrl-v for copy/paste.  And indeed, on my device with dvorak keycaps, it doesn't work (I can either have the fn keys work or the ctrl keys work, but not both.)

The same problem should apply to AZERTY users. Are you able to use ctrl-a for select all in gmail or chrome? Are you able to use ctrl-w to close a chrome tab? It seems impossible to support this while also supporting fn-A for MEDIA_PLAY_PAUSE and fn-Z for MEDIA_PREVIOUS, as is painted on the keycaps.

Any pointers would be much appreciated.
« Last Edit: September 08, 2018, 10:43:32 pm by abliss »