- Note -
You'll probably need to know your way around a hex editor and be able to read basic C in order to make much use of this post. That's the breaks right now. Someone else might decide to make a friendly GUI to wrap things, but right now, this program isn't particularly user friendly.
If, however, you know your way around C, then you might be interested in this post. Feel free to read on if not, though don't expect a lot of help if you're not fluent in the basic prerequisites here, as this project is very much in its early stages.
Incorrect usage of this program can easily crash your phone. Please be sure to read and understand the entire posting before deciding to actually try the program out.
--
I have written a program, keypadpatch.exe, that will patch the microp keyboard tables in the stock Verizon xv6850 keyboard driver. Unlike normal keyboard remapping programs, you can create your own Fn+key combinations on keys where there were previously none. This was important for me as there are a lot of keys on the RAPH500 keyboard without Fn+key combinations, and the keyboard was missing quick access to important keys like semicolon or underscore.
The keyboard layout patcher program will modify the key definition tables in device.exe's instance of keypad.dll. The modifications are done in RAM, so they don't persist across boots. (You could re-run the patching sequence automatically at every boot to make your changes stick if you wish, once you are comfortable with a modified key definition set.) The main advantage of this is that if you happen to break something in the keyboard driver while developing a new set of key definitions, you'll just need to reboot the phone to get things back to normal as opposed to perhaps having to hard reset the device and replace a hex edited driver dll.
The keyboard layout patcher program hardcodes offsets that are specific to the xv6850 keyboard driver. Please don't try it on any other device or firmware combination other than the initial stock Verizon firmware for the RAPH500. Running keypadpatch.exe on any other device or ROM image will likely crash the phone (likely fixable by rebooting it).
The program itself is fairly rough around the edges and developing a new full key definition set is likely not for the faint of heart. Please don't ask me directly for help with making a key definition set.
The program operates in two modes. The first mode will attempt to dump out the currently active key definition array from the running keyboard driver and save it into a file called "microp" (no extension). The file will be placed in the directory within which keypadpatch.exe resides. You will get a confirmation message box if everything works in this mode of operation.
The second mode of operation will read a key definition set file called "microp" from the directory within which keypadpatch.exe resides, and then replace the key defintion array in the keyboard driver's memory image with the one from the key definition set file. If everything works, you won't see any message boxes or any other confirmation. However, if something failed, then you'll either get an appropriate error message, or if you gave keypadpatch.exe a sufficiently invalid microp file, something will probably have crashed. Use carefully at your own peril!
If there is a "microp" file in the directory where keypadpatch.exe resides, the program runs in the second mode of operation (loading a new key definition set). Otherwise, it runs in the first mode of operation (dumping the current key definition set).
Modifying a key definition set involves popping a "microp" file open in a hex editor and twiddling fields by hand right now. There is no friendly program or GUI to make things easier than that.
For the RAPH500, the key definition set is an array of 0x3A elements, each of which is described by the following structure layout:
Code:
#define MICROP_KEY_FLAG_VIRTUAL_KEY ( 0x80000000 )
typedef struct _MICROP_KEY_DEFINITION
{
//
// Virtual keys for primary button press.
//
// { MappedVK, IMEVK, RepeatVK }
//
ULONG VirtualKey[ 3 ];
//
// Secondary characters for function combinations. Set the
// MICROP_KEY_FLAG_VIRTUAL_KEY bit to indicate that the value is actually
// a virtual key code and not a character code.
//
// { Fn + key, 123-mode key, ... }
//
ULONG FunctionChar[ 11 ];
///
// Unknown.
//
ULONG KeyId[ 2 ];
//
// Callbacks to execute when the key is pressed instead of simply inserting
// a key or character code into the input stream. The addresses should be
// valid code within device.exe.
//
// [ 0 ] - Not for Fn- combos.
// [ 1 ] - ??
// [ 2 ] - Not for Fn-combos.
// [ 3 ] - ??
//
ULONG_PTR Callbacks[ 4 ];
} MICROP_KEY_DEFINITION, * PMICROP_KEY_DEFINITION;
Many of the fields of this structure don't currently have a known meaning attached to them. If you figure out what they do, perhaps through disassembly or debugging, or simply trying them out and seeing what happens, I'd appreciate it if you'd post back in this thread.
The fields that do have a particularly relevant meaning are:
- VirtualKey[0], VirtualKey[1]: These need to be set to the virtual key code (VK_* constant) for the virtual key event to generate then the particular physical key is pressed. Usually, the first two VK values are the same, but in some cases (the enter key, for example), they differ. The file \Windows\eT9.Raphael.wwe.kmap.txt may have some clues as to VK-codes for special keys on the RAPH500 (i.e. the "launch tmail.exe key"). Note that VK-codes for numeric keys (0-9) and alphabetical keys (A-Z) are simply the ASCII values for those characters (alphabetical keys always use uppercase characters). See the above link on VK_* constants for more details.
- FunctionChar[0] is the character value (not virtual key code) to generate when a particular physical key is pressed when the Fn-key is active. Normally, this value is simply the raw character code in question (e.g. 0x20 for space, 0x41 for capital A, 0x21 for !). However, if bit 0x80000000 is set, then this value appears to be treated as a virtual key code and not a character code. Using a VK-sequence might be useful if you wanted to map an Fn-key combo to, for example, soft key 1 or soft key 2. Using a character value might be useful if you want to map an Fn-key combo to, for example, semicolon. The keyboard driver takes care of injecting any necessary shift states to make a given character value appear when you provide a raw character value here. For example, setting FunctionChar[0] to 0x21 for a particular key will cause a VK_SHIFT + VK_1 key down / key up sequence to be sent to generate a ! character.
- The last four fields, "Callbacks", desire a little bit of special mention. These are function pointers into device.exe's address space for callbacks that get invoked when a key is pressed. This is how the dedicated "launch tmail.exe" key, and the Fn-Space combo to launch CommManager.exe work on the RAPH500. Setting a particular value to NULL means that the key will be injected into the normal input system instead of being handled by a function call. As a special exemption, keypadpatch.exe accepts the magical value of 0xFFFFFFFF for a particular callback pointer to mean that the currently active callback pointer in device.exe memory space should be left alone. Any other value replaces the active callback pointer in device.exe. You will generally never want to touch this value except to NULL it out for a key that you'd like to reclaim from one of those hardcoded built in shortcut keys.
As I haven't discerned all the meanings of the fields in the key definition structure, there may be additional capabilities (or limitations) here. I've only so far attempted to perform simple tasks like create an Fn-key mapping on the Z key to generate a ' character, where there was no mapping before. It is possible that some special keys might have additional hardcoded handling elsewhere in the keyboard driver and thus might not necessarily be overridable with this method.
Some of the keys in the stock key definition set don't appear to be used for the RAPH500's physical keyboard. For example, there is a "tab" key lurking, despite there being no physical key which uses that definition slot.
Download link for keypadpatch.exe + some example key definition files, one for the stock RAPH500 layout and one that maps Fn-A to -, Fn-S to ", Fn-z to ' in the start of porting something similar to the TITA100 layout to the RAPH500:
http://www.nynaeve.net/Skywing/xv6850/keypadpatch.zip
Acknowledgements:
cmonex provided some invaluable assistance with getting the ball rolling on this project.
- Reserved for future updates. -
Posted a slightly modified key definition set: http://www.nynaeve.net/Skywing/xv6850/keys2008120301.zip.
This key definition set makes the following changes:
Code:
Key New function Old function
=======================================
Fn+Z Left soft key Unassigned
Fn+X Right soft key Unassigned
Fn+S Underscore (_) Unassigned
Fn+D Tab Unassigned
Fn+C Semicolon (;) Unassigned
Mail OK/done Start tmail
Fn+Mail Ctrl* Start tmail
(* Key combinations marked with a * may not be fully working yet.)
Thanks skywing!
This worked great for me, the _underscore_ was especially needed.
Anything else you want me to test? gps?
I'm off work for 5 days in a row so I can play with the phone without too much fear...
_________________
VZW TP - XV6850
I'm still fiddling around with this, I'll probably work on some simple tools tonight to help translate the keymap files to/from a more human-readable format.
/Andrew
kilozebra said:
I'm still fiddling around with this, I'll probably work on some simple tools tonight to help translate the keymap files to/from a more human-readable format.
/Andrew
Click to expand...
Click to collapse
Note that the position in the key definition array isn't what controls what physical keys map to which key definiton slots. That seems to be controlled by the first value in the array (first VK identifier), according to basic tests. Let me know if you discover something more definitive about that, though.
Would this tool work to remap the keys if applied on a non-Verizon CDMA ROM? I'm especially looking into putting Alltel MR1 ROM release on my Verizon TP and fixing the keyboard after that.
TIA
Related
I've never edited a registry before so I'm a bit timid to move forward without assurance here. Quick question:
When implementing the hack mentioned here:
SMS Notification Hack
http://forum.xda-developers.com/showthread.php?t=357306
Do I create a new key and type the strings in it or should I be able to find an existing key?
I can't find an existing key in HKLM|Software|Microsoft|Inbox|Settings....which, btw, doesn't make sense to me because how else would the OS get the instructions to put that annoying message on the screen in the first place?----it's acting as though there's currently a key somewhere that says "HKLM|Software|Microsoft|Inbox|Settings|SMSNoSentMs g = 0"
Thanks
I may have dragged on a bit in my post. All I need here is a two word answer:
new key or old key
Thanks
If you have followed that path of keys in the registry editor of your choice:
HKLM -> Software -> Microsoft -> Inbox -> Settings
and there is no value named SMSNoSentMsg then you must create it as a new value of the type string.
I can understand why it does not make sense to you that the value would not exist but many programs will use a default behavior if there is not a registry entry to define the behavior.
I think you are also confusing the term key and value. They are not interchangeable terms when talking about the registry and if you are not confusing them then you are looking for the wrong thing. If you think of them in terms of Windows Explorer or MyComputer then a key is similar to a folder and a value is similar to a file that exists in that folder. In regedit you will penetrate through keys to get to values.
I hope that helps more than it confuses.
Ks.
ive always had to create both the settings key and the SMSNoSentMsg entry
Hi ,
I have written a small application:
http://rapidshare.com/files/125258935/HebKeys_tog198.CAB.html
This application is designed for window mobile 6 devices that has a numeric keyboard,
one of the problems with this type of devices is that there isn't language support for them, for example if you want to write sms in hebrew or russion using this keyboard it is impossible.
After installing this application a XML file (layout.xml) will be coppied to your device containning all the translation of the keyboard. (this xml is configure to HP 600 !!! it will not work on other devices)
The xml file contains group of hardware keys (for example):
<keys>
<HWcode>48</HWcode>
<state1>0</state1>
<state2>ך</state2>
<state3>ן</state3>
<state4>ף</state4>
</keys>
in this example hardware key 48 will contain the following signs: 0-zero, "ך" - hebrew sign, "ן" - another hebrew sign, "ף" and another hebrew sign.
clicking on hardware key 48 (0 in the hardware keyboard of the hp 600) will itirate between does "states".
This application will run in the background, for toggeling it's translation use your Voice button (key 198) or configure it to different button:
<tog>
<HWcode>198</HWcode>
</tog>
you can of course configure yourself the signes and hardware keys to mach your device.
I written another application in order to help you find what is the hardware code for every key in your device:
http://rapidshare.com/files/125091730/KeyMap_13.zip.html
this two applications will not run together, so make sure you are closing one before running the other (SR is also agood idea).
Pls backup all your data before installing the applications.
link to the original thread (hebrew):
http://www.pocketpcfreak.com/cgi-bin/yabb/YaBB.cgi?board=Himalaya;action=display;num=1214408412
have fun
Rani
HW keyboard working on 3rd party apps in Dual
Great news to those using Touch Dual with 20keys and are fustrated with the HW keyboard typing only numbers on 3rd party apps (like Opera, Google Search etc.) - this HebKeys app by Golum can provide a reasonable solution.
Limitations:
- No XT9.
- No Shift or Capital letters.
- No symbol window access (SYM is not active).
- Long delay is required in words that have two consequent letters mapped to the same key (e.g. REad, because R and E are on the same key). Alternatively, if an unmapped key is pressed (SYM), you can re-press the key again and get the next letter.
BTW, Golum promised to provide an update with an option to update the value of this delay through an xml file.
How to install:
1. download the HebKeys app by Golum, from http://rapidshare.com/files/125260462/HebKeys_button198.CAB.html
2. download the following key mapping layout that I have created: http://www.4shared.com/file/52928436...55/layout.html
3. after installing the app, replace the layout.xml file in the app folder (under Program Files) with the layout.xml file that you downloaded in 2.
Now what you need is to run the installed app and the re-mapping is done (need to re-run it after soft-reset).
If you run the app after it was activated, you can stop it using the "Exit" button. BTW, it is possible that the link above by Golum is for a slightly different version than the one in the link I provided, in which the default when running the app is the "unmapped keyboard" and there's no option to exit (no Exit button). Golum? I personally prefer the one with the Exit option.
If you wish to play with the mapping layout, you can edit the XML yourself. It is quite readable. Notice you cannot put less than 4 options (representing 4 repeating presses) to each key.
The last key mapped is for toggling the mapping on and off (the app is still in the background). Default is the ALT key.
The mapping of the HW keys of the 20key Dual is as follows (in the order it appears on the keyboard):
81 49 50 51 79
65 52 53 54 76
90 55 56 57 8
236 119 48 120 13
If you have a different device, you can try the key mapping app in the link from my previous post, to get the mapping.
Regarding Hebrew:
The layout file that I have provided solves the keyboard problem, but replaces the Hebrew support in the original layout included with the HebKeys app. However, I found that if you have Eyron Hebrew support installed, when the HebKeys is activated and you switch to Hebrew in the Eyron soft keyboard you can use the keyboard to write Hebrew!
If you think you managed to improve it, added the Shift or Sym functionality etc. - please share with all.
Enjoy.
Update:
Please note that I have updated the layout.xml a little, so if you already downloaded it - please re-download and re-copy to the proper folder.
If you really insist to know why I udpdated:
I found out the key I used for space is actually &NBSP, which seems like a space but is not exactly a space.
For some reason putting merely a space character in the XML does not work (not recognized, probably removed by the XML interpreter), so I added a NULL character afterwards, to turn it into a significant space.
Great App, seems to be the most awaited fix for the XDA Stealth keypad. Thanks GOLUM.
- Long delay is required in words that have two consequent letters mapped to the same key (e.g. REad, because R and E are on the same key). Alternatively, if an unmapped key is pressed (SYM), you can re-press the key again and get the next letter.
BTW, Golum promised to provide an update with an option to update the value of this delay through an xml file.
Click to expand...
Click to collapse
Is it possible to use the joystick or navigation pad (right) to be able to move the cursor right away to type the next character? I used to do this on my Nokia days before.
and by the way, is there anyway to do a toogle with this one for enabling and disabling? i mean there would be a toggle that would enable this and use your configured XML as the layout then a toggle OFF to use the default or original keyboard layout. That would be awesome!
The cursor key may not be the greatest idea, as it also functions to move the curser around. It depends on the application - in some it will give you exactly what you want, in others it will move away from the location of the next word.
An alternative option is to use an unmapped key or one that is mapped to nothing, as I explained (I use SYM).
Reg toggle - as explained in the posts the last key in the layout.xml is the toggle key definition. Default is ALT.
Please note that I have updated the layout.xml a little.
If you really insist to know why I udpdated:
I found out the key I used for space is actually &NBSP, which seems like a space but is not exactly a space.
For some reason putting merely a space character in the XML does not work (not recognized, probably removed by the XML interpreter), so I added a NULL character afterwards, to turn it into a significant space.
can u provide this too on xda stealth?
Space
I cannot make a space?
HOw should I write it in text editor?
Pls Help!
space
"space" works with "0"-button, without <HWcode>48</HWcode>... in layout.xml
suggestion
tried this on my stealth, with the Layout.xml file changed to a regular eng to replace the multitap on my stealth, so far it's working fine with the exception of only 4 characters assignment on each hardware keys.. Can the maker or someone set the assignment to 5 char per key so we can accomodate the letters and number for 7 and 9..
WOW AWESOME!!
it is working properly on my stealth..
now i can write a message faster than before..
Thanks a Lot GOLUM
hopefully it can 5 char/key on the next release..
can someone plz upload the layout file for the touch dual again?
tnx
I need to make a slight alteration to the S740 qwerty keyboard mapping.
I thought all I needed to do was tweak a layout file such as eT9.Rose.0409.kmap.txt in \windows but a 0409 file is not present although there are others with a different 4 digit code for other languages, such as 0408 and wwe. I have tweaked these two without success so I presume they are not the right ones.
HKLM/Software/Tegic/eT9/IME/KeyboardLayouFiles points to 0408 and wwe kmap files.
Can anyone help?
I only changed eT9.Rose.wwe.kmap.txt and it worked just fine after reboot.
Nigel Park said:
HKLM/Software/Tegic/eT9/IME/KeyboardLayouFiles points to 0408 and wwe kmap files.
Click to expand...
Click to collapse
Active layout is in HKLM/Software/Tegic/eT9/IME/KeyboardLayouDlls - it is only key 07FF there. Open it - the string names active layout you should remap. Or - if you already did with some other file, simply put its name there...
Thank you. It worked ..... but only for normal character keys.
I also tried to remap the arrow left key (which unhelpfully defaults to comm manager when I want to move cursor left) without success. There seems to be some extra code for action keys such as arrows and delete eg. // LEFT - 0x25 = VK_LEFT. Do I need to make some changes here?
Funny, never noticed that Fn+Left Arrow calls CommManager... (it took me some time to find out, what's you're talking about...)
Anyway, try this format:
{0x25 0x25 0x25 0x25 0x00 0xff}
The bolded position is responsible for Fn+Left Arrow behaviour. I did no try, it would be nice to know, if helped.
What's strange, other 0x00 values using 0xff index eg. Right Arrow, doesn't anything... Some ghost in the machine?
Generally, it's simple:
{1 2 3 4 5 6} means
1 - HW indentifier of the key
2 - which character/0x function to write/perform, if pressed
3 - what to do, if pressed and hold
4 - what to do, if Fn is active and the key is pressed
5 - what to do, if in numeric mode (double Fn lock)
6 - key index (apparently splits alphabet off special characters/functional keys)
What you see on any row after // are just comments/explanations having no influence on functionality of the file. There you'll find descriptions of all fuctions values as in the piece you quoted - eg. Backspace is 0x08, 0x2E is Delete etc.
Thanks lelopet for trying to help.
I have tried 0x25 in positions 4 and 5 and both (with reboot each time) with no success.
I now full understand how all this works but these action keys must work differently.
Any more ideas?
No...
Basically these files are working similar to some switchboard between the keyboard driver (usually .dll) and character and command sets of the operation system. If something is hardcoded somewhere beneath (as in driver) I'm afraid it is no way how to change it. If the driver calls any system service BEFORE it reaches the mapping...
Hi all
I have an issue with an app I am writing. It has the working name VNCHID, and is designed to allow an Android phone/tab to be used as a keyboard and mouse for a computer (or other device) over VNC. I currently have it in a semi-working state, but with unpredictable results. I am hoping someone can help with the issues I have come accross.
The first is related to mapping KeyEvents to VNC (X11) KeySyms. I have derived a class from KeyEvent wrich adds a method "getKeySym". This method does the following:
Uses the getUnicodeCharacter method from KeyEvent to try to determine a character from the key (combination). If one exists, it uses a map (found elsewhere) to translate this into a KeySym.
Does the same again, but without modifier keys. This may be unnecessary, but for now I have left it in.
Assuming the above fails, it uses getKeyCode and runs this through my own map to generate a KeySym.
The problem I am facing on my development device, an A10-based tablet running CM9, is that if a key is pressed which doesn't have a unicode character associated with it, like backspace, the code just stops at getUnicodeCharacter. It doesn't crash the app, throw an exception, or anything else, the execution of the routine just stops completely. It will still pick up other keyevents afterwards.
This seems very strange, and I do not know why it would do so.
My second problem is on my day-to-day phone. I tried installing the app on here to see if the problem was with the device/ROM/etc, but on here it doesn't even detect any keyevents. I have done some research which indicates that my approach (implementing OnKeyListener) is not guaranteed to work with soft keyboards, but it seems very strange that it (almost) does on one device but not on another (using the same soft keyboard, hackers keyboard).
I am now almost at the stage of creating my own keyboard (not an IME, just a layout to be shown in the app with a keyboard), but would like to avoid this. Can anyone help? I am tearing my hair out. Does anyone know the correct way to receive keyevents from a soft keyboard? I do not want an edittext, I just want the raw key events.
The code for my getKeySym() method is bellow. It stops at the first getUnicodeCharacter() call when a non-character key is pressed:
Code:
// Test unicode
Log.i("VNCHID.VKE","Translating keyevent to keysym");
int keysym=0, ucc=0;
ucc=this.getUnicodeChar(this.getMetaState());
Log.i("VNCHID.VKE","Got ucc");
if( ucc > 0 ) {
keysym = UnicodeToKeysym.translate(ucc);
}
if( keysym > 0 ) {
Log.i("VNCHID.VKE", "Got keysym "+keysym+" from ucc "+ucc);
return keysym;
}
// Test unicode without modifiers
ucc=this.getUnicodeChar(0);
if( ucc > 0 ) {
keysym = UnicodeToKeysym.translate(ucc);
}
if( keysym > 0 ) {
Log.i("VNCHID.VKE", "Got keysym "+keysym+" from ucc wom "+ucc);
return keysym;
}
Log.i("VNCHID.VKE","Could not find keysym from ucc, trying from keycode");
// Otherwise lookup from KeyCode
if( KCSM.size() < 1 ) generateKeyCodeSymMap();
/*KCSM.
if( KCSM.containsKey(this.getKeyCode()) ) return KCSM.get(this.getKeyCode());
*/
keysym=KCSM.get(this.getKeyCode(), -1);
Log.i("VNCHID.VKE","Result of lookup by keycode "+this.getKeyCode()+" is "+keysym);
return keysym;
Note it was much simpler, but I have expanded it and inserted the Log calls for debugging. As an example, when backspace is pressed I receive log lines from my onKey method, plus the first one in this method (Translating keyevent to keysym) but nothing after that.
Please help!
Hi
Is this the right forum to be asking questions like this? I'm not trying to be pushy, it's just I've come to expect quick, helpful answers on this site, so I just wanted to double check.
If so... Bump
If not, could someone please point me towards the appropriate forum?
Sent from my MB860 using xda premium
Hi!
I developed a custom input (using /dev/uniput) to input remote characters to the device. On Nexus 7, soft-keyboard is not shown if the uinput devices registers that it handles QWERTY keys. If I register just keys 0 - 9, than the soft keyboard is shown and in addition to that, I can "inject' keys 0 - 9. If I register additional keys (QWERTY), the soft keyboard is not shown anymore.
This is a problem since most accented characters can not be input otherwise (like €, Ç, Â, etc) - they can be, if the soft keyboard is present.
Is there perhaps a "registration switch" of some sort to tell android-platform to leave the soft-keyboard appearing when user input is required (i.e. on EditText focus)? I'm using low-level ioctl commands to create and configure /dev/uinput. The same code works without problems on SGSII with CM10, for instance (i.e. the soft keyboard is shown even though the custom input device is registered).
Kind regards,
Miha.