[TUTORIAL] How to remap Android Hardware keys

EssoAir

Well-Known Member
Joined
Dec 13, 2012
Messages
1,829
Location
Knoxville/Seattle
This is a tutorial on remapping the Android hardware keys


First, you will need to download Jota+(Text Editor) from the Play Store (the Android Market)


Now, download Root Browser (free or Pro will both work)


Now, open up the Root Browser and go to /system/usr/keylayout


Copy all the contents of that folder to /mnt/sdcard2/[WHATEVER YOU WANT TO CALL THIS FOLDER]


Now, copy the folder you just created above (containing the four files) and paste it back into the its self. Then rename this new sub folder "Backups" or "Originals"


Now, open Jota+, go to "menu" and click "file"


Click "Open..."


Navigate to the folder with the four .kl files and the Backups folder


Open gpio-keys.kl


change key 29 from "BUTTON_SELECT" to "BACK"


change key 56 from "BUTTON_START" to "MENU"


(you can make it whatever you want, really)


Here is a list of default key codes in Android http://code.google.com/p/androhid/wiki/Keycodes


save and exit.


Open Root Browser and copy gpio-keys.kl to /system/usr/keylayout and delete the old one


(delete the original before hitting "Paste)


Now, launch the "Kill Android" app, then relaunch android and confirm that the "Select" button now acts as the menu button and the "Start" button now acts as the back button.


Unfortunately, the coding for the nubs is incomplete and so I'm at a dead end here. Right_Nub_Down is mapped to Keycode 82 and Right_Nub_Left is mapped to keycode 4 but other than that, the nubs have no key functionality and so as far as I can tell, you can't change what they do. If anyone wants to look around and see if they can find a way, please post below!


Thanks,


CJ


Here is a helpful tool, btw: https://github.com/chrisboyle/keytest/KeyTest.apk/qr_code


(It tells you the keycode for the key you're currently pressing. The only thing it lacks is the ability to show the code for anything mapped to "HOME" simply because doing so quits the app before it gets the chance to record the data)
 
Last edited by a moderator:

EssoAir

Well-Known Member
Joined
Dec 13, 2012
Messages
1,829
Location
Knoxville/Seattle
Just so everyone is clear, I'm looking into joystick and mouse mapping, but I thought I would go ahead and post this so everyone can see and possibly help out.
 

itami

Still Fresh
Joined
Mar 7, 2011
Messages
71
Unfortunately, the coding for the nubs is incomplete and so I'm at a dead end here. Right_Nub_Down is mapped to Keycode 82 and Right_Nub_Left is mapped to keycode 4 but other than that, they nubs have no key functionality and so as far as I can tell, you can't change their functionality. If anyone wants to loom around and see if they can find a way, please post below!
I don't know if it would help but, changing the nub settings in Armstrong changes the behavior in Android.
 

EssoAir

Well-Known Member
Joined
Dec 13, 2012
Messages
1,829
Location
Knoxville/Seattle
Unfortunately, the coding for the nubs is incomplete and so I'm at a dead end here. Right_Nub_Down is mapped to Keycode 82 and Right_Nub_Left is mapped to keycode 4 but other than that, they nubs have no key functionality and so as far as I can tell, you can't change their functionality. If anyone wants to loom around and see if they can find a way, please post below!
 
 
I don't know if it would help but, changing the nub settings in Armstrong changes the behavior in Android.
Can you elaborate? Do you mean to say that you can map all 16 directions (8 from each nub) to key actions?
 

itami

Still Fresh
Joined
Mar 7, 2011
Messages
71
Unfortunately, the coding for the nubs is incomplete and so I'm at a dead end here. Right_Nub_Down is mapped to Keycode 82 and Right_Nub_Left is mapped to keycode 4 but other than that, they nubs have no key functionality and so as far as I can tell, you can't change their functionality. If anyone wants to loom around and see if they can find a way, please post below!
 
I don't know if it would help but, changing the nub settings in Armstrong changes the behavior in Android.
Can you elaborate? Do you mean to say that you can map all 16 directions (8 from each nub) to key actions?
No, what I meant was that setting the nubs in Angstrom to mouse movement, mouse buttons, scrolling or joystick the behavior of the nubs change in Android (scrolling does change the nub to pageup/down I think). So what I was thinking maybe setting the nubs to another function the keycodes 82 and 4 change.

The app Game Keyboard supports analog controls, so maybe there is a way to change them in Angstrom so that they get recognised.
 

EssoAir

Well-Known Member
Joined
Dec 13, 2012
Messages
1,829
Location
Knoxville/Seattle
Unfortunately, the coding for the nubs is incomplete and so I'm at a dead end here. Right_Nub_Down is mapped to Keycode 82 and Right_Nub_Left is mapped to keycode 4 but other than that, they nubs have no key functionality and so as far as I can tell, you can't change their functionality. If anyone wants to loom around and see if they can find a way, please post below!
I don't know if it would help but, changing the nub settings in Armstrong changes the behavior in Android.
Can you elaborate? Do you mean to say that you can map all 16 directions (8 from each nub) to key actions?
No, what I meant was that setting the nubs in Angstrom to mouse movement, mouse buttons, scrolling or joystick the behavior of the nubs change in Android (scrolling does change the nub to pageup/down I think). So what I was thinking maybe setting the nubs to another function the keycodes 82 and 4 change.


The app Game Keyboard supports analog controls, so maybe there is a way to change them in Angstrom so that they get recognised.
I tried it out with both of them set as Joysticks, but GameKeyboard and the KeyTest app do nothing. Thanks for the sugestion, though
 
Last edited by a moderator:

mcobit

Advanced Member
Joined
Jul 28, 2008
Messages
6,910
Thanks, this is useful information. Even though I don't use Android on the Pandora.
 

MarioPandio

Well-Known Member
Joined
Aug 28, 2010
Messages
1,378
Location
Half way up the stair
Nice tutorial Seeeejaaaay, hope you get further with the other issues but will definitely be using this when my 1ghz unit arrives. 
 
Last edited by a moderator:

EssoAir

Well-Known Member
Joined
Dec 13, 2012
Messages
1,829
Location
Knoxville/Seattle
Thanks, this is useful information. Even though I don't use Android on the Pandora.
Nice tutorial Seeeejaaaay, hope you get further with the other issues but will definitely be using this when my 1ghz unit arrives.
Happy to help you guys! I am new to the Open Pandora but I have been a part of the Android community for a very long time. (Android came out in 2008, I got a Droid 1 in 2009). I love the OS very much and use it on almost everything I can.

I did some more research and testing and aparently the Nub configurator truely does reprogram the funtionality of the nubs. Which seems great on the surface, except when you choose "joystick" it's not a platform that Android recognizes (can someone post more info on these -- I think the term "libraries" is in order) Also, when you set them both as Joysticks, they are recognized by the Pandora as the same joystick wich makes having two of them is rather pointless.
 
Last edited by a moderator:

itami

Still Fresh
Joined
Mar 7, 2011
Messages
71
I installed RTCW on Android today and I could use a nub as a mouse.  Mouse buttons are not working... using left en right shoulder buttons for that.

So with the right program(ing) Joystick would also be possible?
 

EssoAir

Well-Known Member
Joined
Dec 13, 2012
Messages
1,829
Location
Knoxville/Seattle
I installed RTCW on Android today and I could use a nub as a mouse. Mouse buttons are not working... using left en right shoulder buttons for that.


So with the right program(ing) Joystick would also be possible?
But when set as a Joystick, Android fails to recognize the nubs. I messaged ED about adding a new android-specific option to the nub configurator
 
Last edited by a moderator:

Mr_Loon

Can't Remember
Joined
Aug 30, 2010
Messages
2,329
Alternative guide using a slightly different method here.

Left shoulder for back works really well for me with Android, however it's easy to change the buttons for your individual requirement.
 
Last edited by a moderator:

EssoAir

Well-Known Member
Joined
Dec 13, 2012
Messages
1,829
Location
Knoxville/Seattle
Alternative guide using a slightly different method http://boards.openpandora.org/index.php?/topic/8932-how-to-remap-android-buttons-to-pandora-controls-guide/#entry160871'>here.
 
Left shoulder for back works really well for me with Android, however it's easy to change the buttons for your individual requirement.
Oh. I didnt realize that anyone else had mentioned this on this forum yet. But what is different about it? The methods look the same to me.
 

EssoAir

Well-Known Member
Joined
Dec 13, 2012
Messages
1,829
Location
Knoxville/Seattle
 
But what is different about it? The methods look the same to me.
 
See steps 4&5 in the guide (performed under 'normal' Linux OS) & http://boards.openpandora.org/index.php/topic/8932-how-to-remap-android-buttons-to-pandora-controls-guide/?p=160868'>this explanation from Neelix as to how the PND system works.
Which method do you find to be better? Personally, I like keeping Android a stand alone thing so that if I uninstall it, Angstrom will be unchanged from how it was before I installed Android
 

danielo515

Member
Joined
Dec 26, 2012
Messages
207
But what is different about it? The methods look the same to me.
See steps 4&5 in the guide (performed under 'normal' Linux OS) & this explanation from Neelix as to how the PND system works.
Which method do you find to be better? Personally, I like keeping Android a stand alone thing so that if I uninstall it, Angstrom will be unchanged from how it was before I installed Android
I think you are a bit confused about this.

The method the buddy describes will leave Angstrom untouched, if your uninstall or not android, because they just  put a file in the appdata of the android PND, which actually only affects android.
 
Last edited by a moderator:

EssoAir

Well-Known Member
Joined
Dec 13, 2012
Messages
1,829
Location
Knoxville/Seattle
Wonderful! Honestly, to me it doesn't matter. Anyone is free to do it how they wish, I just personally prefer my own method.
 
Top