How to remap mouse buttons and is possible to make .kl and .kcm files for it? - General Questions and Answers

Hi,
I've read all possible threads trying to answer my question and tried editing and creating .kl files with no effect.
None of my mouse buttons can be remapped using the simplest method - by making a .kl file .kl.
Key list:
0x110 (key 272) left click button - mapping BTN_LEFT
0x111 (key 273) right click button - mapping BTN_RIGHT
0x112 (key 274) middle button (scroll button) - mapping BTN_MIDDLE
0x113 (key 275) back/previous button - mapping BTN_SIDE
0x114 (key 276) forward/next button - mapping BTN_EXTRA
KeyTest app that shows details on keypresses returns info only for the FORWARD and BACK mouse buttons. Pressing the rest gives no output.
I managed to remap these two keys with Xposed Additions Xposed Framework module.
Unfortunetly I couldn't do the same for 3 remaining keys
Some questions relating the issue:
Are mouse devices remapped some other way then by making a .kl file for them? Is there even an official, Google way to remap them? Just like the one in the Dev site?
Can you determine which .kl file is used by a specific device? With a shell command maybe?
RESEARCH:
Android Button State
An Android button state is a standard identifier defined in the Android API for indicating which buttons (on a mouse or stylus) are pressed. Android button states are defined by the android.view.MotionEvent class as constants that begin with the prefix BUTTON_.
The current button state is determined by the Android InputReader component which monitors when buttons (on a mouse or stylus) are pressed / released and sets / resets appropriate button state flag.
The relationship between buttons and button states is hardcoded.
Click to expand...
Click to collapse
Source Android official website - > Devices -> Interfaces -> Input -> Key Layout Files site describing .kl files usage and syntax doesn't mention anything about the mouse - so is there no .kl for mouse? No "official" way of remapping the keys? or if I think right, basing on "Android Button State" mentioned above; left, right and middle mouse buttons are hardcoded and can't be just remapped? So where is it hardcoded then?
Source Android official website - > Devices -> Interfaces -> Input -> Input Device Configuration Files
The default behavior for a mouse is to present an on-screen cursor which tracks the mouse's movements and simulates touches when the mouse is clicked. Although the mouse can be configured differently, the default behavior is usually sufficient for standard mouse peripherals.
Click to expand...
Click to collapse
Eem... ok so it says it can be configured otherwise, but how... if the .kl files are not working...
Input Device Configuration File - /system/usr/idc/Vendor_XXXX_Product_XXXX.idc
I have tried making an .idc file for my mouse and it's being used, but I don't know what I should put in it so Android would also use a .kl or .kcm file for the mouse just like it does for keyboards.
Logcat output:
I/EventHub( 656): New device: id=32, fd=173, path='/dev/input/event6', name='Bluetooth Mouse', classes=0x80000008,
configuration='/system/usr/idc/Vendor_099a_Product_0500.idc', keyLayout='', keyCharacterMap='', builtinKeyboard=false, wakeMechanism=EVIOCSSUSPENDBLOCK, usingClockIoctl=true
Click to expand...
Click to collapse
After connecting keyboard: (I don't have an .idc file for the keyboard, there is no need for it)
I/EventHub( 656): New device: id=33, fd=173, path='/dev/input/event6', name='MEDION MD86853', classes=0x80000003,
configuration='',keyLayout='/system/usr/keylayout/Vendor_04e8_Product_7021.kl', keyCharacterMap='/system/usr/keychars/Vendor_04e8_Product_7021.kcm', builtinKeyboard=false, wakeMechanism=EVIOCSSUSPENDBLOCK, usingClockIoctl=true
Click to expand...
Click to collapse
Can I add some parameters to the .idc file that would force using a specific .kl file? I can't find any documentation for .idc files contect that would be more exensive - a list of possible variables/values would be nice, but I can't find it.

Try using this app: https://play.google.com/store/apps/details?id=com.tincore.and.keymapper&hl=en

@Ventricle have you found ansolution?

@Ventricle - did you find a solution for this? I am trying to move pointer with a gamepad X and Y axis. so far i couldn't do this. thanks.

No, sorry I couldn't do it with any known methods. It's hardcoded I guess - still possible to change, but would require more in-depth looking and then changing some files.
I've been using PhoenixOS and RemixOS recently and they have mouse right click and middle click sorted out. I'll look into the system files and maybe I can reproduce the method (I hope that's legal )

I know something about this but, only if somebody still need help.

Nickescd said:
I know something about this but, only if somebody still need help.
Click to expand...
Click to collapse
Hi, I need to change usb mouse right button from "back" fuction to "menu" is that possible? I am android 8.1 rooted, thanks

Nickescd said:
I know something about this but, only if somebody still need help.
Click to expand...
Click to collapse
Please, I've looked into this for months and there's literally nothing I can find to help me. I just want to be able to rebind right click and it's impossible.

I'm also looking for solutions. I've tried tincore, many other remappers, going into the .kl files directly.. I thought about making one but I don't know the vendor id and such for a Logitech m535. Also Phoenix is and remix os are old at this point and don't seem like there's been updates since about 2018.

This is the most accurate problem (which I am having) description and research on the internet.
Sadly no news I believe?
Of course if you only need to forward mouse to PC you can use virtualhere. Quite expensive piece of software 25$ with current 50% discount. And needs to purchase new one on new Android device

I am using latest PrimeOS Mainline in a quad boot system with a logitech K400r wireless keyboard/trackpad. I tried to change the right mouse button behavior but failed. I am writing what I learned/did before giving up as it might aid others with troubleshooting similar issues.
Problem:
Right mouse button clearly does not act as back button and it is really annoying if you are used to the default behaviour.
Right mouse button seems to be same as left mouse button (possibly long click lmb) unless right click on desktop icon and works as menu button. Looks like they try and make rmb like windows where you are supposed to get a context menu.
Troubleshooting Steps:
Make backup of PrimeOS partition (just in case).
Identify keyboard and get vendor and product id.
Code:
cat /sys/kernel/debug/usb/devices
I check the output and get vendor=046d product=c52b.
Now create custom files for my keyboard. Don't want to mess with generic files. Input device files are located in /system/usr on my device. Some devices use /vendor/usr or /odm/usr for these files. A rough idea for the search path order here https://source.android.com/devices/input/input-device-configuration-files. I am in terminal as root user and /system folder has RW access.
Code:
cd /system/usr/keylayout
cp Generic.kl Vendor_046d_Product_c52b.kl
chmod 644 Vendor_046d_Product_c52b.kl
cd /system/usr/keychars
cp Generic.kcm Vendor_046d_Product_c52b.kcm
chmod 644 Vendor_046d_Product_c52b.kcm
I examine the files and nothing in particular stands out as a problem. I compare files with files from another device where the keyboard works as expected, again nothing stands out.
I begin troubleshooting further. I identify input stream from keyboard.
Code:
getevent -p
From the list I find my keyboard interacts via /dev/input/event10.
Now I can view the scan codes for keyboard.
Code:
getevent -l /dev/input/event10
Right mouse button gives EV_MSC MSC_SCAN 00090002 and EV_KEY BTN_RIGHT. This seems normal. I do the same for working device and get same codes.
I try and add line 'key usage 0x090002 BACK' to .kl file in the 'keys defined by HID usages' section but this does not work (yes I rebooted after).
Conclusions:
Doesn't look like you can change right mouse button behavior using config files in this instance. Perhaps problem in kernel. AndroidX86 does not have this issue but doesn't have the great UI.
Might be able to mod /system/framework/hid.jar or /system/framework/input.jar perhaps.
PrimeOS should have provided an option in settings to change rmb behavior if they veered away from the default usage. I'll post on PrimeOS thread.
Use esc key instead

I know this thread is old, but did anyone find solution to this? Remapping mouse clicks is the only thing I can't remap as well. Quite frustrating! Any help is greatly appreciated. I'm rooted on LineageOS via Magisk on an Onn box (Android TV)

Related

how can you choose another keyboard

i can't even choose wii controller in tnt? i just got tnt lite 2.0 going and i just realized i can't even use wiimote because tnt won't let you change keyboards. this sucks bad, that would be great if someone figured out a way to bypass this little security measure they have to keep you from using other keyboards.
Yea, i paid $20 for a bluetooth keyboard i can't use because of that...
I am a developer though I already have the android source on my computers so perhaps i will have some time to look tomorrow at how exactly they do it in the code.
Usually that stuff is restricted but perhaps there is a way around as root. I know there is a command you can run to force apps to install to the SDcard on my droid under froyo, perhaps the same command can change this setting.
Has anybody tried loading up the stock froyo settings app?
--Robert
FYI: it's in android-source/packages/apps/Settings/src/com/android/settings/LanguageSettings.java
Code:
Settings.Secure.putString(getContentResolver(),
Settings.Secure.ENABLED_INPUT_METHODS, builder.toString());
Settings.Secure.putString(getContentResolver(),
Settings.Secure.DISABLED_SYSTEM_INPUT_METHODS, disabledSysImes.toString());
Settings.Secure.putString(getContentResolver(),
Settings.Secure.DEFAULT_INPUT_METHOD,
mLastInputMethodId != null ? mLastInputMethodId : "");
Read from
Code:
mLastInputMethodId = Settings.Secure.getString(getContentResolver(),
Settings.Secure.DEFAULT_INPUT_METHOD);
String enabledStr = Settings.Secure.getString(getContentResolver(),
Settings.Secure.ENABLED_INPUT_METHODS);
final TextUtils.SimpleStringSplitter splitter = mStringColonSplitter;
splitter.setString(enabledStr);
the Settings.secure permission is restricted from normal apps- but maybe we can gain that permission if we put the app in the /System/ folder?
This would be a major accomplishment if you figure this out. For the life of me I don't know why they would have done this...makes no sense.
Sent from my ADR6300 using XDA App
I did find a way into the accounts and settings (sync settings) - but I don't have checkboxes to enable syncing on contacts and calendars for some reason....
Perhaps i did the tntlite2.0 upgrade wrong - i did NOT do a factory reset because I didn't want to reinstall everything
I'll try to remember to post the sync settings launcher app tonight after i get home from work- all it does is fire the necessary intention to get into the app (com.android.providers.subscribedfeeds/com.android.settings.ManageAccountsSettings)
Hopefully they screwed up the settings app, which i can probably fix by making a new one, but if they hosed the settingsProvider that is supposed to store this stuff we might be screwed :-(
I just figured out how to write a video streaming app (from android) for my work, so this should be easy by comparison
On a dissapointed note- my sound is still F-ed up after the 11/22 update (randomly stops working, plays static and floods the logs w/ errors) anybody else have this problem?
Thanks for working on this, this is one of my biggest complaints with tnt.
Sent from my ADR6300 using XDA App
If anybody could find a way to get around this:
PackageManager W Not granting permission android.permission.WRITE_SECURE_SETTINGS to package com.DroidMunkey.gTabletHacks (protectionLevel=3 flags=0xbe44)
I would have this finished.
Sticking it in /system/app doesn't work so i must be missing something - it's rejected in: android-source/frameworks/base/services/java/com/android/server/PackageManagerService.java if anybody else wants to take a look
I figured it out, but they screwed something else up in the system and must have disabled it on purpose...
if i select a different keyboard the input box expands to take up the entire screen when i click on it!
So if you have an alt keyboard selected and you hit the search key, you can't see the history below, or the icons next to the box to do the voice search/location selection!!!
see attached image
Very annoying.. wasted an entire day to figure this out. I suppose it wasn't a total waste though I learned alot about the android core
Are there any other settings missing that people need? I might put together an app that will let you do this despite the annoying bug if people are still interested.
I already wrote an app like HomeCatcher, but it shows me the "recent apps" list, since you can't long-press the damn home-key anymore. Anybody interested in something like that?
BTW- since nobody spells out in plain english how to get the WRITE_SECURE_SETTINGS permission, here it is for those of you hitting this page via Googling my error
1) You need to request the permission in your app manifest
2) the app has to be in /system/app/
3) it has to be owned by root w/ the correct permissions (nobody tells you this part!)
4) when you reboot, the app will be automatically installed, and you will get the additional permissions (if it's already installed, you have to uninstall it before you reboot!)
5) you will NOT be able to uninstall the app after you do this (just delete it, but make SURE you manually 'clear cache' for the app in settings->applications->manage->yourapp before you delete it or all your extra settings data will be orphaned in memory!!)
su
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
cat /sdcard/YourApp.apk > /system/app/YourApp.apk
chown 0.0 /system/app/YourApp.apk
chmod 0644 /system/app/YourApp.apk
mount -o remount,ro -t yaffs2 /dev/block/mtdblock3 /system
reboot
Click to expand...
Click to collapse
KinkyMunkey said:
I figured it out, but they screwed something else up in the system and must have disabled it on purpose...
if i select a different keyboard the input box expands to take up the entire screen when i click on it!
So if you have an alt keyboard selected and you hit the search key, you can't see the history below, or the icons next to the box to do the voice search/location selection!!!
Click to expand...
Click to collapse
Thanks! Mind if I ask you which alternate keyboard you are using? On my another device I also get this exact same huge textbox if I some alternate keyboard (e.g. the Better Keyboard), but not all (e.g. the Thumb Keyboard).
Also: which ROM are you using? Does it matter (with respect to your 5-steps procedure)?
Are there any other settings missing that people need? I might put together an app that will let you do this despite the annoying bug if people are still interested.
I already wrote an app like HomeCatcher, but it shows me the "recent apps" list, since you can't long-press the damn home-key anymore. Anybody interested in something like that?
Click to expand...
Click to collapse
Absolutely! (I know that it's available via roebeet's TnT Lite 2.0.2 supplement, but I'd like to stick to 2.0.0's contact & calendar...)
Thanks!
Save time just install zpad . Cleaner look runs faster and can use other keyboard inputs.. played super Mario bros 3 with wiimote this morning. I just need a stand now
I tried the blueInput and full keyboard, both did it, they do not do it on my droid which is why i am convinced something is wrong with the tablet
I have been thinking about it, I wonder if there is a build setting (related to the USB keyboard support) that is telling android to do this. I can't imagine why it would happen unless it's a "feature" for phones w/ small screens or no touchscreen.
It happens in every input box, so it's GOTTA be an android setting, going to dig around and see if i can figure out what causes it
btw here is the code i used, combined w/ the steps to gain the SETTING_SECURE priv above, in case anybody is pulling their hair out to do it.
Code:
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
List<InputMethodInfo> mInputMethodProperties = imm.getInputMethodList();
StringBuilder builder = new StringBuilder(256);
int N = (mInputMethodProperties == null ? 0 : mInputMethodProperties.size());
for (int i = 0; i < N; ++i) {
InputMethodInfo property = mInputMethodProperties.get(i);
String prefKey = property.getId();
CharSequence label = property.loadLabel(getPackageManager());
Log.i(LOGTAG, "found " + label);
if (builder.length() > 0) builder.append(':');
builder.append(prefKey);
}
String mLastInputMethodId = Settings.Secure.getString(getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD);
String enabledStr = Settings.Secure.getString(getContentResolver(),
Settings.Secure.ENABLED_INPUT_METHODS);
Log.i(LOGTAG, "last: " + mLastInputMethodId + " enabled " + enabledStr + " we would like: " + builder.toString());
try {
Settings.Secure.putString(getContentResolver(), Settings.Secure.ENABLED_INPUT_METHODS, builder.toString());
Toast.makeText(getApplicationContext(), "SUCCESS!! keyboard enabled!", Toast.LENGTH_LONG).show();
} catch (Exception e) {
Toast.makeText(getApplicationContext(), "Failed to set keyboard: " + e.getMessage(), Toast.LENGTH_LONG).show();
}
KinkyMunkey said:
I tried the blueInput and full keyboard, both did it, they do not do it on my droid which is why i am convinced something is wrong with the tablet
Click to expand...
Click to collapse
Thanks! Could you try the thumb keyboard
http://forum.xda-developers.com/showthread.php?t=830772
and see if you get the same result?
yes, same problem with thumb keyboard
I did get "hidd --search" to find my bluetooth keyboard! I can use it without doing anything special now, works just like a usb keyboard would
KinkyMunkey said:
yes, same problem with thumb keyboard
I did get "hidd --search" to find my bluetooth keyboard! I can use it without doing anything special now, works just like a usb keyboard would
Click to expand...
Click to collapse
http://code.google.com/p/androidobex/downloads/detail?name=hidd
get that, stick it in /system/bin, go into a terminal (adb shell) do su, then type 'hidd --search'
that will automatically search for bluetooth HIDD devices and connect to any it finds
Then, the bluetooth keyboard will work w/out having to switch input methods
This may reset your wifi connection and force a reconnect when it does it's bluetooth scan, not sure why it does that, if you use the --connect option and specify the bluetooth ID instead of searching it won't do that
http://linux.die.net/man/1/hidd
Horray for linux based phones!
KinkyMunkey said:
http://code.google.com/p/androidobex/downloads/detail?name=hidd
get that, stick it in /system/bin, go into a terminal (adb shell) do su, then type 'hidd --search'
that will automatically search for bluetooth HIDD devices and connect to any it finds
Then, the bluetooth keyboard will work w/out having to switch input methods
This may reset your wifi connection and force a reconnect when it does it's bluetooth scan, not sure why it does that, if you use the --connect option and specify the bluetooth ID instead of searching it won't do that
http://linux.die.net/man/1/hidd
Horray for linux based phones!
Click to expand...
Click to collapse
awesome so you got it to work? i was never able to get adb to proplerly work though. i may work on that later.
if you are on linux- you need a rule for it in /etc/udev/rules/ so ADB has permission to access the device (otherwise you have to run adb as sudo)
create an android file if you don't have it (i use the file name '99-android.rules' so it runs last)
Code:
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0955", ATTRS{idProduct}=="7100", MODE="0666"
(FYI, you use the 'lsusb' command to get these numbers if you have a new device- Bus 001 Device 008: ID 0955:7100 NVidia Corp.)
didn't know if anyone had seen this thread, they say this method works but seems like it may be a hassle to switch back and forth between keyboards http://forum.xda-developers.com/showthread.php?t=856476

[Q] Remote desktop (SplashTop, LogMeIn, Pocketcloud etc) w\ right-click & keyboard?

[Q] Remote desktop (SplashTop, LogMeIn, Pocketcloud etc) w\ right-click & keyboard?
Just curious: does (1) right-click, and (2) Ctrl, Alt, Esc keys work when you use SplashTop, LogMeIn, or Wyse Pocketcloud? I'm looking to find out which specific products work with before I think about buying a Transformer dock.
I'm worried especially that the dock's right-click will still function as Android's "go back".
Thanks!
^^ same thing i'm worried about; specifically meta keys in terminals though. (without ctrl-r,ctrl-n how do you use bash without going insane?)
Tosylate said:
Just curious: does (1) right-click, and (2) Ctrl, Alt, Esc keys work when you use SplashTop, LogMeIn, or Wyse Pocketcloud? I'm looking to find out which specific products work with before I think about buying a Transformer dock.
I'm worried especially that the dock's right-click will still function as Android's "go back".
Thanks!
Click to expand...
Click to collapse
worminater said:
^^ same thing i'm worried about; specifically meta keys in terminals though. (without ctrl-r,ctrl-n how do you use bash without going insane?)
Click to expand...
Click to collapse
Fear not, guys. Splashtop is on the ball.
* Right click -- achieved by a tap-and-hold.
* Ctrl, Alt, Esc -- all available from a proprietary virtual keyboard that appears at the top of the screen, enabled by pressing a button at bottom right. You can also combine keys, ie. tap Ctrl, then tap the F4 button to send a Ctrl-F4.
Thanks so much for replying! I'm actually wondering: does your answer apply to the Transformer Dock? When you mean, "tap," do you mean to press the button on the dock/keyboard/trackpad?
Thanks!
Pocket Cloud also has a neat implementation for right mouse, ctrl etc..
PhoneMyPC just got updated as well. Its a much better interface than it used to be. I use both Splashtop and PhoneMyPC. They have all controls for windows pc's in the menu somewhere.
Tosylate said:
Thanks so much for replying! I'm actually wondering: does your answer apply to the Transformer Dock? When you mean, "tap," do you mean to press the button on the dock/keyboard/trackpad?
Thanks!
Click to expand...
Click to collapse
I don't have the dock yet, so I can't answer the behavior except in tablet mode, sorry...
What I am looking for is a remote desktop client, that will let me use the right-click of the transformer's trackpad.
All of the RCP software I've tried so far, leave the right-click being the stupid "BACK" function.
Does anyone know how to change this key mapping? or of any RDP software that will honour the right-click. (not using a virtual mouse)

[How-To][Mod] Changing the Keyboard Characters

Quick and short of it:
The SK4G has the same exact physical Keyboard layout of the G1. But it sucks in comparison to the G1's layout because someone at Samsung dropped the ball. Shift + a number does not give you the normal expected symbol. There is a lack of a comma on the right hand side. Shift+Alt tends to not do anything on most keys. With this mod, I fixed 90% of the annoyances of the hardware keyboard (Just need to turn the [useless everywhere but the stock messaging app] smilie key into the voice key, and the voice key into an alt key and I'll be 100% good)
By hacking the corresponding kcm.bin file in the /system/usr/keychars/ directory, you can change the action of a key. This is not the same as changing the kl file in /system/usr/keylayout/ which allows you to change the behavior of a physical key. (A bit of semantics really.)
I modded the default kcm.bin (Binary Keyboard Character Map) file s3c-keypad.kcm.bin to match the G1 kcm closely, adjusting for what is printed on the SK4g keyboard, so w, e, and r are still smilies, and m is still /, while alt+shift+? is now ¿ as the g1 has. Only change to what is printed was fixing the multiplication sign symbol on alt+o to show an actual multiplication sign, instead of an x. Some unused alt+shift+key were used to improve usage, and for flair.
Main Changes:
shift+number provides its corresponding symbol, like it should.
alt+shift+O is the Umlat combining accent (press another character afterwards it it might combined, like ¨ + u is ü. Same result as longpressing U).
Alt+Q default by Samsung is a Space. Alt+Shift+Q is now Tab.
Alt+Shift+T is the "¬" not symbol. Sideways L. Useful for ¬_¬ sideway glances.
Alt+Shift+Y is the unicode STAR AND CRESCENT. SK4G can't display it, but it will show up correctly in OSes that understand it/have the right encoding (like the G1).
Shift+Period is a comma. Because the comma belongs on the right side of the keyboard dammit.
Alt+Period is a bullet symbol.
Alt+Shift+Period is a "`" Grave combining accent (same as Umlat. Grave + space is regular grave)
Alt+Shift+Enter is a CR return key, instead of the normal LF return key. Some apps recognize the difference (ConnectBot)
[email protected] and [email protected] is the ~ tilde. I did not add the combining accent version. An adult keyboard requires the ~.
[email protected] is the Eighth Note. Because we all need some music in our lives. Displays properly on the SK4g.
Instructions:
If you want to use the character map I created, you will need root, adb, and be comfortable mucking about the phone's system files. You can install with RootExplorer or any other file manager instead, if you know how to do it:
Code:
adb push /path/to/unzipped/files/mods3c-keypad.kcm.bin /data/local/tmp/
adb shell
su
mount -o remount,rw /dev/block/stl9 /system
cp /data/local/tmp/mods3c-keypad.kcm.bin /system/usr/keychars/
cp /system/usr/keychars/s3c-keypad.kcm.bin /system/usr/keychars/s3c-keypad.bu
mv /system/usr/keychars/mods3c-keypad.kcm.bin /system/usr/keychars/s3c-keypad.kcm.bin
chmod 644 /system/usr/keychars/s3c-keypad.kcm.bin
You need to push the file to the tmp folder, then going in as superuser, remount the system partition.
Once remounted, you can copy the file to the correct folder.
Safety first, make a backup of the original file. A copy of the original is also provided in the zip folder.
Now you overwrite the original.
Once that's done, you want to correct the permissions to 644 like the original.
At this point, you can reboot. If you want to give it a try before rebooting, you can just load any app that isn't in memory, or kill an existing app, and load it back up, and type to see the difference. You must reboot if you want to see the changes everywhere. Any app in memory, including home and system, will not see the new file till you kill it/reboot.
What's in the zip:
Four files are provided in the zip.
1: "s3c-keypad.kcm.bin" This is the original kcm.bin from the stock KD1 firmware. Most likely, it has not been change in KG2.
2: "trout-keypad-v3.kcm" This is a plain text readable version of the G1 kcm. Look at this if you want to see the format android uses to build the kcm.bin file. Easy to read.
3: "mods3c-keypad.kcm" This is a modified kcm file, easy to read showing what my modded layout is, with notes.
4: "mods3c-keypad.kcm.bin" the actual kcm.bin file you can use to drastically improve your keyboard.
If You want to make your own:
Some Resources First:
ASOP Developers Guide to the Keyboard:
http://www.kandroid.org/online-pdk/guide/keymaps_keyboard_input.html
Describes how Android uses (some of) the keyboard files, and the file layouts.
Extending the keyboard mapping of an Android system
http://jahrome.free.fr/index.php/keyboard-mapping-android-htc-desire?lang=en
Found this after the fact, some xda members doing this on the g1 way back when:
http://forum.xda-developers.com/showthread.php?t=468703
Someone had a python tool to turn kcm.bin to kcm files.
http://forum.xda-developers.com/showthread.php?t=837002
Basically, you will be mucking around a hexeditor to change the kcm.bin file.
Make the hex editor show you 16 bytes per line, and you will see a nice pattern, as shown on the http://jahrome.free.fr/index.php/keyboard-mapping-android-htc-desire?lang=en.
Any non-normal (unicode) character should be put on the hex side, so 0x0300 would be typed in. Additionally, hex editors tend to show lsb first. So unicode 0x0300 would show up as "00 03". 0xEF01 will be seen as 01 EF.
If you look and compare the hex editor screen to the kcm file provided, you can easily modify the kcm.bin file to your liking.
Future:
I'm trying to find where the LongPress Keyboard character maps are. Like when you longpress ! lets you choose ¡, or long pressing shift+4 ($) gives you the option to insert a couple of currency marks, or longpressing a will let you choose from accented a characters (å,ä,â etc).
Additionally, also looking for the same on the Extended Feature keys, like SYM, and the smilies. The smilies are just macros that get typed when you press them, as using the regular smilie types ":" "-" and ")", and you can delete each one individually. Having a customizable macro key would be great.
But from my guess, one or both of those features are embedded in the keyboard device driver. I will muck around the filesystem to see what I can find.
Notes:
I am not responsible for anything ever anywhere. You break it, you pay it, not me.
Also, this is only for the hardware keyboard, not the virtual IMEs. Changing those would require apk code signing, and desamali and everything. headthefrickache.
thank you!
this is gonna be really helpful and fun to mess around and make my own. glad to have another dev aboard!
Update: I poked around a bit, and looked at the ime-htc.apk that is floating around. Decompiled the apk, and found that it's popup alternatives for the virtual keyboard is in res/values/strings.xml, with the fields pointed at it by res/xml-normal-hdpi/*.xml depending on which language/shape/layout keyboard you are using.
So I think I am right in assuming that the hardware keyboard popups are in the device driver. :/ Will investigate further.
Oh, and a note about the sidekick keyboard. You cannot press and hold ALT+SHIFT and a third key at the same time. You can't press any three keys and have it register at the same time at all. Another instance where the g1 was just better
Additionally, doesn't seem like all keys respond to a alt-lock+shift-lock the same. The @ and ? key seems to only produce the alt or shift version, while most of the others produce the alt+shift version of the key.
This ****ing guy, eh? When can I buy you strippers and blow, eh? I ****ing love you.
chaostic_2k1 said:
Update: I poked around a bit, and looked at the ime-htc.apk that is floating around. Decompiled the apk, and found that it's popup alternatives for the virtual keyboard is in res/values/strings.xml, with the fields pointed at it by res/xml-normal-hdpi/*.xml depending on which language/shape/layout keyboard you are using.
So I think I am right in assuming that the hardware keyboard popups are in the device driver. :/ Will investigate further.
Oh, and a note about the sidekick keyboard. You cannot press and hold ALT+SHIFT and a third key at the same time. You can't press any three keys and have it register at the same time at all. Another instance where the g1 was just better
Additionally, doesn't seem like all keys respond to a alt-lock+shift-lock the same. The @ and ? key seems to only produce the alt or shift version, while most of the others produce the alt+shift version of the key.
Click to expand...
Click to collapse
Port G1 driver? Whoz got the sauce? erm Source?
Well, I figure the g1 just dedicated more gpio than sumsung did for the keyboard. I doubt the g1 driver can be ported. And the sumsung keyboard driver might be hackable, but without the source for it, it be a pain to try. Still looking for the long press keys though.
I may be confused about your question. I can't seem to understand what you mean by hardware keyboard popup, but yes, the keyboard driver is in the kernel, so you'd need a custom kernel to change that.
The kernel source is available at opensource.samsung.com
If you can pm me/write what you're trying to do/fix (as I'm currently a bit confused as to your goal) I would be open to helping work on this
If you hold down the a key on the keyboard, you get a little popup screen that lets you choose the alternative versions of a, like å, ä, á, etc. Same for holding shift+4 or alt+4, would give you the alternatives for $, like ¥, british pound symbol, etc.
I am trying to find where that information is held. On an ime, it's in the strings.xml file inside the apk. For the hardware keyboard, I'm guessing its in the driver. I'm trying to locate that, so that it can be changed to include more things (and in the sk4g, even add macros like the smilies).
Unfortunately, noone else has found it, or if they have, it's buried in some obscure thread inside some obscure device's forum. The problem with android information, is that with so many devices, and versions, there is a ton of information, being redundantly found/created, and buried under other information.
Haha I hear that. I guess I was testing it out using the wrong buttons before, as I didn't get that popup before. Now I was able to, but it looks like it's only for certain keys. At any rate, let me look in the kernel source to see if I can find the correct files there.
sduvick said:
Haha I hear that. I guess I was testing it out using the wrong buttons before, as I didn't get that popup before. Now I was able to, but it looks like it's only for certain keys. At any rate, let me look in the kernel source to see if I can find the correct files there.
Click to expand...
Click to collapse
I will donate money to this project. No ****ing joke. I wanna see this **** happen.
$50 is what I'm putting down at the moment. I'll put down more if more coders want to help out sduvick and make this work wonderfully.
Requirements,
01. Have all the features which the OP is attempting to incorporate.
02. Have a secondary .apk which allows users to modify key layout whilst using the phone.
Update/message towards chaostic: it appears that the longpress popup is coming from /system/framework/services.jar (desmali'd) com/android/server/KeyInputQueue.
On a somewhat related note, trying to find the keymaps for smileys to remove the extra alt added after the '<3' alt key if anyone might know where that is. EDIT: re-read your OP, looks like you couldn't find these either, but apparently this was fixed in the KG2 update, so maybe the kernel updates might give me more details. will update shortly.
UPDATE: found the smileys in /system/framework/framework.jar (desmali'd) com/android/internal/widget/smileys.smali
sduvick said:
Update/message towards chaostic: it appears that the longpress popup is coming from /system/framework/services.jar (desmali'd) com/android/server/KeyInputQueue.
On a somewhat related note, trying to find the keymaps for smileys to remove the extra alt added after the '<3' alt key if anyone might know where that is. EDIT: re-read your OP, looks like you couldn't find these either, but apparently this was fixed in the KG2 update, so maybe the kernel updates might give me more details. will update shortly.
UPDATE: found the smileys in /system/framework/framework.jar (desmali'd) com/android/internal/widget/smileys.smali
Click to expand...
Click to collapse
So the smilies have been found is great, but the two things of note is how difficult it would be for a regular edit, so for rom builders or themers its great, but individuals would be hard press to change it.
Just to make sure, these are the alt+w or alt+e or alt+r smilies/macros, or is it the smiliey key widgets?
Either way it gives me somewhere to look. Seems the longpress alternatives is a longshot for easy modding at this time. But ever forward. Thanks.
I would integrate it as part of the tweaks thread I've been working out of, but it's a matter of changing some very simple (once you get it extracted and desmali'd) source, just looking through one file and looking for the strings for each smiley. Mind you, this is only for the smiley button itself, that is the popup that appears in messaging when you try to use the smiley button. This doesn't really relate at all to the keyboard at all actually.
Any key presses are gonna be from the kernel somewhere, still waiting on the download, samsung's opensource server is slow as balls.
Works great; how to edit
I just did this and it solved one of my two huge dissatisfiers with the Sk4G over the G1 and the actual original Sidekicks (where I was one of the people who convinced them to add | and ` and ~ back at Danger).
I really wanted to type ` by itself, so I edited my keymap so that [email protected] is ~ but alt-~ is `. I did this using emacs, with hexl-mode, and it was a snap!
Also, even though I've used adb in the past, I got stuck at su and it did nothing. I realized I needed to be running the SuperUser app first, and once I did that and ^C'd out of the su, it prompted me and I allowed it to remember shell request, and everything from then on worked great!
Thanks!
Leigh.
Glad it Helped someone
Can you hack the keyboard to allow virtual keyboard to work while in landscape mode?
Thanks that is awesome
This was really helpful.
I'm been bothered with the funky behaviour of shift+0-9
I also mapped alt-a a to escape
and changed alt-q from space to really being tab
The .kl file was also interesting:
/system/usr/keylayout/s3c-keypad.kl
It is just a textfile, so easy to edit and I was able to remap the mostly useless SMILEY key to GRAVE.
which is helpfull when I need a ~.
The .kl file also has all the other buttons on the SK4G so they can be reassigned.
I moved VOICE_INPUT to what was MULTITASKER, so I can enter voice commands without opening the keyboard.
and made myself a ALT_LEFT.
Smart Quote-enabled Physical Keyboard
First off, a huge thanks to chaostic_2k1, whose hack of the Sidekick 4G keyboard is brilliant. It was the only one I could find, and his instructions are first-rate. Using his modified s3c-keypad.kcm.bin file, I’ve been able to concoct a keyboard that has all of his fine variations along with smart-quote and easier em-dash ability.
If users are trying to write a professional manuscript, they need smart quotes (curly quotes), em dashes, and ellipses. The attached file has these modifications:
ALT-f = left double quotation mark
SHIFT-ALT-f = still gives the left bracket
ALT-g = right double quotation mark
SHIFT-ALT-g = still gives the right bracket
[These brackets are also stock-accessible with ALT-space]
[Right and left double quotation marks are stock-accessible with ALT-k, long press, etc. The keystrokes in this file cut down the number of steps]
ALT-lowercase L = right single quotation mark (curly apostrophe)
SHIFT-ALT-lowercase L = straight apostrophe
ALT-t = regular hyphen
SHIFT-ALT-t = em dash
[The em dash is still stock-accessible with ALT-t, long press, etc.]
The ellipsis is stock-accessible with ALT-space. I didn't modify anything connected with the ellipsis.
Follow the instructions in the first post of this thread for proper s3c-keypad.kcm.bin copying into /system/usr/keychars
Root obviously a must, and I used Total Commander file manager to copy file from sd card to /system/usr/keychars
If using Total Commander, remember to change /system directory to read-write.
Proper screen display of smart quotes: neither ThinkFree or Kingsoft word processors will display the actual right and left double quotes, though the quotes will enter correctly and display on a desktop word processor, printer, etc. In order to see double quotes correctly, users must use QuickOffice or TextMaker word processors [for reasons I can’t figure, KingSoft doesn’t even allow ALT-space or any SHIFT-ALT keystroke].
This keyboard mapping works on my Sidekick 4G, but I take no responsibility for any problem. I’ve also hacked the /system/usr/keylayout/s3c-keypad.kl to change key 54 SMILEY to key 54 TAB WAKE_DROPPED
This changes the SMILEY to a proper tab.
Do take care with the /system/usr/keylayout/s3c-keypad.kl If you screw it up, all physical keys, including Menu, etc, are dead, and you have to touch-screen the restoration of the original file. A little scary.
EDIT/UPDATE: Attached is the kcm file with an additional character: the left apostrophe. SHIFT-ALT-k = left single quotation mark
This is needed for smart quote usage when quoting within double quotes: "So when you said 'yes,' you really meant no."
Jake

Anyone else use their transformer as a laptop via Splashtop? Remap keys..

I'm using the Transformer + Dock + Mycloud (Splashtop) to remote desktop into my desktop. It is used as my laptop since it does pretty much everything I need it to. I don't game so watching movies, surfing the web, documents, email, etc. all are smooth and awesome. I view it as a super awesome and fast laptop since the processing is done by my desktop, with excellent 10-14 hour battery life and an awesome screen.
There's ONE thing that bugs the crap out of me. The damn RIGHT CLICK. Since there's no right click, but instead a LONG CLICK.. whenever I try to copy and paste anything it is a very tedious and annoying task. Using the remote desktop mouse to highlight is not as smooth as using a regular mouse but it's not a big deal but afterwards, holding the highlight with a Long Click causes all sorts of issues. Sometimes it will UNhighlight the selection, or if it's a link it will open the link instead, etc.
The only way around this is a copy and paste keyboard hotkey but since I use mac OSX, there's no Command key on the transformer dock. (Command + C is copy and Command+V is paste). Does anyone know how to bypass this issue? All I need really is Copy, Paste and Find which all require the Command button.
Ideally I'd like to be able to reroute the Alt or Search key on the Transformer to be the "Windows"/"Command" key but there's no such thing.
I also looked in Mac OSX system pref to switch the option and command keys but it changes those for the keyboard, NOT the actual function for the operating system. meaning if I swap Alt with Command, it will work from my desktop keyboard and will not work from my Transformer dock cause it's still being read as "Alt". Which makes no sense...
is there some way to remap the command the key System wide or change the hotkeys system wide? or some kind of hotkey software that I don't know about?
I found an alternative.
I did a search for a list of Mac OSX hotkeys and it looks like Control+C and Control+V aren't used much. Ctrl +V is used to get to the end of a paragraph or something at the document, which is useless to me so I used this to remap individual functions. http://lifehacker.com/343328/create-a-keyboard-shortcut-for-any-menu-action-in-any-program
basically, it will allow me to choose any function in any program and remap the hotkeys. So currently I have changed my Cmd+C/Cmd+V for Copy/paste to Control+C/Control+V like how it's done in windows. Also changed the "Find" function Control+F from the original Cmd+F.
This allows my transformer to make use of the control button and copy/paste/find... minimizing my need for the stupid "long-click in order to right-click" issue.
Control +UP does an Expose of my windows, Control + Left and Control + Right switches between desktop spaces.
Rerouted the BACK button on the transformer to be "ESC" and changed the Bluetooth toggle to be BACK. Pretty much have a fully functioning super laptop at my disposal now.... Bottleneck being my internet/wifi strength.
I only use SplashTop for accessing things like Xfinity TV, that won;t do video on Android.
Sent from my Transformer TF101 using Tapatalk
i wish rdp or vnc were as awesome as splashtop
Sent from my Transformer TF101 using xda premium

[Resolved] (SOLVED) Android 4.4.2 Keyboard Driver for Bluetooth keyboard

I have been successfully using a Bluetooth keyboard on all my android devices operating on Android 4.0.4, 4.1.11, 4.2.2 etc. Recently I bought a tablet with Android 4.4.2 and my Bluetooth keyboard doesn't work correctly on this . It does pair but the prints different characters for keys pressed. None of the numbers print for the correct input and also some letters .. eg when I press 'w' it prints 'z' and many similar errors. My tablet is 10.1 inch Polaroid MID4x10 and it works well for all other applications and the battery lasts for over 5hrs when playing 720p movies. It has GPS as well.
I believe that this version 4.4.2 of Android has been loaded with a wrong keyboard driver.
Any help will be highly appreciated.
Mabboseg said:
I have been successfully using a Bluetooth keyboard on all my android devices operating on Android 4.0.4, 4.1.11, 4.2.2 etc. Recently I bought a tablet with Android 4.4.2 and my Bluetooth keyboard doesn't work correctly on this . It does pair but the prints different characters for keys pressed. None of the numbers print for the correct input and also some letters .. eg when I press 'w' it prints 'z' and many similar errors. My tablet is 10.1 inch Polaroid MID4x10 and it works well for all other applications and the battery lasts for over 5hrs when playing 720p movies. It has GPS as well.
I believe that this version 4.4.2 of Android has been loaded with a wrong keyboard driver.
Any help will be highly appreciated.
Click to expand...
Click to collapse
Check your keyboard settings Make sure that your keyboard is set up for the right country/language.
Because there is not a specific forum for your device, this thread will be moved to general/help
sd_shadow said:
Check your keyboard settings Make sure that your keyboard is set up for the right country/language.
Because there is not a specific forum for your device, this thread will be moved to general/help
Click to expand...
Click to collapse
The Keyboard setting is (Android Keyboard (AOSP) English US), I guess it's ok.
But ... I have been looking around in the tablet and maybe discovered something:
The files used by the bluetooth keyboard are "Generic.kcm & Generic.kl" and that is the cause of the problem. The codes set in this file are NOT for qwerty layout. eg key marked 'Q' is assigned to character 'A' etc. These are in /system/usr/keychars, and /system/usr/keylayout folders respectively.
However ...there are qwerty.kcm & qwerty.kl files there as well in this same folders and they have the correct code assignment to the keys, but, I have no idea how to do settings to use them.
My tablet is not rooted and there is nothing available at present for rooting this device so I can't rename the files.
Any idea as to how to change to qwerty might solve the problem and will be of gr8 help to me.
Mabboseg said:
The Keyboard setting is (Android Keyboard (AOSP) English US),
Click to expand...
Click to collapse
No, that is wrong. That is a android touch screen keyboard
under that should be
Physical Keyboard
then the name of the physical keyboard
mine is Dell BT keyboard
tap on name>set up keyboard latouts
sd_shadow said:
No, that is wrong. That is a android touch screen keyboard
under that should be
Physical Keyboard
then the name of the physical keyboard
mine is Dell BT keyboard
tap on name>set up keyboard latouts
Click to expand...
Click to collapse
There is no other keyboard shown apart from that. I believe (99% sure) that when I am using a basic Bluetooth keyboard it uses code settings from 'Generic.kcm'. I can also see that for internal built in pop-up keyboard it uses 'virtual.kcm' . I am working through this problem and soon I should conquer this problem
(I can't find any way of attaching a picture to this xda forum)
Problem Solved
The problem with my tablet is SOLVED now.
First I had to root the tablet using the method given here:
http://forum.xda-developers.com/android/help/polaroid-p10-tablet-t2965944/post57415782#post57415782
Later I copied a file and renamed it. the actual steps are as follows:
(1) Rename /system/usr/keychars/Generic.kcm -> Generic.bak
(2) Copy /system/usr/keychars/qwerty.kcm and paste it in the same directory. The new file will be pasted as Copy.qwerty.kcm
(3) Rename the Copy.qwerty.kcm -> Generic.kcm
All the above operations were done using the app called Root_Explorer_v2.17.2.apk (Free App)
Make sure to mount the folder r/w before making the changes, after changes are complete than mount it back to r/o.
Now everything is running as good as Gold.
Rooting has made the tablet more fast to boot up and run. Love it now
This was done after so much of reading through the forums and working things out as it applied to my case.

Categories

Resources