MobileRead Forums

MobileRead Forums (https://www.mobileread.com/forums/index.php)
-   Kindle Developer's Corner (https://www.mobileread.com/forums/forumdisplay.php?f=150)
-   -   [K3] Physical keyboard localization (https://www.mobileread.com/forums/showthread.php?t=119969)

Sir Alex 02-04-2011 04:42 PM

[K3] Hardware keyboard localization
 
Now it's possible to localize physical K3 keyboard. Currently my hack supports Russian layout, but it's easy to map your own characters to hardware keys.

*Installing*. This hack installs as any other hacks. First of all you must install Jailbreak and then this hack.
During installation it places new Booklet to Kindle, creates new keyboard directory at userstore and places keyboard.txt file inti it.
Keyboard.txt has key bindings. It must be in UTF-8 format only!

*How to use* Simply switch layout by pressing Shift+Space

*Simple European mode*
Now it's not needed to switch layout to enter European character like Ě,Š,Č,Ř,Ž etc...
After install, place keyboard_european.txt into keyboard folder and restart Kindle.
Now you can enter Ě by typing Shift+E+E (ie 'EE') to enter ě enter e, Shift+E (ie 'eE'). To enter EE or eE as is, simply do not hold Shift when typing letter.
Currently European key mappings are:
Code:

EE=Ě
SS=Š
CC=Č
RR=Ř
ZZ=Ž
YY=Ý
AA=Á
II=Í
UU=Ú
TT=Ť
DD=Ď
NN=Ň
LL=Ĺ
oO=ó
eE=ě
sS=š
cC=č
rR=ř
zZ=ž
yY=ý
aA=á
iI=í
uU=ú
tT=ť
dD=ď
nN=ň
lL=ĺ

*Links*
update_physkeyb_0.04.zip

Sir Alex 02-07-2011 06:37 AM

New veresion 0.02 released:
+ Added support for "Keyboard and 24h time format hack"
+ Added new Russian layout
* Key combination changed from ALT+SPACE to ALT+. due to conflict with Audio player.

janvanmaar 02-07-2011 07:54 PM

I have mapped the central European characters instead of the default Russian ones and it works very well! Thanks!
While it is very useful already, I was wondering whether it could be possible to induce the special characters by pressing a combination of keys rather than by entering a new layout mode. For example, AA+Q could write the character that is currently written by Q in the new layout mode, AA+q could write the character that is currently written by q in the new layout mode etc.
The reason for this is that while switching a layout completely is certainly preferable for different alphabets, one usually needs to mix the ASCII latin characters with special characters derived from latin in majority of other European languages - which requires permanently switching the layout there and back with the current implementation...

Sir Alex 02-09-2011 09:58 AM

New veresion 0.03 released:
+ Added support for 3.1 firmware
* ALT+. changed to Shift+Space due to conflict with new 3.1 firmware
*Notice*
To preserve your version of keyboard.txt - backup it before upgrade version and restore after.

Tiersten 02-09-2011 11:20 AM

Quote:

Originally Posted by Sir Alex (Post 1386305)
+ Added support for 3.1 firmware

Is this with the keyfile swap?

Sir Alex 02-09-2011 11:30 AM

Quote:

Originally Posted by Tiersten (Post 1386444)
Is this with the keyfile swap?

yes. I mean compatibility with 3.1 framework internals (API).

Tiersten 02-09-2011 11:32 AM

Quote:

Originally Posted by Sir Alex (Post 1386464)
yes. I mean compatibility with 3.1 framework internals (API).

Ahh. I was just wondering if you'd found a simple workaround :)

dsmid 02-11-2011 02:37 AM

Quote:

Originally Posted by janvanmaar (Post 1383409)
While it is very useful already, I was wondering whether it could be possible to induce the special characters by pressing a combination of keys rather than by entering a new layout mode. For example, AA+Q could write the character that is currently written by Q in the new layout mode...

The problem is, that AA is not a modifier key, it has its meaning alone.
I don't think there are any unoccupied modifier keys left.
I think that the problem could be addressed by adding special option to the keyboard.txt file (say "auto_switch_back = true").
Once this option is activated, physkeyb would switch the keyboard layout back to the original one after typing single letter.

The main drawback of this hack is that it doesn't work in the browser. That limits its usage to making notes and entering search strings.
It's nice though that it can happily coexist with keybru and launchpad.

Sir Alex 02-11-2011 03:35 AM

Quote:

Originally Posted by dsmid (Post 1389393)
The main drawback of this hack is that it doesn't work in the browser. That limits its usage to making notes and entering search strings.

It's works! Try press SYM in browser whe you need enter text.

dsmid 02-11-2011 04:59 AM

Quote:

Originally Posted by Sir Alex (Post 1389444)
It's works! Try press SYM in browser whe you need enter text.

Perfect ! Thanks for the hint.

Do you think it would be possible to implement the 'auto_switch_back' feature I mentioned earlier ?
That would make your hack unbeatable.
What about implementation like this:

Code:

...
        autoSwitchBack = new File("/mnt/us/keyboard/autoSwitchBack").exists();
...
            if (!keyboardEN && trans.containsKey(string)) {
                keyevent.setKeyChar(((String) trans.get(string)).charAt(0));
                cont.MyLog("Translated to: " + keyevent.getKeyChar());
                if (autoSwitchBack) {
                        keyboardEN = !keyboardEN;
                        cont.MyLog("Keyboard auto-switched: " + keyboardEN);
                }
            }
...


Thanks for making all the hacks that make my life much easier.

janvanmaar 02-11-2011 05:37 AM

Quote:

The problem is, that AA is not a modifier key, it has its meaning alone.
I don't think there are any unoccupied modifier keys left.
True, however, there certainly are ways to make non-modifier keys behave as modifier keys (for instance, kiterm hack does this - although it is true that the code is rather complex). So for instance Shift+Space would switch to a mode when Aa act as a modifier and another Shift+Space returns back to usual functionality. Of course, how difficult to implement would that be is another question.

Quote:

I think that the problem could be addressed by adding special option to the keyboard.txt file (say "auto_switch_back = true").
Once this option is activated, physkeyb would switch the keyboard layout back to the original one after typing single letter.
Yes, that might be useful too.

Another possibility which can be used with the current hack as it is:
Disabling the mapping of lowercase characters (removing them from the txt file) and remapping capitals to special lowercase characters (with diacritics etc). That way, one can type the special lowercase characters by Shift+character in the new layout mode while he has to switch back to the original layout when capital letters are needed. Special capital characters may be still typed through Alt+Sym (using the previous localization hack of Sir Alex). Not ideal but I find it useful.

Sir Alex 02-12-2011 05:40 AM

New version available: 0.04
+ Added special simple mode for European characters

Now it's not needed to switch layout to enter European character like Ě,Š,Č,Ř,Ž etc...
After install, place keyboard_european.txt into keyboard folder and restart Kindle.
Now you can enter Ě by typing Shift+E+E (ie 'EE') to enter ě enter e, Shift+E (ie 'eE'). To enter EE or eE as is, simply do not hold Shift when typing letter.
Currently European key mappings are:
Code:

EE=Ě
SS=Š
CC=Č
RR=Ř
ZZ=Ž
YY=Ý
AA=Á
II=Í
UU=Ú
TT=Ť
DD=Ď
NN=Ň
LL=Ĺ
oO=ó
eE=ě
sS=š
cC=č
rR=ř
zZ=ž
yY=ý
aA=á
iI=í
uU=ú
tT=ť
dD=ď
nN=ň
lL=ĺ


janvanmaar 02-12-2011 04:07 PM

Just perfect! Thanks a lot!

dsmid 02-12-2011 05:01 PM

Yes, it's nearly perfect now.

I don't like playing with the Shift key so I created my own keyboard_european.txt and assigned keys as follows:
Code:

ss=š
SS=Š

The logic behind this is, that if you want an unaccented letter, you press the key once and if you want an accented letter you make a double-keypress.

However, the problem is that now you can't type words like book or www. No matter how long you wait before entering the second letter, you still get an accented character.
How complicated would be to implement a waiting timeout ?
I can try to code it myself if you'd be so kind and send me the source code.
Whatever suits you best.

dsmid 02-22-2011 10:48 AM

1 Attachment(s)
If anybody's interested, I've implemented the double-keypress timeout feature. Linked archive contains Czech/Slovak keyboard layout as displayed below.
Now Kindle is able to tell single-keypress from double-keypress and generate different character for both.
That's what works the best for me.


All times are GMT -4. The time now is 09:59 PM.

Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.