How to make headset button control music on the stock ROM - G2 Q&A, Help & Troubleshooting

I'm not sure this is the right subforum for this, but I was coming here to ask how to do this before I figured it out for myself. So I figured I should post about it in case I forget what I did.
I just switched to a shiny new G2, and I'm using the one-button earphones that came with my Nexus S 4G. This is actually the third set of such headphones (I keep breaking and replacing them), so I refuse to have them not work on my rooted but otherwise stock G2.
When I first plugged them in to the G2, it was configured so that the button would control the phone function: one press would open my call history, a double press would redial, and a hold would start up voice dialer. On the Nexus S 4G, the buttons controlled my media player, so that's what I want them to do here.
I tried various button remapping tools like the JAYS Headset Control app, but none of them would take precedence over the default LG actions.
Instead, I modified this approach from the Nexus 4, and changed the key code for the button from the one that the voice dialer controls were intercepting (HEADSETHOOK) to something else (MEDIA_NEXT).
What I did:
1. Have root and install Busybox (for vi).
2. Get a root shell on the device.
Code:
$ adb shell
[email protected]:/ $ su
[email protected]:/ #
3. Mount /system as read-write:
Code:
[email protected]:/ # mount -o rw,remount /system
4. Edit the default Android keyboard layout to swap the HEADSETHOOK and MEDIA_NEXT keys.
Code:
[email protected]:/ # vi /system/usr/keylayout/Generic.kl
Press "i" to enter insert mode. Move around with the arrow keys.
Change:
Code:
key 163 MEDIA_NEXT
to:
Code:
key 163 HEADSETHOOK
And also change:
Code:
key 226 HEADSETHOOK
to:
Code:
key 226 MEDIA_NEXT
Press Escape, and then press Shift + Z twice to save and quit.
5. Reboot your device for the changes to take effect.
6. Now the button on your single-button headset is the equivalent of the "down" or "next" button on a three-button headset. To configure it, install JAYS Headset Control or a similar application. Chose the three-button headset instead of the one-button headset, and configure the third button to do everything you want your button to do.
7. Enjoy your customizable button!

Sweet! Not having my headset button work for audio was my biggest issue with the G2.
I followed the instructions above, but instead of swapping "key 163 MEDIA_NEXT" I swapped "key 164 MEDIA_PLAY_PAUSE". This caused the default behavior to be "Play/Pause".
I tried using JAYS Headset Control and it works great. Thanks for the find!

Oh my gosh! I've been looking everywhere for this solution. Thank you so much!
My dilemma was that I want to be able to use the headset buttons because I listen to music and switch tracks frequently while walking around the university. Only the Android KitKat ROMs worked for me, but the problem with those ROMs is that GPS has locking problems and/or doesn't work at all.

Thanks for this, it was helpful for me also. Like Myzur I've also used MEDIA_PLAY_PAUSE instead of MEDIA_NEXT.
I had a quick go with the "Headset Button ControllerTrial" app for some extended functionality, but it kept switching from Rhapsody to LG's music app. This was before I saw the comment about configuring things as if it were a 3 button headset, so I'll play around with this some more (and will probably also try the JAYS app). But even as-is, just the ability to play/pause is a very nice improvement over stock behavior (honestly, who uses their phone more for making calls than listening to music.. ).

doesnt work
For some reason this doesnt work with the LG G2 Sprint version, is there any other solution?

pabel101 said:
For some reason this doesnt work with the LG G2 Sprint version, is there any other solution?
Click to expand...
Click to collapse
My phone is LG G2 on Sprint (LS980), and it actually does work for me.
Since my above post, I have actually changed the mapping again to MEDIA_NEXT, and I'm using the Headset Button Controller app (https://play.google.com/store/apps/details?id=com.kober.headsetbutton). The actions in the controller app are all set under "Right button actions" (so exactly according to step 6 in the OP..).
I think any app that will let you configure things for a 3rd/right button should work. The JAYS one is free, but as I recall it asked for a permission I wasn't comfortable with, and I ended up with Kober's app instead, which I think was $2 and to me well worth it (you can barely get a coffee for that these days..). There is a free trial.
This setup works great for music controls (play/pause, next/previous, volume control), but it doesn't seem call control (answer/hangup, mute etc.) is totally working. For me this is mostly about music controls, so I'm not too worried about the call controls and haven't looked into fixing that so far.
By the way, I found out a modified Generic.kl file is enough to cause updates to fail (for ZVC anyway), so you'll want to keep a copy of the original to restore for cases like that.
If you still can't get it to work, what exactly is happening for you, and what app are you using? Did you map MEDIA_NEXT, or MEDIA_PLAY_PAUSE? The Headset Button Controller app I'm using (free trial also) has a troubleshooting feature where it displays the button presses it sees on screen, whether it takes action on it or not, which could be useful to figure things out.

doesnt work
ChoppedLiver said:
My phone is LG G2 on Sprint (LS980), and it actually does work for me.
Since my above post, I have actually changed the mapping again to MEDIA_NEXT, and I'm using the Headset Button Controller app (https://play.google.com/store/apps/details?id=com.kober.headsetbutton). The actions in the controller app are all set under "Right button actions" (so exactly according to step 6 in the OP..).
I think any app that will let you configure things for a 3rd/right button should work. The JAYS one is free, but as I recall it asked for a permission I wasn't comfortable with, and I ended up with Kober's app instead, which I think was $2 and to me well worth it (you can barely get a coffee for that these days..). There is a free trial.
This setup works great for music controls (play/pause, next/previous, volume control), but it doesn't seem call control (answer/hangup, mute etc.) is totally working. For me this is mostly about music controls, so I'm not too worried about the call controls and haven't looked into fixing that so far.
By the way, I found out a modified Generic.kl file is enough to cause updates to fail (for ZVC anyway), so you'll want to keep a copy of the original to restore for cases like that.
If you still can't get it to work, what exactly is happening for you, and what app are you using? Did you map MEDIA_NEXT, or MEDIA_PLAY_PAUSE? The Headset Button Controller app I'm using (free trial also) has a troubleshooting feature where it displays the button presses it sees on screen, whether it takes action on it or not, which could be useful to figure things out.
Click to expand...
Click to collapse
Im sooooo confused by this but is it possible for you to screen shot your settings for Generic.kl? im sorry for the late reply

pabel101 said:
Im sooooo confused by this but is it possible for you to screen shot your settings for Generic.kl? im sorry for the late reply
Click to expand...
Click to collapse
The whole file is over 400 lines long, so a bit too long to fit in a screenshot. There are only 2 lines that you will need to touch however, and they will look like this when you are done with them:
Code:
key 163 HEADSETHOOK
key 226 MEDIA_NEXT
Note that these lines are not next to each other, but they are easy enough to find as they are pretty much ordered by key "number" as you can see.
Sorry if I made things sound confusing.. the steps in the OP are maybe more clear, and exactly what you need to do to get Generic.kl modified the way mine is. Feel free to ask if you need more help/clarification though.

playpause
ChoppedLiver said:
The whole file is over 400 lines long, so a bit too long to fit in a screenshot. There are only 2 lines that you will need to touch however, and they will look like this when you are done with them:
Code:
key 163 HEADSETHOOK
key 226 MEDIA_NEXT
Note that these lines are not next to each other, but they are easy enough to find as they are pretty much ordered by key "number" as you can see.
Sorry if I made things sound confusing.. the steps in the OP are maybe more clear, and exactly what you need to do to get Generic.kl modified the way mine is. Feel free to ask if you need more help/clarification though.
Click to expand...
Click to collapse
ok i did what you said and now my middle button Just skips to next track is that alright?

pabel101 said:
ok i did what you said and now my middle button Just skips to next track is that alright?
Click to expand...
Click to collapse
Yes, this means the re-mapping of the button worked. Now you can use one of the headset control apps to program the button as you please (remember this button is now acting as the "next" or right button, so program as such).
But, you say "middle button" - do you have a 3 button headset? If yes, I think you could have left the mapping alone, and programmed either of the left/right buttons, or both. Not really sure of the best and most functional approach in this case, I've never had anything other than a single button headset. I would think with 3 buttons, if all 3 are supported, you can have some more flexibility.
If you do have a 3 button headset, but only the middle button is supported by Android at all (apparently YMMV depending on the make/model among other things), then ignore everything I just said, keep the mapping as-is, and just program the one working button as you like - still as if it were the right button.

headset
ChoppedLiver said:
Yes, this means the re-mapping of the button worked. Now you can use one of the headset control apps to program the button as you please (remember this button is now acting as the "next" or right button, so program as such).
But, you say "middle button" - do you have a 3 button headset? If yes, I think you could have left the mapping alone, and programmed either of the left/right buttons, or both. Not really sure of the best and most functional approach in this case, I've never had anything other than a single button headset. I would think with 3 buttons, if all 3 are supported, you can have some more flexibility.
If you do have a 3 button headset, but only the middle button is supported by Android at all (apparently YMMV depending on the make/model among other things), then ignore everything I just said, keep the mapping as-is, and just program the one working button as you like - still as if it were the right button.
Click to expand...
Click to collapse
Just to be more specific these are the headphones im using http://www.amazon.com/Samsung-Repla...m-Headset/dp/B007C5S3AU/ref=pd_bxgy_cps_img_y

Help
I really want to do this but I am clueless on what to do. Where do I input this code? The build prop? I don't usually mess with stuff to much but his has been bugging me for a while. Thanks in advance

Ghost_Killer811 said:
I really want to do this but I am clueless on what to do. Where do I input this code? The build prop? I don't usually mess with stuff to much but his has been bugging me for a while. Thanks in advance
Click to expand...
Click to collapse
The file to edit is /system/usr/keylayout/Generic.kl. Of course you need a rooted device to be able to edit it; also you need to mount the system partition read/write (it is mounted read-only during normal operation).
The first post of this thread has the exact instructions on how to do this. Have you tried to follow those steps?
One thing I might add - you will want to keep a copy of the un-edited, original Generic.kl file, because you will typically need to restore it to the original before applying firmware updates. Make a new copy of the original file after every firmware update, since the firmware update sometimes modifies it.

ChoppedLiver said:
The file to edit is /system/usr/keylayout/Generic.kl. Of course you need a rooted device to be able to edit it; also you need to mount the system partition read/write (it is mounted read-only during normal operation).
The first post of this thread has the exact instructions on how to do this. Have you tried to follow those steps?
One thing I might add - you will want to keep a copy of the un-edited, original Generic.kl file, because you will typically need to restore it to the original before applying firmware updates. Make a new copy of the original file after every firmware update, since the firmware update sometimes modifies it.
Click to expand...
Click to collapse
Thanks for the help. I tried reading the instructions, but I got confused. When it says to make a root shell and then gives the code, do I put it somewhere specific in the file or just anywhere.

Related

MobileMute - Mute/Unmute calls via hardware button

MobileMute is a little program that allows you to mute/unmute phone calls via a hardware button. It will also launch any other program of choice if a call is not in progress (that way your hardware button doesn't get wasted). I had searched for this functionality for while without much luck. So, I decided to write a quick little app to do it for me.
For those of you who had used the first version of this, you may have noticed the slight delay when running the program. This was because it was designed to start, do its thing, and then exit. That being said, it took a second for the program to initialize on startup which resulted in a delay.
I have changed this version to try to figure out what button you have it mapped to. If it can figure that out, it will stay active listening for future pushes to that button. If it can't figure out what button is mapped, it will act just like the first version (which is still functional, just with a slight delay).
I have also added a simple configuration utility for changing the settings (located in Program Files/itsallwright/MobileMute).
I originally developed this for my Kaiser, therefore it was originally posted in the Kaiser section. But, since it can work on other devices, I am posting the new version here. The only problem is that different devices have different button IDs. I will post some instructions for getting your button IDs on the devices that the default Kaiser button IDs don't work for.
I didn't test this version for as long as I tested the original. So if you have any weird problems with it, please let me know.
Original version is posted here http://forum.xda-developers.com/showthread.php?t=386810
Edit: Added MobileMute_v2.1 which adds support for more devices and Kaisers with non-standard ROMS.
Enjoy,
Jay
Button IDs
Here are some instructions to help find the button IDs.
If you do not have Visual Studio or another spy program, I saw a post here http://forum.xda-developers.com/showthread.php?t=251955 that might be able to help.
1) Open Spy Program and connect to device
2) Expand "Desktop Window"
3) Expand all child windows titled "Phone" (or whatever your "Phone" title is)
4) Locate the "Phone" window that has a child named "Mute" (or whatever your "Mute" text may be). If you can't find the correct Phone window, it is possible that is hasn't been started since the last reboot. To start it, make a quick call until you get the call status and hang up. Now you should be able to locate the window.
5) The next steps should be made while you are on a call, so make a call to Voicemail, yourself, or a patient friend . After the call is connected, make sure you are on the "Call Status" screen (the one that has the mute button on the screen).
6) Highlight the "Phone" window found previously and click the Messages button to view messages for that window. You will probably see messages continually being posted to the window.
7) Click "Menu" at the bottom and then click "Mute" (Note: do not click the "Mute" button on the screen as that will not give us the information we need.)
8) Click "Menu" at the bottom and then click "Unmute" (Same note as above applies)
9) Disconnect the call. The message window should stop getting messages.
10) In the message window, find all messages titled "WM_COMMAND" (there should only be 2)
11) The WPARAM value of the first WM_COMMAND message is the "Mute" button ID (Put it into a calculator to convert it to a decimal number)
12) The WPARAM value of the second WM_COMMAND message is the "Unmute" button ID​
If you do find your IDs and confirm they work, please post them here with your device and ROM info to save others with that device the trouble.
Thanks,
Jay
just use volume up/down to mute incoming calls...
zuNN said:
just use volume up/down to mute incoming calls...
Click to expand...
Click to collapse
If I'm not mistaken the purpose of this app is not to mute the ringer during an incoming call but to mute the mic during an active call. Also when not in a call it will launch your app of choice so when not in a call you're not occupying an otherwise usable button.
jhw549 said:
If I'm not mistaken the purpose of this app is not to mute the ringer during an incoming call but to mute the mic during an active call. Also when not in a call it will launch your app of choice so when not in a call you're not occupying an otherwise usable button.
Click to expand...
Click to collapse
That is exactly what it is for. It is very usefull if you have to attend a lot of conference calls where you are not required to participate 100% of the time.
Jay
zuNN said:
just use volume up/down to mute incoming calls...
Click to expand...
Click to collapse
This won´t work with my Kaiser with M-Diamond 1.4 ROM.
MobileMute_v2 with HTC Fuze
I have tried version MobileMute_v2 with the HTC Fuze and it does not appear to work. It will launch the program defined in the settings when not on a call, but will not mute the call, when launched while on a call.
I am launching this from the PTT button through the methods described in another thread. I created a shortcut short_ptt.lnk, which launches this application.
I have also navigated directly to the executable and run it while on a call and get identical results.
I am going to uninstall version 2 and try installing version 1.
HTC Fuze and MobileMute
I have now tested the original with the HTC Fuze with similar unsuccessful results.
sounds like a great app ill give it a go on my hermes tonight. thanks for sharing!
JVH3 said:
I have tried version MobileMute_v2 with the HTC Fuze and it does not appear to work. It will launch the program defined in the settings when not on a call, but will not mute the call, when launched while on a call.
I am launching this from the PTT button through the methods described in another thread. I created a shortcut short_ptt.lnk, which launches this application.
I have also navigated directly to the executable and run it while on a call and get identical results.
I am going to uninstall version 2 and try installing version 1.
Click to expand...
Click to collapse
This is most likely because the Fuze button ID for Mute/Unmute is different then the Kaiser.
Have you tried using the steps above to get your button IDs?
-Jay
Mobile Mute and Fuze
I had also tried running the executable directly, not through the remap of the PTT key.
I did that to elliminate the possibility of it being a mapping to a key issue.
This does assume it works when run directly and not from a key.
I suppose it is possible that an exeception is thrown when the program checks what key was pressed to launch it, if there was not key pressed to start it.
As is, with the Fuze, the touch screen has on screen buttons for Mute and Speaker Phone.
I have remapped the long_ptt to Voice Command and the short_ptt to {"\Windows\ctlpnl.exe" cplmain 1} which gives you the lock screen so I can quickly change the timeout. I like it to lock quickly when not running GPS, but not lock at all when running GPS, but this last paragraph is not related to Mobile Mute, other than I no lnger have an available button to map it to.
JVH3 said:
I had also tried running the executable directly, not through the remap of the PTT key.
I did that to elliminate the possibility of it being a mapping to a key issue.
This does assume it works when run directly and not from a key.
I suppose it is possible that an exeception is thrown when the program checks what key was pressed to launch it, if there was not key pressed to start it.
As is, with the Fuze, the touch screen has on screen buttons for Mute and Speaker Phone.
I have remapped the long_ptt to Voice Command and the short_ptt to {"\Windows\ctlpnl.exe" cplmain 1} which gives you the lock screen so I can quickly change the timeout. I like it to lock quickly when not running GPS, but not lock at all when running GPS, but this last paragraph is not related to Mobile Mute, other than I no lnger have an available button to map it to.
Click to expand...
Click to collapse
Check in "/Program Files/itsallwright/MobileMute" for an ErrorLog file. If that file exists and has info, post the contents and I will see if I can figure out what went wrong.
Since it does launch the program you have configured when not in a call, the program at least initializes. If it also launches the program when you are in a call then it can't find the "Phone" window or the "ConnectedText" value. If it appears to do nothing while you are in a call, then it is likely that the Button IDs are wrong.
-Jay
Fuze
A friend of mine with a Fuze let me check it out and I determined why it does not work.
The dialer on the Fuze has Mute/Unmute buttons on the screen, but the buttons do not have text (I suspect it uses seperate Mute/Unmute images instead). That being said, MobileMute determines the Mute State of a call based on the text value of the Mute/Unmute buttons. Therefore, it does not know what command to send.
I am trying to figure out a way to work around this, but in the meantime, I am sorry to say the Fuze is unsupported.
Just as a fyi... the Mute/Unmute button IDs for the Fuze are the same as the Kaiser (21408/21409)
I'll keep you posted on my progress with supporting this device.
-Jay
Trying to use this app on my Mogul/Titan without success. I set it up on the button that would normally be conn mgr, went into cfg and set it to \windows\connmgr.exe
When I go to use the button I get a wait icon, the program launches and hides (still visible in Task Mgr). Opening manually works equally well (not at all).
The tools in the 2nd post don't work ("Class not registered" error).
While in a call the application launches (with a massive delay I might add) then performs its functino properly and mutes the call, no delays after initial launch.
There is no error log in the program's folder.
Help?
jhw549 said:
Trying to use this app on my Mogul/Titan without success. I set it up on the button that would normally be conn mgr, went into cfg and set it to \windows\connmgr.exe
When I go to use the button I get a wait icon, the program launches and hides (still visible in Task Mgr). Opening manually works equally well (not at all).
The tools in the 2nd post don't work ("Class not registered" error).
While in a call the application launches (with a massive delay I might add) then performs its functino properly and mutes the call, no delays after initial launch.
There is no error log in the program's folder.
Help?
Click to expand...
Click to collapse
The initial start of MobileMute does have a delay. That is the reason I created v2 that will stay running. If MobileMute shows in task manager after you run it, then it found the hardware button you have it assigned to and is listening for future presses of that button. Since it does Mute/Unmute the calls, the program is functioning as designed.
As for running "\windows\connmgr.exe". I also cannot run that program (even manually). I don't think it is an app to be used that way. Are you sure you don't actually want to run "\windows\CommManager.exe"?
-Jay
Heh.... umm... oops >.<
That's rather embarassing lol... You're completely right, I picked the wrong exe. It works 100% perfectly now.
I just wish it would hide completely and not show up in my tasks list... I have a tendancy to hit that kill all button rather than pick them out one by one.
thanks. this is a good idea... i'll be using it.
v2.1 with Fuze support
itsallwright said:
A friend of mine with a Fuze let me check it out and I determined why it does not work.
The dialer on the Fuze has Mute/Unmute buttons on the screen, but the buttons do not have text (I suspect it uses seperate Mute/Unmute images instead). That being said, MobileMute determines the Mute State of a call based on the text value of the Mute/Unmute buttons. Therefore, it does not know what command to send.
I am trying to figure out a way to work around this, but in the meantime, I am sorry to say the Fuze is unsupported.
Just as a fyi... the Mute/Unmute button IDs for the Fuze are the same as the Kaiser (21408/21409)
I'll keep you posted on my progress with supporting this device.
-Jay
Click to expand...
Click to collapse
Well, it turns out that the Fuze isn't the only device with that dialer. I recently found a ROM (Phoenix v2) that has touch flo and a similar dialer to the Fuze. I put that ROM on my Kaiser to reproduce this issue on my own.
After quite a bit of research and learning, I found a way to detect the Mute state of a call via TAPI. The Mute/Unmute button text is no longer needed.
I have no way to test with an actual Fuze, but I am pretty confident it will work now. I have added the new version to the original post.
-Jay
I've got v2.1 loaded. Detection on Fuze works, the registry shows mute/unmute id's 21408/21409. I'm using the short_PTT.lnk method. When I press PTT, I can see the titlebar flash 'MoblieMute' text.... but the mic does not mute.
jpn621 said:
I've got v2.1 loaded. Detection on Fuze works, the registry shows mute/unmute id's 21408/21409. I'm using the short_PTT.lnk method. When I press PTT, I can see the titlebar flash 'MoblieMute' text.... but the mic does not mute.
Click to expand...
Click to collapse
When you are not in a call, does it open the configured program (BubbleBreaker by default). Also, if you look in task manager, is MobileMute listed?
-Jay

Handling the genius button press

We need to figure out a way to customize the genius button. It would be a great service to everyone, especially if it doesn't require root.
I looked at logCat, and I see that the button fires up the following intent:
Code:
{ flg=0x10000000 cmp=com.nuance.android.vsuite.vsuiteapp/.VSuiteStartSession }
I'm not quite sure how to create an intent handler for something that doesn't have an action or a category. I even created a test app that matches the intent above exactly, but only the stock genius app launches, and I'm not given an option to choose my default handler for the action. I don't think there is a key handler to intercept either. Any ideas
You know, I was thinking about this all morning (eventhough I don't have the device). Back in the day we remapped functions for certain keys (as g1 didn not have search key of any kind). Can someone go into /system/usr and look what's in there? I believe we are looking for keylayout folder. In that folder we should have some .kl files. They named different from device to device (using Cliq now and they are all named MorrisonXXXXX.kl). Look through those files and find genious button function. From there it should be very easy to change it to google search (or voice search) but substituting the function and pushing the file back in its location. I would have no problem doing it but as I said, I don't own the device myself.
Couple more option (highly unlikely to work):
Clear defaults in Genious app
Freeze Genious app
I don't see those working but who knows... we may be able to assign new default after doing this.
kl files
Here are the files from /system/usr/keylayout
Looks like the correct entry is in glacier-keypad.kl, but it is mapped to a "search" function.
Not sure it will help, but I'd love to see search there instead.
I don't mind the genius button, it actually works fairly well the more you use it. However, I don't like that it disables the search button.
It should be single press for search, long press for genius.
That would be perfect.
rjgii said:
Here are the files from /system/usr/keylayout
Looks like the correct entry is in glacier-keypad.kl, but it is mapped to a "search" function.
Not sure it will help, but I'd love to see search there instead.
Click to expand...
Click to collapse
Ok, I'm at work so I can't really do anything with this but I will look into into it later, when I get home. You are correct, it's in the glacier-keypad.kl. Unfortunately, it's set to the same thing as regular search i.e. In G1 we used to set it to SEARCH as well but it would bring up regular search.
I will try to PM GeniusDog (the guy who figured out how to remap keys) when I get home to see if he can give me some insight on this.
Did anyone try to freeze (disable) Genious app to see if it releases G key to regular search?
We should also contact ChiefzReloaded, he would know how to do it since they put CM on Slide which did have Genious on it to begin with.
Ok, so I guess this is a little different then the Slide. Slides G key was mapped to FUNC_4. Our G key already mapped to SEARCH, its just that Genious overtakes it. I twitted Eugene_73 to see if he could help, he was the brain behind Slide's development in this area.
If its helpful to anyone, holding down the menu button will bring out search keyboard. I really wish the would give us a option to chose from the voicesearch ¦,/
Sent from my HTC Glacier using XDA App
borodin1 said:
Ok, so I guess this is a little different then the Slide. Slides G key was mapped to FUNC_4. Our G key already mapped to SEARCH, its just that Genious overtakes it. I twitted Eugene_73 to see if he could help, he was the brain behind Slide's development in this area.
Click to expand...
Click to collapse
Hmm...what about mapping it to a function key (like on the G2) and then assign whatever action we want to that function key? I will try that out as soon as I get some free time.
Alright, so I tried modifying the key layout file on my G2 (vision-keypad.kl) just to test the process and I am not allowed to make any changes. Just get a "Read-only file system" response. I'm sure it would be the same for the MT4G. Anyone have ideas on what else to try? I really want to find a solution without rooting, but any solution would be a good start.
root
We have root now, so we should be able to modify the key mapping files.
If I find any time today I'll give it a shot.
rjgii said:
We have root now, so we should be able to modify the key mapping files.
If I find any time today I'll give it a shot.
Click to expand...
Click to collapse
Great. You will probably have to remount the system partition like this before you can write to it:
su
mount -o remount, rw /system
Oh how I hate that genius button..I would absolutely donate immediately for an app to remap it to search. That would be amazing.
Sent from my HTC Glacier using XDA App
Did anyone try to uninstall (disable) Genious app yet? Since the G key mapped to SEARCH already, this may release it to actuall Google search.... just thinking out loud
I froze it last night. No response from the G button after that.
21productionz said:
I froze it last night. No response from the G button after that.
Click to expand...
Click to collapse
LOL...
They really mean "you" in the commercials!
You gotta customize everything..
Sent From The Moon... With a HTC Glacier
I updated my voice search in the market when I first got the phone, and for a time when I pushed the button is would actually give me the option to choose what app handled the action and I could choose voice search. However, after one time choosing the Genius button it never asked again. I wonder if there would be a way to continuously clear the Default so that it always asked.
borodin1 said:
Did anyone try to uninstall (disable) Genious app yet? Since the G key mapped to SEARCH already, this may release it to actuall Google search.... just thinking out loud
Click to expand...
Click to collapse
I disabled dragon dictation and genius, and after holding the button for a couple seconds, my phone crashed and rebooted. Multiple taps on the button seemed to do the same thing. Leaving dragon dictation enabled and genius disabled seemed to be less prone to crashing.
This has been solved in this thread:
http://forum.xda-developers.com/showthread.php?t=836702

Shield Nvidia button Tweaks and Moga Pro HID tweaks

Having purchased the nvidia shield back at launch, one of the main things that bothered me about it's design was the lack of a few buttons, namely a menu button and select button, instead we got a button that opened nvidia's tegra zone, something easily accessible from a launcher and a volume button which again wasn't something I needed to constantly access.
So i ended up editing some of the .kl files and using an xposed tweak called gravity box to tune things a bit
I changed the nvidia button to act as a menu button with the .kl files, and the volume button to act as a select button
with gravity box i changed the menu button's long press function to call up the power menu to restore that function to how the shield comes, and set the back button when long pressed to call up the volume control
also keep in mind if you don't use xposed with gravity box to tweak the keys after they've been changed you will have difficulty shutting down the shield properly as the nvidia button of course acts as the power button when held down longer, it of course still powers up the device either way, and will hard power the device off if held for several seconds, still setting up gravity box feels like the best way
now for the moga controller, while you can make it function in a usable state with tincore or game keyboard, and in fact those both still come in very handy for touch emulation, I didn't want to always have those apps running when i wanted standard button presses, when the controller would go to sleep it would take time to get re detected so i wanted a little more convenience, I think this also should make it work with the built in console mode touch emulation, though I haven't tested that
the HID mode on it would have the select button as a back button, and the shoulder buttons didn't seem to work unless an app specifically supported the controller
So i added a few .kl files for that as well, not sure which of the 3 gets called as they're all duplicates in function, but presumably the device ID one should be the default, but i added the other 2 in case it doesn't for some reason
these .kl files should be put in /system/usr/keylayout
root is required and obviously backup the files that get replaced for the shield, the moga ones should not have existing files and match the permissions to the other files that're in the folder
I've tested these moga files on an LG phone on 4.2.2 and the shield on 4.3
I've included a backup of the original files for 4.3 for the shield in the zip, but no idea if they'd be different under Kitkat though I don't see why they would be
ciphray said:
Having purchased the nvidia shield back at launch, one of the main things that bothered me about it's design was the lack of a few buttons, namely a menu button and select button, instead we got a button that opened nvidia's tegra zone, something easily accessible from a launcher and a volume button which again wasn't something I needed to constantly access.
So i ended up editing some of the .kl files and using an xposed tweak called gravity box to tune things a bit
I changed the nvidia button to act as a menu button with the .kl files, and the volume button to act as a select button
with gravity box i changed the menu button's long press function to call up the power menu to restore that function to how the shield comes, and set the back button when long pressed to call up the volume control
also keep in mind if you don't use xposed with gravity box to tweak the keys after they've been changed you will have difficulty shutting down the shield properly as the nvidia button of course acts as the power button when held down longer, it of course still powers up the device either way, and will hard power the device off if held for several seconds, still setting up gravity box feels like the best way
now for the moga controller, while you can make it function in a usable state with tincore or game keyboard, and in fact those both still come in very handy for touch emulation, I didn't want to always have those apps running when i wanted standard button presses, when the controller would go to sleep it would take time to get re detected so i wanted a little more convenience, I think this also should make it work with the built in console mode touch emulation, though I haven't tested that
the HID mode on it would have the select button as a back button, and the shoulder buttons didn't seem to work unless an app specifically supported the controller
So i added a few .kl files for that as well, not sure which of the 3 gets called as they're all duplicates in function, but presumably the device ID one should be the default, but i added the other 2 in case it doesn't for some reason
these .kl files should be put in /system/usr/keylayout
root is required and obviously backup the files that get replaced for the shield, the moga ones should not have existing files and match the permissions to the other files that're in the folder
I've tested these moga files on an LG phone on 4.2.2 and the shield on 4.3
I've included a backup of the original files for 4.3 for the shield in the zip, but no idea if they'd be different under Kitkat though I don't see why they would be
Click to expand...
Click to collapse
I supposed that ir just a copy paste and remplace the files for the ones on the zip right ?, thanks for the info i agree with you, i hate the tegra zone button, nice idea man
what bothers me is that in some Gameloft Shooters like Nova 3 you aim and shoot with the bumpers instead triggers.
you think there is a way to change that without ****ing up other games?
psycho1200 said:
I supposed that ir just a copy paste and remplace the files for the ones on the zip right ?, thanks for the info i agree with you, i hate the tegra zone button, nice idea man
Click to expand...
Click to collapse
yes replace the existing files for the shield, the permissions should stay the same, just make sure they match the other files in that folder
what bothers me is that in some Gameloft Shooters like Nova 3 you aim and shoot with the bumpers instead triggers.
you think there is a way to change that without ****ing up other games?
Click to expand...
Click to collapse
if you swap them via this method it would change it for all games, something like tincore or gamekeyboard would let you switch for just 1 game, as they have profiles
Thanks!
Just wanted to say that I love having the select button useful in HID mode again, thank you so much as I had no idea how those layouts got set!
ciphray said:
yes replace the existing files for the shield, the permissions should stay the same, just make sure they match the other files in that folder
if you swap them via this method it would change it for all games, something like tincore or gamekeyboard would let you switch for just 1 game, as they have profiles
Click to expand...
Click to collapse
tried. Tincore doesn't do such thing and gamekeyboard does not detect the analog triggers.
nex86 said:
tried. Tincore doesn't do such thing and gamekeyboard does not detect the analog triggers.
Click to expand...
Click to collapse
if you're refering to the moga controller
if you use the .kl files from here that will make gamekeyboard detect the analog triggers, the reason game keyboard doesn't see them is they get assigned a random generic axis each time if they're undefined in one of the kl files
tincore is tricky to get used to how to setup, and a number of it's addons need to be purchased
it sets 2 different buttons to the triggers, both analog and digital, i think one set comes up as buttondead and as gas brake, make sure you set both of them, the profiles also need to be created while the game is loaded in the background if you want it to auto load with that game, otherwise it'll remove the profile when the game starts if you have auto profile switching enabled
No I was refering to the Shield Controller, not Moga.
nex86 said:
tried. Tincore doesn't do such thing and gamekeyboard does not detect the analog triggers.
Click to expand...
Click to collapse
I have the same exact issue - want to use triggers instead of bumpers. Can someone here either explain how to map the triggers or just upload a profile that already does?
delt31 said:
I have the same exact issue - want to use triggers instead of bumpers. Can someone here either explain how to map the triggers or just upload a profile that already does?
Click to expand...
Click to collapse
So I got it to work.
open tincore then minimize,
open NOVA or MC and then volume start volume and select open TKM editor
then scroll all the way down and under L1 and L2 select disable on the drop down
for R2 and L2 select click button joy 0
Then press check button then name the new profile and you're good. Make sure the profile is activated in order for it to work.
Only catch was that I had to pay in order for the new functionality to work. 2.75 well worth it now that I can use triggers for zoom and shoot!
Not recognizing the KL files after updating image
So I have a nexus 5 and was running the factory 4.4.2 image and these KL files worked great (the moga files). After updating to the new 4.4.3 image the device doesn't seem to load them. Anyone have any ideas? It's almost as though it doesn't know those files were put there, but I copied them over from a directory in the /sdcard with root explorer and updated the permissions just like I did originally.
Only oddities I can think of is that the OTA failed (I rooted but didn't flash the team win bootloader so OTA's could still work, update did work on my wifes rooted nexus 5) for me so I had to download the factory image and flashed the update without the -w flag so that it would keep my user partition.
tridium said:
So I have a nexus 5 and was running the factory 4.4.2 image and these KL files worked great (the moga files). After updating to the new 4.4.3 image the device doesn't seem to load them. Anyone have any ideas? It's almost as though it doesn't know those files were put there, but I copied them over from a directory in the /sdcard with root explorer and updated the permissions just like I did originally.
Only oddities I can think of is that the OTA failed (I rooted but didn't flash the team win bootloader so OTA's could still work, update did work on my wifes rooted nexus 5) for me so I had to download the factory image and flashed the update without the -w flag so that it would keep my user partition.
Click to expand...
Click to collapse
So after doing some more research it seems that the product code wasn't the same anymore. instead of 0dad it was 6271, so after renaming the vendor specific file to incorporate the correct product code, it worked again for me. I don't know enough about things to know why that would have changed, but before that rename it was just using the Generic.kl as it was before.
I got the code it wanted by adb shelling into the device and running a dumpsys input. One of the lines under the Moga had it's vendor and product code in it.
tridium said:
So after doing some more research it seems that the product code wasn't the same anymore. instead of 0dad it was 6271, so after renaming the vendor specific file to incorporate the correct product code, it worked again for me. I don't know enough about things to know why that would have changed, but before that rename it was just using the Generic.kl as it was before.
I got the code it wanted by adb shelling into the device and running a dumpsys input. One of the lines under the Moga had it's vendor and product code in it.
Click to expand...
Click to collapse
that's definitely interesting that the device portion would change, the triggers still work as analog? even windows gives the vendor id and device id as the 0dad one, only thing that comes to mind is maybe the newer version of android is seeing some other piece of hardware in the controller before the HID device and using that since the vendor portion isn't changing
ciphray said:
that's definitely interesting that the device portion would change, the triggers still work as analog? even windows gives the vendor id and device id as the 0dad one, only thing that comes to mind is maybe the newer version of android is seeing some other piece of hardware in the controller before the HID device and using that since the vendor portion isn't changing
Click to expand...
Click to collapse
Yeah, very weird. The only thing I can think of that I've done is that I have taken the controller apart. I was trying to see if there was any way i might make some adjustments to the d-pad. But other than taking the case apart and having the board being a bit on the free side for a bit, I didn't end up doing anything to the controller. It works fine as well, so I doubt anything I did could have changed that code.
Can the long press back button behavior be changed?
Would altering the kl files somehow make it possible to alter the long press behavior of the back button? When streaming Fallout 4, the Select button is the Back button on the controller. In the game you long press Select to bring up the workbench menu. As it is now, long pressing the button brings up the share menu on the tablet. The menu for taking screenshot and recording gameplay etc. I want to disable that somehow or change it from long pressing the back button.
Is that possible?

Mouse Right Click Behavior

Hi,
I bought this remote:
http://g03.s.alicdn.com/kf/HTB1clsdIXXXXXXlXVXXq6xXFXXXn/2-4GHz-Fly-Air-Mouse-Wireless-Keyboard.jpg
but I'm having trouble with the "back" key. It's not really acts as back. Instead it acts as right click.
Has anyone been able to fix this problem?
I xposed module would be nice
I did some research and found this:
https://github.com/timduru/platform-frameworks-base/commit/bae953c0063dc1afb9e8c43381f3894329abe115
Think this is exactly what we need to fix this.
Is it possible via xposed module? Maybe any Devs are interested in that one?
Use esc button for back key
ilkerates said:
Use esc button for back key
Click to expand...
Click to collapse
Yes, I'm sure he's already aware of that.
Speaking personally, it would be nice if my back button on my air mouse (the same one as the OP has which, despite being marked as a back button, is effectively seen by Android as a right mouse click) actually worked as a back button. To stop having to turn my air mouse over to access the esc key every time I wanted to go back, given that the QWERTY doesn't work when pointing downwards. I had to remap my Menu button as the back button isn't seen by any key mapping apps.
So yes, a big thumbs up from me too if this can happen in Xposed. I'm rooted and running it already.
Beefheart said:
Yes, I'm sure he's already aware of that.
Speaking personally, it would be nice if my back button on my air mouse (the same one as the OP has which, despite being marked as a back button, is effectively seen by Android as a right mouse click) actually worked as a back button. To stop having to turn my air mouse over to access the esc key every time I wanted to go back, given that the QWERTY doesn't work when pointing downwards. I had to remap my Menu button as the back button isn't seen by any key mapping apps.
So yes, a big thumbs up from me too if this can happen in Xposed. I'm rooted and running it already.
Click to expand...
Click to collapse
Yes this is what I am also trying to do, so if anyone has figured out how to make the right mouse button into the back button that would be amazing!!
Xposed Additions may work for you.
ErAzOr2k said:
I did some research and found this:
https://github.com/timduru/platform-frameworks-base/commit/bae953c0063dc1afb9e8c43381f3894329abe115
Think this is exactly what we need to fix this.
Is it possible via xposed module? Maybe any Devs are interested in that one?
Click to expand...
Click to collapse
what exactly is this? thanks
[email protected] said:
Yes this is what I am also trying to do, so if anyone has figured out how to make the right mouse button into the back button that would be amazing!!
Click to expand...
Click to collapse
It's impossible as far as I'm aware to map the back button on my air mouse to a specific activity. Like I said, I ended up mapping the menu button instead. I've gotten used to it now.
Mogster2K said:
Xposed Additions may work for you.
Click to expand...
Click to collapse
Unfortunately not. In fact, not only did it not work, it caused delay issues in button presses on my NVidia controller. This only stopped when it was deactivated within Xposed.
Only other thing I can think of would be to create a custom profile in /system/usr/keylayout/, however I don't know the details of how to do it.
Sent from my LG-H811 using Tapatalk
nice !
nice !
Any updates with this issue? I was actually coming here to post about a similar problem.
Just picked up my Shield TV and tried using this same remote. The center button (select button; left click button) doesn't function at all. I can scroll up and down, left and right, air mouse cursor works fine. But I can't actually make a selection.
I also find that with either the controller or nvidia remote, I can't navigate in app file structures. So when I side load ES Explorer for instance, I can't get into the center of the screen and navigate the file list, only the top and bottom border menus. Or when I sideloaded ShowBox and other similar apps, I can't navigate the movie lists, only the top or bottom menus.
At this point I'm starting to think I'm either better off taking this thing back and using my old droid tv box. OR flashing this thing to make it act like a droid tablet and lose all the added functionality that the shield uses to set itself apart.
So, I bought this remote from amazon:
https://www.amazon.com/dp/B00UYCLV8Y/ref=cm_sw_r_other_awd_CTeTwbRCVNCP1
Which is pretty awesome so far. Everything works except the back button of course. I've been digging and digging and unfortunately I don't think we can change the behavior as it just doesn't seem to be recognized as a typical key scancode. I'm confident of this because I made a custom key layout file for this device, and literally edited 999 key entries, ranging from "key 0" all the way up to "key 999". I gave every keycode the back button tag. What this essentially did was turn every single button on the remote into a back button (lol), and as you may expect, even STILL the back button on the remote only registered as a mouse click.
After searching, it seems the only way to bypass this would to be to change the behavior of the mouse button itself, which according to resources online, is hard coded into the kernel itself. You would have to actually know how to code and compile a new kernel for your media device.
http://stackoverflow.com/questions/...ped-to-work-for-traversing-back-in-jelly-bean
I have created a simple keylayout that anyone can use if interested. It's pretty much just a rip of the generic.kl file, with the zoom in and out buttons on the remote configured as back buttons. If you use a proper keycode scanner, you can study this keylayout file and eventually customize any button (except the back button of course) to do almost anything you want.
It's a temporary workaround until someone figures it out. If it doesn't work for you, you may need to change the filename to reflect the proper vid and pid of your device. I did this by plugging my device into windows and checking the hardware id for the new mouse and keyboard input that popped up.
I'm not sure which directory the file needs to be in, so I just copied it to both known directories:
Root: data>system>devices>keylayout
Root: system>usr>keylayout
I hope this helps.
Edit: Also, a couple of things to note, in case anyone was curious. If your having any issues trying to program the infrared side for a remote, consider that the source remote may be blasting too much for this remote to learn. I discovered this issue because my Samsung tv would send tons of ir data and causing my remote to have troubles learning. If you have a similar issue, try quickly/lightly tapping the button on the source remote when teaching this remote to learn it. Had no issues teaching my remote once I figured this out.
Finally, an oddity I noticed is that the issue seems specific to Android TV boxes. Connecting the USB to my galaxy note 5 via USB otg cable, the back button works fine on its own on this remote. Oddly though, while it registers as a key using the key test app (Google it), it reports back as having a scancode of 0.
Tried adding key 0 as a button in the keylayout config. Still no go. :/
I've made a custom kernel based on stock kernel to (hopefully) change the rightclick event to back event.
Is anyone brave enough to check this out as I don't give a guarantee to anything?!
ErAzOr2k said:
I've made a custom kernel based on stock kernel to (hopefully) change the rightclick event to back event.
Is anyone brave enough to check this out as I don't give a guarantee to anything?!
Click to expand...
Click to collapse
tried your boot.img, and as far as i can tell, nothing.
my shield tv is already unlocked and rooted, so i just used "fastboot flash boot boot.img" in adb to flash the boot image to my device. booted up fine, just i dont see any changes regarding right mouse click.... :/
has anyone figure this out yet. I really need to change the right click to function as "back"
Has anyone been able to fix this meanwhile? With Xposed Module maybe?
I'd love a Magisk (or Xposed) module that fixes that, but I don't think any module like that exists right now...
There are work-arounds to use apps that create fullscreen overlay which intercepts right clicks and emulates a Back button, but those don't work on Shield (or Android TV in general) because creating Overlay / requesting "draw over other apps" permission causes a crash
For now, the most convenient (more than editing *.kl files) work-around I've found is to use an app called Button Mapper (packagename: flar2.homebutton, can't post a link cause I'm a newbie) and emulate Back button on some other button...

Cant skip tracks with volume buttons

hi guys like the titles says i cant seem to find a way to skip a track forward or backward with the screen locked. i know there is options for this in various apps, ive tried them. (poweramp, rocketplayer) i have even tried downloading third party apps claiming to be able to do just this but none of them work. Its almost as if once the phone is locked none of these apps can override the stock default volume up or down.
Phone is rooted with twrp installed, and busybox if that helps.
Any help would be appreciated.
Thanks
EDIT: Tested this on both wired (earbuds) and bluetooth (car headunit) no go either way.
You can only skip songs by dubble tap the play/pause button, sadly backwards is not possible.
actually you can set that in the app either to one press, two press or long press all of which do not work.
So we've given up here? The S7 lacks this essential feature entirely?

Categories

Resources