Bluetooth Keyboard and custom key and character mapping - Desire General

Some custom ROMs, which are not based on HTC roms, but compiled form Android Source support the Bluetooth HID profile, thus support well known and common normal Bluetooth keyboards.
I've tested Cyanogenmod and OpenDesire.
However, I was unsatisfied with the keyboard layout. I've found no key for return, needed some special 'Umlaute' for my German layout, etc.
Here's what I've found to fix all this:
1. Description what can be changed:
Android Open Source Project: Keymaps and Keyboard Input
Until now I don't know the internal differences between the key map and character map files. Sure, both look different, both can and must be changed for different reasons. The key map if you want to change actions and also alter phone buttons, the character map for modifying the full layout. But with the key map you could also alter parts of the layout, so it's not that clear for me. However.
2. Altering Key Map Layout
If you don't specify a keylayout file, Android will default to /system/usr/keylayout/qwerty.kl
Click to expand...
Click to collapse
So I took a look at this file, changed it, and it worked
Here a nice explanation of this file, explained are the different commands, too.
[GUIDE] How to Remap Hardkey Actions || Custom App Launching
What we not know, the key number of our physical BT keyboard, so what's the number of ESC? For this, I've found following site, which seems to contain the correct scan codes, used in Android: (note, the values are in HEX!!)
http://www.marjorie.de/ps2/scancode-set1.htm
So if we take a look at ESC:
Key: ESC Make: 01 --> in decimal, stays 01
We just have to add following line to the key map layout file:
key 1 BACK WAKE_DROPPED
and we have a back key.
3. Altering Character Map file
To change characters and change the whole layout, it seems as if we have to alter the character Map file. (/system/usr/keychar/qwerty.kcm.bin)
Sadly, this fact makes editing the file somehow difficult:
Resource Binary File Format
The file snippet above [see first link] gets converted to the following [a binary file] by the makekcharmap tool as part of the build process.
Click to expand...
Click to collapse
I have no idea what this tool is, nor how to revert it back, so we have to edit the binary file. Luckily, one user's done the hard work already, again:
Changing to a non-english keyboard layout [cupcake support]
The easiest method is to use some kind of hexeditor, so you see what you do and can enter the character code of special characters easily, I used the one in Notepad++
Then you can alter the layout just as you like. Because I have a special english keyboard with which I want to type german Umlaute, too, I changed
A.2.a.A.#..
to
A.2.a.A.ä.Ä.
So I can type an 'ä' by holding the 'Alt' key and pressing a. Typing 'Ä' by holding Shift+Alt and typing 'a'.
Unlimited possibilities
Tips:
To alter both files you can use ADB and an editor on your computer.
Or you can alter the files directly on the phone, without any additional hardware. You only need Root Explorer to open, change and save the files directly on the phone.
Drawbacks of changing the layout:
Haven't seen some yet

Related

Soft Key icon missing on XDA Orbit???

Hi guys,
having had various WM5 handsets, I was a little upset to not be able to adjust the soft keys located at the bottom of the today screen. This has been possible on previous units just not the Orbit. The icon is found on the settings/ personal screen under the icon soft keys. I have done a hard reset and the icon still has not appeared. Can anyone suggest a registry entry to enable this function as the pre set options are not required????
I have seen 5 Orbits and all seem to be without it is this different on the artemis or T-mobile Compact III's?
Just to add I was wondering if I would ber able to dopy the icon from my previous device and see if it would work in my XDA Orbit?
Its the softkey applet you are after - place this cpl in the \windows directory soft reset and it should appear. (soft reset not strictly necessary)
Users beware - it is not easily reversible after install - you can delete the cpl but the settings remain the same and you will need to do a registry edit to get back tp previous state.
JC#79:
The Artemis has no Softkey applet, too.
Thanks at meschle
Thanks for that is any issues I should be aware of with using this applet, as in any problems etc?
Also how would I go about removing it from the registy should I indeed choose to do so (problems permitting)?
JC#79 said:
Thanks for that is any issues I should be aware of with using this applet, as in any problems etc?
Also how would I go about removing it from the registy should I indeed choose to do so (problems permitting)?
Click to expand...
Click to collapse
No issues in actually using it but after removal will have to restore orig reg keys
taken from wiki - good place to vist
Change the application launched by Today screen Soft Keys
To change the application launched by the Today screen Left soft key:
HKCU\Software\Microsoft\Today\Keys\112\Open = "\Windows\Calendar.exe" (REG_SZ string, including quotes)
To change the title of the Left soft key:
HKCU\Software\Microsoft\Today\Keys\112\(Default) = "Calendar" (REG_SZ string, no quotes)
To change the application launched by the Today screen Right soft key:
HKCU\Software\Microsoft\Today\Keys\113\Open = "\Windows\Start Menu\Programs\Contacts.lnk" (REG_SZ string, including quotes)
To change the title of the Right soft key:
HKCU\Software\Microsoft\Today\Keys\113\(Default) = "Contacts" (REG_SZ string, no quotes)
Note that 113 normally doesn't exist by default, and probably needs to be created
Also note that there is at least 1 application that allows you to set these through a GUI, developed by FdcSoft called SoftKeyAppletEx.'
For some reason after removal of the applet the defaults dont return - so need editing
Thanks for that I'll give it a try later tonight after I backup the device just to be sure I can restore without any issues.
Also when you say wiki what do you mean have you a link?
Also will the applet allow me to use the softkey function as in previous handsets via softkey icon in personal tab of settings menu (am being blond has been along day)?
JC#79 said:
Thanks for that I'll give it a try later tonight after I backup the device just to be sure I can restore without any issues.
Also when you say wiki what do you mean have you a link?
Click to expand...
Click to collapse
Lol - the link is at the top of the screen on the left and the first post of the forum!
works perfectly on my german hero running dopod p800w wwe - rom!
thanx
Works a charm and the phone is just as I want it for now!
Ok slight problem with this the applet works for certain items but not with the new MMS and new SMS can anyone offer any advice as the handset states I should attempt to reinstall application?
JC#79 said:
Ok slight problem with this the applet works for certain items but not with the new MMS and new SMS can anyone offer any advice as the handset states I should attempt to reinstall application?
Click to expand...
Click to collapse
How have you tried to set it up? Which shortcut did you use?
I installed the file in the windows dir as advised.
I did a soft reset and attempted to use the New SMS & New MMS shortcuts.
When I try it comes up with the error message:
tnsms.exe
The file 'tnsms' cannot be opened. Either it is not signed with a trusted certificate, or one of its components cannot be found. You might need to reinstall or restore this file.
This also comes up for the file name 'tnmms' am not really sure what to do next, seems all other ones work that I have tried so far?
JC#79 said:
I installed the file in the windows dir as advised.
I did a soft reset and attempted to use the New SMS & New MMS shortcuts.
When I try it comes up with the error message:
tnsms.exe
The file 'tnsms' cannot be opened. Either it is not signed with a trusted certificate, or one of its components cannot be found. You might need to reinstall or restore this file.
This also comes up for the file name 'tnmms' am not really sure what to do next, seems all other ones work that I have tried so far?
Click to expand...
Click to collapse
I dont seem to have those shortcuts - what device are you running?
If you can, attach copies of those lnk files in a zip.
I use wm5newmenu and it already has those shortcuts in its menu - i assigned the menu to left soft key.
I have the o2 XDA Orbit those shortcuts are a part of the messaging programme for starting new sms and mms. I will search the device and see if I can find the files and zip them up on here.
Correction I cannot find the files stated in the error message, so I am at a loss as to what to do next?
Bump
Anyone shed any light on this one? I can enable these shortcuts on my old MDA Compact yet with the applet on the Orbit it is having none of it.
Same here with my Orbit ... I wanted to use left soft key for new SMS, but it gives me an error: The file 'tnsms' cannot be opened. ...Any advice guys?
Cheers ..
meschle said:
No issues in actually using it but after removal will have to restore orig reg keys
taken from wiki - good place to vist
Change the application launched by Today screen Soft Keys
To change the application launched by the Today screen Left soft key:
HKCU\Software\Microsoft\Today\Keys\112\Open = "\Windows\Calendar.exe" (REG_SZ string, including quotes)
To change the title of the Left soft key:
HKCU\Software\Microsoft\Today\Keys\112\(Default) = "Calendar" (REG_SZ string, no quotes)
To change the application launched by the Today screen Right soft key:
HKCU\Software\Microsoft\Today\Keys\113\Open = "\Windows\Start Menu\Programs\Contacts.lnk" (REG_SZ string, including quotes)
To change the title of the Right soft key:
HKCU\Software\Microsoft\Today\Keys\113\(Default) = "Contacts" (REG_SZ string, no quotes)
Note that 113 normally doesn't exist by default, and probably needs to be created
Also note that there is at least 1 application that allows you to set these through a GUI, developed by FdcSoft called SoftKeyAppletEx.'
For some reason after removal of the applet the defaults dont return - so need editing
Click to expand...
Click to collapse
Meschle - thank you for the intro to registry editing - good for beginners like me !
I use this:
Just to say, Happy Christmas to all,
AND
The registry setting for the soft keys is a marvel. I reckon it is better than any applet (going from what I hear), I havent tried any applet, I went straight to the registry and I must say It is exactly as promised.
My Setup:
O2 XDA Orbit, Mobile 6, Default Theme
Program to access Registry:
SOTI Pocket Controller Pro v6.01 (this is well worth the money)

[REF] Foxtel Mobile TV GUIDE (Australia) on HTC Touch HD & Jbed

I have succeeded in:
- downloading the Foxtel Mobile TV Guide
- making it work on my HTC Touch HD
- stopping it from prompting me for "permissions" every time it runs.
- creating a direct shortcut to the application
This allows me to send remote-record instructions to my Foxtel iQ2 set top box, just like on the "supported" handsets, such as the Nokia N95.
(I've cross-posted this information to an existing thread on forums.whirlpool.net.au, where there are probably more Aussies asking about it. But I thought I should also post here, because xda-developers has more people interested in adjusting permissions in Jbed's "selector.utf".)
The following worked with Jbed 20080418.2.1 on the HTC Touch HD. I am not entirely sure whether that is the version which came on my handset originally, but if you have a problem with the version you're using, you can try to find the version I'm using via a Google/forum search.
Step 1. Register for the Foxtel TV Guide on your computer, and make sure it's working from a normal PC browser:
https://www.foxtel.com.au/EPG/EPG.aspx
Step 2. Send the text message "Guide" to 19 955 955 from the handset, as per the instructions at the following webpage:
http://www.foxtel.com.au/mobile/get-started.htm
(Cost: $0.55 according to that web page.)
You will shortly receive an SMS message with a URL to download the software, but if you try to download it on your handset, you will probably get an error message saying that your handset is unsupported.
Step 3. Change a web browser's "agent string" to match one of the supported handsets' agent string, then use the URL on the SMS message to download the software.
I used Firefox, and changed my agent string to:
Mozilla/5.0 (SymbianOS/9.2; U; Series60/3.1 NokiaN95_8GB/10.0.021; Profile/MIDP-2.0 Configuration/CLDC-1.1 ) AppleWebKit/413 (KHTML, like Gecko) Safari/413
as quoted on the following web page:
http://www.leytonjay.co.uk/internet...kia-n95-8gb-user-agent-string-default-browser
Using the instructions on this page:
http://johnbokma.com/mexit/2004/04/24/changinguseragent.html
(I removed the "general.useragent.override" setting afterwards, to change Firefox back to normal.)
The file you download will be a ".jad" file.
Step 4. Copy the ".jad" file onto the handset, using ActiveSync, etc.
Step 5. On the handset, run the Jbed "Java" program, and choose Menu->Install->Local Files to locate the .jad file, and install it.
At this stage, you have installed the Foxtel Mobile TV Guide, but you might not be able to use it. On the HTC Touch HD, you do not have any built-in keyboard, or any directional buttons, and something needs to be done to work around it.
Step 6. If you don't have a directional pad on your pocket pc, then install a utility to re-map your volume buttons to fulfil the role of the directional pad. I installed AE-Button Plus, and used the following settings for my HTC Touch HD:
Volume Up:
1: Press Up arrow key
2: Press Left arrow key
3: Press Enter
Long: Press Left SoftKey
Volume Down:
1: Press Down arrow key
2: Press Right arrow key
3: Press Enter
Long: Press Right SoftKey
You may choose to use a different utility, as long as you can access up/down/left/right/enter and have a "hardware" way of accessing the soft-keys, which will be invisible.
http://ae.inc.ru/aebplus.php
Step 7. Run "Java" and launch the "Foxtel TV Guide" application. You will probably need to give it several permissions manually, because we haven't done anything about that, yet.
In order to perform a "remote record", you will need to enter your Foxtel TV Guide user guide and password, the same as for the normal web browser interface. But, Jbed won't let you access a SIP, and if you might not have a physical keyboard. You will need to use some software to control your handset from your PC.
I used EveryWAN Remote Support Personal Edition 3.0:
http://www.sparus-software.com/spip.php?page=download&lang=en
In the Foxtel Java application, press the Left SoftKey, to bring up the "Actions" menu. You can do this via your remote control program, or use your remapped buttons. Choose "Settings", then "Account Settings".
Now you have to enter your Foxtel username and password using the remote control software as a keyboard. However, it's not as simple as typing "a", "b", "c", etc. The application expects you to ONLY use digit keys, like on a simple phone. So, for "a" you might press "2" once, "b" = hit "2" twice in quick succession, etc. It's a pain, but you should only have to do it once, and it'll remember your settings.
By this stage, you should be able to launch and control the Foxtel Mobile TV Guide with your remapped buttons, and because you've entered your username and password, you can ask your iQ/iQ2 to record something from your phone, and it'll do it.
IF you want to get rid of the annoying prompts for permission on startup: (technical, and your mileage may vary)
Step 8. Find the files "selector.utf" on your handset, and copy it to your PC. Mine is in \Esmertec Java\AppDb, but yours might be in \Windows\AppDb. Make backups, both on your PC and on your handset, in case you do something wrong.
Step 9. Download a Hex editor for your PC, and edit "selector.utf".
I used "HexEdit":
http://www.physics.ohio-state.edu/~prewett/hexedit/
The first two bytes of the file determine exactly how many bytes follow. My file was 397 bytes long, so the first two bytes were "01 8B" = 395. The first two bytes don't count. The java program should be happy with "selector.utf" as long as the correct length is given.
The Foxtel application is installed with a setting/line "domain=midp1", but we need to change it to "domain=tckmax". That's exactly one byte longer, so, use your hex editor to increase the length by 1. In my case, that meant changing the first two bytes from "01 8B" to "01 8C".
Save and exit.
Next, open the file up with a normal editor. Hopefully you can use notepad, but I used "vi", which may not be available on your computer. Change "domain=midp1" to "domain=tckmax", save, and exit.
Step 10. Overwrite "selector.utf" on your handset with your edited version, and run Java again, and launch the Foxtel TV Guide application. Hopefully, it will now run without prompting you for any permission any more.
Step 11. You can make a direct shortcut to the Foxtel TV Guide application if you like, so you don't have to run "Java" and then select it manually any more. If you look at "selector.utf" again, there is a parameter "root=XXXX". In my case, the Foxtel TV Guide root is "s2_". It depends on which order you install your Java applications.
Using Resco File Explorer, copy the Java shortcut from \Windows\Start Menu\Programs\ and create a link "Foxtel" in the same directory. Then, tap-and-hold on it and choose "Properties", then the "Shortcut" tab. In the "target" field, append the string:
-run XXXX
where XXXX is the root of your Foxtel application. Don't forget to use a space to seperate "-run" from whatever comes before.
I hope this information is useful to someone. I tried following all sorts of tutorials for removing the permissions prompts, but most threads are focussed on Java Gmail/Opera applications, and they never worked for this Foxtel software. They key was, the Foxtel application installs itself in the "midp1" domain, and in order to change that to "tckmax", which is one extra byte, and I had to change the two-byte header of the file.
Edit: Addendum: The application looks like it'd be happier on a QVGA device, and I had some problems scrolling through the list of all channels in WVGA mode. It's more functional if I use WVGAFIX3 to set the resolution to VGA 480x640 before I run it.
I just installed this file: View attachment 156767 which allows me to watch foxtel on my xperia and also allows me to view the foxtel tv guide through telstra's business portal (free to browse) and set up programs to record on my IQ2.
Works like a charm.
Special thanks to thedeva who posted this file in another thread.
Thanks tls,
will add this to my shortcut list!
will this work if you're with a different mobile carrier other than telstra or does it use the telstra portal?
i had it working on '3'!
On a separate note, my JBlend got corrupted and im trying to figure out how to install/restore it.

Tilt2 CTRL key

I am using an AT&T Tilt2 with stock ROM. I am not being able to get a key on the hardware keyboard to remap to CTRL.
I have tried manually editing the eT9.Rhodium.Cingular_US.kmap.txt file (using 0x11 for the value). I have also tried using the Rhodium Keyboard Controller. Neither seem to do the trick. The key I remap (tried OK, home, and several others) stops doing the original function. Instead of what I would expect for CTRL it just does nothing.
For now I have mapped fn-C -> CTRL-C and such, but I would like to get a key to actually map to CTRL.
Any ideas on how to get this to work?
I agree.
Bump for more interest please.
Anyway to add CTRL to the stock SIP touch keyboards too?
I miss my Ctrl-A (select all) / Ctrl-C (copy) / Ctrl-V (paste) amongst other common keyboard commands too!
~J
im afraid you will have to flash custom rom to enable ctrl remapping
For the kmap bit did you use the 0x11 as the second value? IE did you change it to something like:
{0xEC 0x11 0x00 0x00 0x00 0x00} //example for the FN key remap.
Also make sure to use something like Notepad to modify the file. It needs to be saved as unicode.

[DEV][HOWTO] How to decompile kcm.bin to remap keys properly.

Someone please explain how to properly decompile the kcm.bin so that it can be edited and recompiled. There are quite a few of us who would like to remap certain hardware buttons (mainly custom user keys) but just using the files from (this thread) leaves us with some broken keys, the "?" key mainly... but some would also like to tweak this layout and don't have a proper tutorial. I will gladly donate a minimum of $10USD to the first person who properly explains the process for both *nix and windows environments.
This is another approach.
(If you have already read this and it is not the way you want it, I am sorry)
According to http://forum.xda-developers.com/showthread.php?t=1285244&page=3
In short:
# Remount
adb shell
su
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
# fetch Keylayout
adb pull /system/usr/keychars/vision-keypad-wwe.kcm.bin /tmp/vision-keypad-wwe.kcm.bin
# edit Keylayout according to Thread above with a hex editor
For example A 2 a A ! ! that represents:
A: Scancode
2: Does not matter
a: Letter when button connected to the keycode is pushed
A: SHIFT + button connected to the keycode is pushed
!: ALT + button connected to the keycode is pushed
!: SHIFT + ALT + button connected to the keycode is pushed
(for me ALT = FN)
# push it back
adb push /tmp/vision-keypad-wwe.kcm.bin /system/usr/keychars/vision-keypad-wwe.kcm.bin
The first line in every row is the constant value of the keycode.
For example: http://developer.android.com/reference/android/view/KeyEvent.html#KEYCODE_A
For Button A it is: 29 in decimal, 1D in hex.
With this approach you can change every key, but only the printable characters.
Search button will not work, as it is implemented in another way...
ok, not sure if I missed something, but specifically I need to modify the ? key and the 3 user assignable keys on the g2/dz keyboard... I don't see in the hex editor any line that starts with the ? symbol then has a number and two more chars/symbols after the number (ie: A 2 a A ! ! )
when I load keynumber tracker app the ? key reports "214" the user assignable keys report 183, 184 and 185... I'm just not sure what to do with those numbers, or how they help me modify anything...
I guess I just don't understand what I'm doing...
Ok, so I noticed in hex editor that the only difference between the modded kcm.bin and the stock one where my ? key works (besides the remapped keys) was the last 64 blocks of hex so I copy /pasted that part to the modded kcm.bin then saved and pushed... Now it's working, thanks so much, will PM you momentarily to get your paypal addy. Sooooo happy!!!
Edited w/ a cold press a CNC and a water jet @ 30,000PSI.

How To Guide How to remap "assistant" button! [ROOT REQUIRED]

it seems that while adding non-remappable assistant buttons is a growing trend, solutions aren't easy to find, however the solution is real simple, you just have to modify the keymap file...
I successfully managed to get the button detected by flashing XperiaGAButtonRemap through magisk, and I'm pretty sure the same solution works for a bunch of other phones also, it even has code that should allow flashing through custom recoveries also.
all you have to do is "install from storage" in magisk manager, select the zip, and reboot.​
what that zip does, is it adds /system/vendor/usr/keylayout/gpio-keys.kl (overriding /system/usr/keylayout/gpio-keys.kl because /vendor has higher priority) and replaces the ASSISTANT key with PROG_BLUE, which is a dummy key, you can remap that with any remapper app or module, or you could edit the zip, and change it directly to something like CAMERA, if that's all you want.
here's what the file will look afterwards, if you're curious:
key 115 VOLUME_UP
key 114 VOLUME_DOWN
key 102 HOME
key 528 FOCUS
key 766 CAMERA
key 457 PROG_BLUE
the original file has copyright notice for The Linux Foundation, from 2013, but all other keys map the same, so it's highly likely most phones (at least the AOSP-adjacent ones) just have hooks for the ASSISTANT key, but still rely on the universal keymap file
thanks a lot!worked just fine,
big ups!!!
Hello, sorry for the question, does this work on Android 12?
SHANOA_zasha said:
Hello, sorry for the question, does this work on Android 12?
Click to expand...
Click to collapse
I've just tested and yes it works in A12

Categories

Resources