Shield Nvidia button Tweaks and Moga Pro HID tweaks

Search This thread

ciphray

Member
Apr 16, 2010
41
33
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
 

Attachments

  • shield_keys.zip
    3.2 KB · Views: 309
  • moga.zip
    1.7 KB · Views: 380
Last edited:

psycho1200

Senior Member
Jun 20, 2012
158
29
Ecatepec
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

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
 

nex86

Senior Member
Nov 9, 2010
632
48
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?
 

ciphray

Member
Apr 16, 2010
41
33
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

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?

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
 

tridium

Member
Oct 11, 2010
9
3
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!
 

nex86

Senior Member
Nov 9, 2010
632
48
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

tried. Tincore doesn't do such thing and gamekeyboard does not detect the analog triggers.
 

ciphray

Member
Apr 16, 2010
41
33
tried. Tincore doesn't do such thing and gamekeyboard does not detect the analog triggers.

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
 
Last edited:

delt31

Member
Feb 12, 2011
14
1
tried. Tincore doesn't do such thing and gamekeyboard does not detect the analog triggers.

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?
 
Last edited:

delt31

Member
Feb 12, 2011
14
1
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?

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!
 

tridium

Member
Oct 11, 2010
9
3
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

Member
Oct 11, 2010
9
3
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.

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.
 

ciphray

Member
Apr 16, 2010
41
33
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.

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
 

tridium

Member
Oct 11, 2010
9
3
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

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.
 

2kool2Bcruel

Senior Member
Sep 29, 2013
91
11
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?