[Q] Mapping volume keys to HOME, BACK and possibly more - HD2 Windows Mobile 6.5 Q&A, Help & Troubleshooting

My HD2 "Frankenphone" (it's built from no less than 3 other HD2's) has no working hardware keys on the front of the phone. The volume keys, however, do still work. I therefore want to cook a rom based on an existing one that has Volume up/down mapped to HOME/Back.
Furthermore, I was wondering if I could somehow get the MENU button implemented as well. I understand that this is not possible through the SDK, but perhaps it can be done by writing native C code. E.g. a longpress Volume-up could be menu, a long-press Volume-down could be search.
I'm not asking for someone to do this for me, I'd like to do this myself. What I'm looking for are a few quick pointers to how to start this endeavor. I have previous experience cooking custom roms using toolchains under linux, and also experience writing C (non-gui) code under linux. So useful pointers would be :
* Where can I find the key mappings? I suppose this is part of the kernel/user space?
* How would I go about implementing the long-press feature? Or can you hint towards another possible solution that does not involve the front hardware keys (touchscreen snooping for gestures? accellerometer? Any other sensor?)

Take a look here:
http://source.android.com/porting/keymaps_keyboard_input.html
Hope that helps.
One thing I do in most builds is change my call key to a search key.

Hi!
Take a look at the following thread! http://forum.xda-developers.com/showthread.php?t=740629

paalkr said:
Hi!
Take a look at the following thread! http://forum.xda-developers.com/showthread.php?t=740629
Click to expand...
Click to collapse
Awesome, thanks! That worked like a charm. Mounted the system.ext2 loopback, patched the keys, and tadaah, working home + back. That at least makes the phone usable again.
Can anyone recommend a solution to get a working MENU action? It looks like long-press back is handled by apps individually (e.g. in the browser it will show a history), while long-press home displays a task switcher. I could live with long-press back being handled by android itself to implement the menu function.
(edit) looks like this is possible, e.g. here it mentions "including some special features to support the virtual hard keys that are appearing on recent devices such as Droid." Now how did they do that?

Related

[APP][24JUN2010]VolDpad: Use the volume buttons as a d-pad; New: Source code avail.

I have changed my Diamond bay a Touch HD and what I miss more is the d-pad.
I really need it because I read a lot on my device and it is necessary to turn pages, etc. So I searched for a solution.
I've using remaping keys programs for some days, but they are big and have some limitations so I've done my own program with a very simple behaviour:
-Volume UP is remaped to d-pad UP. Can be hold for autorepeat.
-Volume DOWN is remaped to d-pad DOWN. Can be hold for autorepeat.
-Double click Volume UP is remaped to d-pad LEFT. Does not support autorepeat.
-Double click Volume DOWN is remaped to d-pad RIGHT. Does not support autorepeat.
-Double click with hold in Volume UP is remaped to d-Pad RETURN with Hold.Does not support autorepeat.
-Double click with hold in Volume DOWN is remaped to d-Pad RETURN.Does not support autorepeat.
-If a call is being established or is active the volume keys will behave normally.
-Running the file a second time will close the resident with a small tone.
The program is small (7Kb) and remain resident without making use of CPU, it is simply a keyboard hook.
To install it copy the file werever you want and execute it. If you want it to start automatically after a Soft Reset make a link (DO NOT PUT THE FILE DIRECTLY) under \Windows\Startup or your locale equivalent.
REVISIONS
June 24, 2009: I've liberated the source code in order to allow other developers to improve the concept!!
August 28,2009:
-Soved the Back Arrow issue on HTC devices.
-Added support for unloading the program
-First try to add suport for Return-Hold (Context menus)
IMPORTANT
Some users are having issues with VolDpad on HD2 and Diamond 2. This one solves the issue:
http://forum.xda-developers.com/showpost.php?p=8062091&postcount=4
Hope it will be useful
If you like it and want to give me a buck please use this button:
Thanks to the following donators:
Johannes B., Federico, Mike P., Marie-Françoise H.,
DOWNLOADS
Download VolDpad from my site.
really nice app
but does it work in touch pro 2 ?
I've tested it only on a Diamond and on a Touch HD.
But the technology should be the same for the TP2
well this is brilliant! and it works great on my blackstone.
few suggestions:
- it would be a good idea to have command-line support so that you can turn it on and off easily by creating shortcuts or assigning hardware buttons to enable or disable it, or having a status check so that if it's on, next time you run it will turn it off and vice versa.
-it would be great to have both the "ok" button support and the "hold ok" button support so that you can load "right click" menus.. (you can have the upper vol button function as "ok" and lower vol button function as "hold ok")
wonderful work
it works perfectly on my HD!
Virtual button interrupt on HD?
hi all,
installed this on my HD and it works well, but i notice that when i try to use the virtual button to go <Back> (looks like a left arrow <-- ), now it goes up instead.
anyone else have this issue?
This is a fantastic app, will be useful specially for those who play games on their phone. One query; is there a way to remap the vol key buttons? For example can volume up key be mapped to left key, and volume down key mapped to right key. I say this because in Diamond and Touch Pro the Up and Down key on D-Pad functions normally, its only the left key and the right key that has a problem.
I just check - program works good on samsung i780. Is it possible to disable left/right/return function, but remain only up/down? Could you please add (in future version) any configuration file?
Best regards
Tomasz
lifeisaparody said:
hi all,
installed this on my HD and it works well, but i notice that when i try to use the virtual button to go <Back> (looks like a left arrow <-- ), now it goes up instead.
anyone else have this issue?
Click to expand...
Click to collapse
Same here on the Diamond 2, otherwise, fantastic stuff! If we can either get the Back Arrow button to act like the OK, or return it to its former glory, we are good to go!
Brillant, and I agree with the ML idea
fantastic. been looking for something like this for my touch hd
Awesome app! It works great with mobipocket. You can easily start/kill it with mortscripts (put links in the start menu, and you can do it with voice command). Edit the path as necessary.
kill("\Program Files\VolD-Pad\VolDpad.exe")
run("\Program Files\VolD-Pad\VolDpad.exe")
well done job
Nice work thx
vol buttons as a d-pad
Hi....anyone got it working for worms world party?? Kinda miss that game after changing from a kaiser to a blackstone....
thanks in advance.
Great App! Thanks!
Great stuff. I would add my vote to remove the left/right functionality and replace with 'OK' and 'context menu' support. I miss my Kaiser scroll wheel
It is difficult to do smething that will be perfect for all
I'll try to add support for exiting the program (easy) and for context menus (more difficult).
I also revise the issues with the back key.
EDIT: Done
One thing, What context menu can be reached with holding return? I wish to know for testing it
Thanks
Usefull app, I will get use to it.
Does not work for the TG01! After soft-reset it hijacks the bluetooth, switching it on and removing the BT link from the comm manager. It will not allow delete from any folder where it is copied! even the shortcut will not delete. (Had to manually disable the BT, then it auto deletes the shortcut, andyou can delete from a secondary folder. After soft-reset it will again delete from Primary folder, releasing control of the BT!)

[Q] nook "n" mapper

Does anyone know if it would be possible to write an app that would re-map the nook "n" (home) to open up a small popup, that would give access to all four of the main android buttons? i.e., home, back, menu, search. (similar popup to the long press home to 'recent programs' list that android has), maybe even adding the recent programs too?
That way we could still get home, but it wouldn't be impossible to use standard android programs because of the lack of hardware keys.
I loaded "Alidko," which works great, but once I open a book, I have to read the whole thing to get back to the main app screen since there is no 'back' button.
EDIT:
Someone made it
http://forum.xda-developers.com/showthread.php?t=860153
I am an iOS coder, but, looking at the docs, not only does this appear possible, it doesn't look like it would be too difficult for an android coder that knows their way around.
I believe the right thing to do would be, in order of preference/elegance:
1. Have a "long press" on the nook/home key expose the status bar via a "service" that listens for and captures this even
2. Have a "long press" on the nook key display a window that shows a set of "soft keys"
kaicherry said:
I am an iOS coder, but, looking at the docs, not only does this appear possible, it doesn't look like it would be too difficult for an android coder that knows their way around.
I believe the right thing to do would be, in order of preference/elegance:
1. Have a "long press" on the nook/home key expose the status bar via a "service" that listens for and captures this even
2. Have a "long press" on the nook key display a window that shows a set of "soft keys"
Click to expand...
Click to collapse
A solution was posted here:
http://forum.xda-developers.com/showpost.php?p=9556837&postcount=1 to remap the volume keys. Although not as elegant as an app would be, it works great. I have my volume up key remapped to "MENU" and volume down as "BACK".
In Aldiko it works perfectly.
That is a good temporary solution, but I would personally not like to loose the volume functionality.
Anyone think they could make a pop-up like that? I am not sure how hard it would be to make the pop-up send the 'softkey' to the other app and not just close itself (i.e., back)...
Answered!
http://forum.xda-developers.com/showthread.php?t=860153

[IDEA] Vol +/- Key Intercept for added Menu/Back functionality

Just wondering about the feasibility of (someone with the know-how) creating a background app/service that could monitor and intercept the Nook's Vol+ and Vol- buttons, and if held down for a certain amount of time, perform Menu or Back actions as well.
I would think this possible, based on CM ROMs' ability to skip forwards/backwards from the lockscreen when music is playing, as well as the official XBMC Remote's abililty to change the volume for media playing on an XBMC box without interfering with the volume on the actual Android device.
Under the stock BN ROM I had remapped the Vol buttons, which wasn't a problem since the speaker was barely audible in the first place, but since flashing Dalingrin's OC kernel with the increased volume, I (happily) find the need to be able to change the volume levels easily.
I can't be the only one who's pondered this, but I've read through most of the threads and don't recall seeing this anywhere... If I've missed it, please point me in the right direction.
Thoughts? Takers?
Thanks.
You mean like this easily flashable script in the development forum (page 2).
http://forum.xda-developers.com/showthread.php?t=965023
I am talking an app which would retain volume functionality if the buttons are pressed briefly, as well as implement menu / back functions if held.
Unfortunately it looks like that script you linked to simply remaps the volume keys to menu and back -- without retaining volume functionality:
EpicFail236 said:
[...]
I find that my need for physical menu and back buttons is greater than my need for physical volume buttons.
[...]
This zip is CWM flashable, and simply overwrites the keymap kl files with ones that have the volume buttons remapped.
[...]
Click to expand...
Click to collapse
Not exactly what you want, but a simple solution.
see this, tip #7. Its a simple edit to a text file.
Worked on CM7, heres my edited /system/usr/keylayout/qwerty.kl vol up=menu, down=back
Thanks; unfortunately that is the essentially same as sparhawk's solution, and what I did under the BN ROM.
What I'm looking for is a solution via an application that retains the volume button functionality and augments the buttons with menu/back ability and does not simply remap the volume buttons.
If I had the slightest inkling as to how to do this myself, I would. Unfortunately I've tried and failed (miserably) so far at attempting to learn coding for Android.
I was hoping someone might be familiar with the way CM and XBMC Remote handle these intercepts and be able to adapt code, or create something similar for menu/back functionality.
I get what you are saying, but I don't think it would be possible. Notice how if you hold it down now, it will turn the volume down all the way step by step. When the screen is off, it doesn't do anything. If it was made to be held down to switch function, you would lose the ability to turn down the volume by holding it down. I know what I said is confusing, but just think about it lol. Have you thought about remapping tthe keys totally to menu/back, and then having a sound toggle in the pull down widget for the notification bar? You wouldn't have total control over the levels, but at least its something.
Sent from my ADR6300 using XDA App
Xephik said:
I get what you are saying, but I don't think it would be possible. Notice how if you hold it down now, it will turn the volume down all the way step by step. When the screen is off, it doesn't do anything.
Click to expand...
Click to collapse
I am running CM7 n11 on the nook, and regardless of whether the screen is on or off: if music is playing, when I hit the volume button, the volume level is changed. Not sure what you're referring to.
Xephik said:
If it was made to be held down to switch function, you would lose the ability to turn down the volume by holding it down.
Click to expand...
Click to collapse
I don't necessarily think that's the case.
Example: somehow CM is able to retain volume functionality and add skip next/previous track in music player. When I refer to the ability of CM to skip forward/backwards when music is playing, I am basing this on my experience with CM6.12 on my Droid1.
Xephik said:
Have you thought about remapping tthe keys totally to menu/back, and then having a sound toggle in the pull down widget for the notification bar? You wouldn't have total control over the levels, but at least its something.
Click to expand...
Click to collapse
Yeah, done that and didn't love it. I believe a solution such as I'm suggesting would be much more "integrated," elegant, and convenient.
Basically the app would intercept a volume button press:
- brief press: button release < 300ms, app performs volume function
- long press: button held down or release > 300ms, perform back or menu
Are there any experienced devs who provide some insight?
tj!2k7 said:
Thanks; unfortunately that is the essentially same as sparhawk's solution, and what I did under the BN ROM.
What I'm looking for is a solution via an application that retains the volume button functionality and augments the buttons with menu/back ability and does not simply remap the volume buttons.
If I had the slightest inkling as to how to do this myself, I would. Unfortunately I've tried and failed (miserably) so far at attempting to learn coding for Android.
I was hoping someone might be familiar with the way CM and XBMC Remote handle these intercepts and be able to adapt code, or create something similar for menu/back functionality.
Click to expand...
Click to collapse
I've seen this behavior to control the Android music player. And honesty I don't see why it couldn't be adapted to throw a back or home interrupt. But to implement it is beyond me!
Here is a GitHub repo to handle the Android player on long press up and down but also still handle volume changes on short press.
https://github.com/metalhead8816/android_frameworks_policies_base
And I'm pretty sure the specific commit would be
https://github.com/metalhead8816/an...mmit/7504617a9211a65ce767281c59668e8641b8a14d
Mat Sumpter said:
Here is a GitHub repo to handle the Android player on long press up and down but also still handle volume changes on short press.
https://github.com/metalhead8816/android_frameworks_policies_base
And I'm pretty sure the specific commit would be
https://github.com/metalhead8816/an...mmit/7504617a9211a65ce767281c59668e8641b8a14d
Click to expand...
Click to collapse
We're on a better path now. Thank you for posting concrete evidence of the volume buttons serving two simultaneous functions.
Could that code be used as a base for a standalone background app/service to implement the desired functionality? Better yet if it could be built into a ROM such as CM, but a standalone app would be perfect.
As this is really a question for devs, should I have posted this thread in the dev forum?
This code was put in for eclair so it won't apply cleanly to the Froyo code. But I'm sure a DEV with good Java knowledge could hack this into the current policy framework. From the code this appears pretty integral so I doubt this could be an outside apk that we install. This would likely be an alternate framework we'd need to apply to a ROM much like a style. But again I'm not an Android developer so I don't know for sure.
Button remapper works for the simple remapping, but not for the longpress actions.
I have half a mind to attempt writing a simple service for this
long press menu->vol up in 20% increments
long press back->vol down in 20% increments (may interfere with CM7 long press to kill functionality)
http://android-developers.blogspot.com/2009/12/back-and-other-hard-keys-three-stories.html
http://stackoverflow.com/questions/4983605/send-button-volume-button-action-listeners
http://developer.android.com/reference/android/view/KeyEvent.html
A service sounds (to a non-programmer such as myself) like it would be less involved than framework modifications, and portable across ROM updates.
And personally, I don't mind "losing" long-press-kill functionality as I never use it anyway... I'd love to see some progress along these lines... go for it. =)
If you decide to attempt create a service for this, could you be make the long/short actions customizable?
i.e. :
Short press Vol+: Volume up / Long-press Vol+: Menu
Short press Vol-: Volume down / Long-press Vol-: Back
vs.
Short press Vol+: Menu / Long-press Vol+: Volume up
Short press Vol-: Back / Long-press Vol-: Volume down
In most applications, Menu and Back are usable via the status bar; since that functionality would be redundant, it would be nice to retain quick access to volume for short presses. For instances where Menu and Back are not usable in full-screen applications, long-pressing the buttons to perform menu and back actions doesn't seem like much of an issue.
Actually, if the Menu and Back were long-press actions, couldn't you implement functionality to kill the current app if Back was held for a specific amount of time?
Just thought I'd bump this back to the top... any devs out there who might want to take a crack at something like this?
Until we get Honeycomb AOSP this "hack" would be perfect!
I'm on the lookout too. I'd much rather have my vol up and down keys then have them as back and home. Unfortunately I lack the skills to code it so far!
My prayers, answered. Thanks mad-murdock.
http://forum.xda-developers.com/showthread.php?t=1002000&page=23

[Q] Possibility of remapping Mouse buttons?

So I've done a search on Google and Xda about this topic and so far there doesn't seem to be much information on this except to find a thread about the inability of the android system in remapping of keys (or maybe the thread just went out of topic)
Thread; http://forum.xda-developers.com/showthread.php?t=1244702
So I'm wondering whether the remapping of the right click button to give a command 'Open Context Menu' is possible to immitate the function of a real computer (All these taking into consideration that it is also possible to remap buttons of the dock)
If you were to have it mimic the behavior of a real computer it wouldn't work. Android uses a right mouse button as if you were touching and holding on an object.
The only thing i would be interested in is remapping the second button the same as the primary button. Effectively having left click and left click.
Now it shouldn't be *that* hard to make a simple program to accomplish this, simply an extension to remap the buttons to whatever android specific task you want, this is already semi possible with the remapping of soft keys in CM 10.1/AOKP builds, so something like that should be possible.
Unfortunately i have no coding experience. I would love to see this done though
Nexus 4. Paranoid edition.
No, today I search & found a solution - http://forum.xda-developers.com/showpost.php?p=55848773&postcount=7

[Q] Swap Home/Back buttons

Anyone know if it is possible to swap the mapping of the home/back buttons? I use the back button more often than the home button and find the location of the home button easier to reach in general. I realize I can't change the actual hardware icon ... looking for a software fix.
seattlecard said:
Anyone know if it is possible to swap the mapping of the home/back buttons? I use the back button more often than the home button and find the location of the home button easier to reach in general. I realize I can't change the actual hardware icon ... looking for a software fix.
Click to expand...
Click to collapse
You can try the "Xposed Additions" module that remaps hardware keys but not positive if it will work, never used it on this phone.
seattlecard said:
Anyone know if it is possible to swap the mapping of the home/back buttons? I use the back button more often than the home button and find the location of the home button easier to reach in general. I realize I can't change the actual hardware icon ... looking for a software fix.
Click to expand...
Click to collapse
There are some options that can help with this in the ViperMAX ROM:
1. In tweaks you can set custom mappings for short press, double press, long press and swipe action for the home hardware key. The same can be done for the back key (except for the swipe action, if I'm not mistaken).
2. You can enable PIE, which basically allows you to slide your finger from the side of the screen to pop-up customizable software buttons on the screen. I use this for the same reason you describe (to make my most common actions easily accessible with my right thumb). In-fact I use PIE to pop-up software buttons to do things like "back", "pull down notifications" and "home"...
If you take advantage of those tweaks, it is easily enough to suite your needs and more.
seattlecard said:
Anyone know if it is possible to swap the mapping of the home/back buttons? I use the back button more often than the home button and find the location of the home button easier to reach in general. I realize I can't change the actual hardware icon ... looking for a software fix.
Click to expand...
Click to collapse
Yes, it possible software wise. I'll pm how to. File explorer needed with root access.
It can be done with Sence or Aosp, stock or custom ROMs. I edit this ever device I have to suit my needs. I like running full screen, no status bar nor navigation bar. One reason I like my Max. Full 5.9 viewing area.
jerrycycle said:
Yes, it possible software wise. I'll pm how to. File explorer needed with root access.
It can be done with Sence or Aosp, stock or custom ROMs. I edit this ever device I have to suit my needs. I like running full screen, no status bar nor navigation bar. One reason I like my Max. Full 5.9 viewing area.
Click to expand...
Click to collapse
Could you PM me with your solution? Thanks.

Categories

Resources