How To Guide How to remap "assistant" button! [ROOT REQUIRED] - Moto G30

it seems that while adding non-remappable assistant buttons is a growing trend, solutions aren't easy to find, however the solution is real simple, you just have to modify the keymap file...
I successfully managed to get the button detected by flashing XperiaGAButtonRemap through magisk, and I'm pretty sure the same solution works for a bunch of other phones also, it even has code that should allow flashing through custom recoveries also.
all you have to do is "install from storage" in magisk manager, select the zip, and reboot.​
what that zip does, is it adds /system/vendor/usr/keylayout/gpio-keys.kl (overriding /system/usr/keylayout/gpio-keys.kl because /vendor has higher priority) and replaces the ASSISTANT key with PROG_BLUE, which is a dummy key, you can remap that with any remapper app or module, or you could edit the zip, and change it directly to something like CAMERA, if that's all you want.
here's what the file will look afterwards, if you're curious:
key 115 VOLUME_UP
key 114 VOLUME_DOWN
key 102 HOME
key 528 FOCUS
key 766 CAMERA
key 457 PROG_BLUE
the original file has copyright notice for The Linux Foundation, from 2013, but all other keys map the same, so it's highly likely most phones (at least the AOSP-adjacent ones) just have hooks for the ASSISTANT key, but still rely on the universal keymap file

thanks a lot!worked just fine,
big ups!!!

Hello, sorry for the question, does this work on Android 12?

SHANOA_zasha said:
Hello, sorry for the question, does this work on Android 12?
Click to expand...
Click to collapse
I've just tested and yes it works in A12

Related

Bluetooth Keyboard and custom key and character mapping

Some custom ROMs, which are not based on HTC roms, but compiled form Android Source support the Bluetooth HID profile, thus support well known and common normal Bluetooth keyboards.
I've tested Cyanogenmod and OpenDesire.
However, I was unsatisfied with the keyboard layout. I've found no key for return, needed some special 'Umlaute' for my German layout, etc.
Here's what I've found to fix all this:
1. Description what can be changed:
Android Open Source Project: Keymaps and Keyboard Input
Until now I don't know the internal differences between the key map and character map files. Sure, both look different, both can and must be changed for different reasons. The key map if you want to change actions and also alter phone buttons, the character map for modifying the full layout. But with the key map you could also alter parts of the layout, so it's not that clear for me. However.
2. Altering Key Map Layout
If you don't specify a keylayout file, Android will default to /system/usr/keylayout/qwerty.kl
Click to expand...
Click to collapse
So I took a look at this file, changed it, and it worked
Here a nice explanation of this file, explained are the different commands, too.
[GUIDE] How to Remap Hardkey Actions || Custom App Launching
What we not know, the key number of our physical BT keyboard, so what's the number of ESC? For this, I've found following site, which seems to contain the correct scan codes, used in Android: (note, the values are in HEX!!)
http://www.marjorie.de/ps2/scancode-set1.htm
So if we take a look at ESC:
Key: ESC Make: 01 --> in decimal, stays 01
We just have to add following line to the key map layout file:
key 1 BACK WAKE_DROPPED
and we have a back key.
3. Altering Character Map file
To change characters and change the whole layout, it seems as if we have to alter the character Map file. (/system/usr/keychar/qwerty.kcm.bin)
Sadly, this fact makes editing the file somehow difficult:
Resource Binary File Format
The file snippet above [see first link] gets converted to the following [a binary file] by the makekcharmap tool as part of the build process.
Click to expand...
Click to collapse
I have no idea what this tool is, nor how to revert it back, so we have to edit the binary file. Luckily, one user's done the hard work already, again:
Changing to a non-english keyboard layout [cupcake support]
The easiest method is to use some kind of hexeditor, so you see what you do and can enter the character code of special characters easily, I used the one in Notepad++
Then you can alter the layout just as you like. Because I have a special english keyboard with which I want to type german Umlaute, too, I changed
A.2.a.A.#..
to
A.2.a.A.ä.Ä.
So I can type an 'ä' by holding the 'Alt' key and pressing a. Typing 'Ä' by holding Shift+Alt and typing 'a'.
Unlimited possibilities
Tips:
To alter both files you can use ADB and an editor on your computer.
Or you can alter the files directly on the phone, without any additional hardware. You only need Root Explorer to open, change and save the files directly on the phone.
Drawbacks of changing the layout:
Haven't seen some yet

[Q] Enable trackpad button on G2 to wake up / get to the unlock screen?

Sorry if this has already been described, I couldn't find a G2-specific method by searching.
I'm using the pre-rooted OTA 2.3.4 ROM. I would like to allow the unlock screen to appear when pressing the trackpad button. So basically instead of (or in addition to) the power button, I want to wake the device in a somewhat similar fashion like the Home button does it on the iPhone.
I found some threads explaining how to do this on the Desire, and tried it on my G2 but it doesn't work.
I used the method described in this post.
There is also this thread, dealing with the same thing.
Used a terminal app and getevent to see what event belongs to the trackpad button, and it appears it is (almost) the same as described in the first linked post. In my case, it was a pair of
Code:
/dev/input/event7: 0001 0110 000000001
/dev/input/event7: 0001 0110 000000000
for each button press. Same key code (hex 0110, decimal 272) like in that single post.
event7 belongs to the same curcial-oj device, because in the beginning of the getevent list, I have
Code:
add device 2: /dev/input/event7
name: "curcial-oj"
There was no curcial-oj.kl file in /system/usr/keylayout/ so I created one manually and pushed it using recovery and adb. The file content is
Code:
key 272 DPAD_CENTER WAKE_DROPPED
But this doesn't enable trackpad wake.
The new file is there where it's supposed to be.
I also thought WAKE_DROPPED is kinda strange so I tried it with just WAKE instead. No go.
Also, when I looked into the other .kl files in that directory, the button DPAD_CENTER had the code 232 assigned in them, so I tried using that as well. No joy.
What am I doing wrong? Did anyone get this trackpad wake working on the G2?
Thanks.
The best and easier way to get trackpad wake on your g2 is to flash a custom rom
Almost all roms have this option
Sent from my G2 via XDA running MexDroidMod PreGhostChilli

[Guide] Disable hard navigation keys (not onscreen buttons)

I have seen a bunch of posts regarding the capacitive buttons and on screen navigation buttons. Love them or hate them, this is how you can turn them off.
I will leave that up to you on how to get onscreen Navy buttons.
As for turning off the capacitive buttons this is how I did it.
1.To eneble onscreen buttons follow this thread http://forum.xda-developers.com/redmi-1s/themes-apps/how-to-onscreen-buttons-redmi-1s-t2950455
2. Download a root file explorer. Root Browser Lite --> http://goo.gl/b9ISW This is what I will use.
3.Load up Root Browser and navigate to system>usr>keylayout. We will be looking for a file called "ft5x06.kl".
4. Select it and hit "Open as..." then "Text file" then "RB Text Editor"
5. Now we see this:
key 139VIRTUAL
key 158 VIRTUAL
key 102 HOME
key 217 SEARCH
All you have to do is option out the keys you don't want to work with a #. So if you are like me and think the home button is fine, it will look like this.
#key 139VIRTUAL
#key 158 VIRTUAL
key 102 HOME
key 217 SEARCH
6. When you have the ones you want optioned out just tap the little disk icon in the top right. It will ask for root rights, grant it, saved.
7. Now just reboot and DONE!
Tested on
1. Redmi 1s(miui, Validus, Pa, mokee,cm11 ROMs)
Sent from my HM 1S using Tapatalk
Hit thanks if this post helped you[emoji106]
Nice guide, works with CM11 too, only the file for editing is different:
/system/usr/keylayout/ft5x06.kl
Don't remember to backup the original file before editing!
philip_petev said:
Nice guide, works with CM11 too, only the file for editing is different:
/system/usr/keylayout/ft5x06.kl
Don't remember to backup the original file before editing!
Click to expand...
Click to collapse
Thanks bro OP updated....:thumbup:
Sent from my HM 1S using Tapatalk
Thanks
It worked awesome on Mokee ROM history version
thanks for useful tips. its a pain operating non backlit capacitive button

Remap funcionality of POWER-Button to physical CAMERA-Button

Hello everyone,
the Power button of my Sony Z1 Compact is broken and only works when pressed very very intensely. Since I don't use the camera button at all, I would like to use it as my new power button - I'd like to remap the physical camera button to the funcionality of the POWER-Button.
I've read a few posts on this issue, so I started out with rooting my Z1C today (KingRoot and SuperSume). Then I tried a number of possible solutions, all of which have failed so far:
- ButtonRemapper. I read about it on LifeHacker and thought this would be a quick and easy tool. It seems to basically do what I want, BUT it doesn't offer the Camera button as one to connect functionality to. Neither can I add a button ID (I'm pretty sure the camera button is #212).
- Buttons remapper (no root). This program recognizes the button I'd like to use and offers a number of connectible actions - but none equal to what the Power button does (wake up from sleep, go to sleep, Power-Menu on long press). It only offers the Power-Menu-funcionality, but that won't help me with my broken Power-Button.
- Xposed Additions. I installed the Xposed Installer first, then went for Xposed Additions. It seems that I also need the Xposed framework, but since I don't use a custom ROM, as far as I understand, I cannot install it.
- Manual edit of the keymap. There have been a number of tutorials online on how to change the keymap. I'm pretty sure the one I'd have to change is the /system/usr/keylayout/mhl-rcp.kl. When I try to save any edits though, it tells me that I can't. I guess that this is because it's a kind of system file, but I imagined I'd be able to edit it after having rooted my device.
I'm a little frustrated after all this work just for one tiny change that I still couldn't achieve so fat. But if you have a possible solution, I will try it. I would however like to keep my current (non-custom) firmware if possible (never change a running system...).
I'm very thankful for your suggestions!
If you are 100% sure you found the right file to change manually, copy that file to your sd card and modify it there.
After you are done, backup your original file and replace it with the new one. Don't forget to change permissions after copying in!!
Then reboot and try.
thekryz said:
Hello everyone,
the Power button of my Sony Z1 Compact is broken and only works when pressed very very intensely. Since I don't use the camera button at all, I would like to use it as my new power button - I'd like to remap the physical camera button to the funcionality of the POWER-Button.
I've read a few posts on this issue, so I started out with rooting my Z1C today (KingRoot and SuperSume). Then I tried a number of possible solutions, all of which have failed so far:
- ButtonRemapper. I read about it on LifeHacker and thought this would be a quick and easy tool. It seems to basically do what I want, BUT it doesn't offer the Camera button as one to connect functionality to. Neither can I add a button ID (I'm pretty sure the camera button is #212).
- Buttons remapper (no root). This program recognizes the button I'd like to use and offers a number of connectible actions - but none equal to what the Power button does (wake up from sleep, go to sleep, Power-Menu on long press). It only offers the Power-Menu-funcionality, but that won't help me with my broken Power-Button.
- Xposed Additions. I installed the Xposed Installer first, then went for Xposed Additions. It seems that I also need the Xposed framework, but since I don't use a custom ROM, as far as I understand, I cannot install it.
- Manual edit of the keymap. There have been a number of tutorials online on how to change the keymap. I'm pretty sure the one I'd have to change is the /system/usr/keylayout/mhl-rcp.kl. When I try to save any edits though, it tells me that I can't. I guess that this is because it's a kind of system file, but I imagined I'd be able to edit it after having rooted my device.
I'm a little frustrated after all this work just for one tiny change that I still couldn't achieve so fat. But if you have a possible solution, I will try it. I would however like to keep my current (non-custom) firmware if possible (never change a running system...).
I'm very thankful for your suggestions!
Click to expand...
Click to collapse
You can use Xposed on stock with root. You'll need root for sure. Also, button savior pro...
thekryz said:
Hello everyone,
the Power button of my Sony Z1 Compact is broken and only works when pressed very very intensely. Since I don't use the camera button at all, I would like to use it as my new power button - I'd like to remap the physical camera button to the funcionality of the POWER-Button.
!
Click to expand...
Click to collapse
Button savior free from Play Store gives you on-screen power menu functionality. Pro version can remap.
einfachgaer said:
If you are 100% sure you found the right file to change manually, copy that file to your sd card and modify it there.
After you are done, backup your original file and replace it with the new one. Don't forget to change permissions after copying in!!
Then reboot and try.
Click to expand...
Click to collapse
I tried, but it wouldn't let me paste the file back into the system-directory... am I doing something fundamentaly wrong here?
levone1 said:
You can use Xposed on stock with root. You'll need root for sure. Also, button savior pro...
Click to expand...
Click to collapse
How? When I want to download the Xposed framework it gives me the following information:
Code:
xposed*.zip from [url]http://dl-xda.xposed.info/framework/:[/url] Must be flashed with a custom recovery (e.g. TWRP) to install the framework.
SDK21 is Android 5.0 (Lollipop), SDK22 is Android 5.1 (also Lollipop) and SDK23 is Android 6.0 (Marshmallow).
I only support the latest Xposed version!
levone1 said:
You can use Xposed on stock with root. You'll need root for sure. Also, button savior pro...
Click to expand...
Click to collapse
levone1 said:
Button savior free from Play Store gives you on-screen power menu functionality. Pro version can remap.
Click to expand...
Click to collapse
I just tried Button savior Pro - it can remap the buttons to a specified action / app, but not to an internal funcionality like the Power button funcionality, it seems.
thekryz said:
How? When I want to download the Xposed framework it gives me the following information
Click to expand...
Click to collapse
Right, custom recovery, not necessarily custom ROM. If you're rooted, just flash NUT dual recovery pc installer, then download Xposed SDK22 and flash.
Btw - I'm not sure that there is an Xposed module that will remap, but there are some that can provide power button funcionality on-screen.
thekryz said:
I tried, but it wouldn't let me paste the file back into the system-directory... am I doing something fundamentaly wrong here?
Click to expand...
Click to collapse
Seems like the file explorer you are using doesn't have proper root rights. Otherwise you should be able to do that.
You have to set the file system to read/write. If you're using Root Explorer, you can toggle this at the top, with the little "Mount R/W" button.

Change 3rd party remote key layout (root require)

Use as your own risk! a wrong keylayout may totally disable the input device. Tested on Shield TV 2017 16GB
If you are using 3rd party remote on Shield TV some key may not work as intent, or you want to remap the key for another function, for example I had a xiaomi remote (just $4 dollar) which the home key not working.
Although you use custom IME (such as mkr Multilanguage Keymap Redefiner) or some keyboard remap app (such as buttons remapper), which work but not perfect, some function may not work such as double press the home button to show recent app list, or conflict with shield tv controller button (buttons remapper disable the voice search button on my shield controller), and you may need to change every time for each different remote/controller.
Luckly android allow you to use specific key layout for each different remote.
1. flash the developer image, which is pre-rooted, or root it yourself
2. adb shell
3. cat /proc/bus/input/devices
Now you will have a list of connected remote/controller, take a note of the Vendor number and the Product number​4. adb pull /system/usr/keylayout
5a. modify a exist keylayout file, or create a new one. The file name should be Vendor_XXXX_Product_XXXX.kl, Don't change the Generic.kl
5b. use any keytest app to check the key scancode, I am using "Multilanguage Keymap Redefiner"
for example my xiaomi remote home key scancode is "102", which map to MOVE_HOME by default, so I create a new file "Vendor_2717_Product_3200.kl", the file will be like this:​key 28 DPAD_CENTER
key 102 HOME
key 103 DPAD_UP
key 105 DPAD_LEFT
key 106 DPAD_RIGHT
key 108 DPAD_DOWN
key 114 VOLUME_DOWN
key 115 VOLUME_UP
key 116 POWER
key 127 MENU
key 158 BACK​
Any key not listed will be disable, so make sure you have all key listed
6. copy the file back to shield tv:
adb root
adb disable-verity
adb reboot
adb root
adb remount
adb push "layout file" /system/usr/keylayout​7. reboot.
P.S. Don't change the Generic.kl, change the keylayout file one at each time
Shield TV remote Home button is map to HOME, and the dpad center is map to DPAD_CENTER, so other remote which map to MOVE_HOME and ENTER (such as my xiaomi remote) will need this mod
The shield TV come with lot of keylayout file for many different controller/remote, I see MI, wii,xbox 360, but there seems no amazon
I had attach the keylayout file pull from my sheild tv, may be you can take a look which controller/remote is support offically​
I cant do adb remount, it says I have to be root, and when I do adb root first it seems to pass but it still says I have to be root when i try adb remount.
How do I set my /system to r/w instead of r/o? I have tried adb mount o rw,remount /system but it wont do anything.. also the command you tell me to use, "adb disable-verity" says:
disable-verity only works for userdebug builds
Can you please help me?
Kylistar said:
I cant do adb remount, it says I have to be root, and when I do adb root first it seems to pass but it still says I have to be root when i try adb remount.
How do I set my /system to r/w instead of r/o? I have tried adb mount o rw,remount /system but it wont do anything.. also the command you tell me to use, "adb disable-verity" says:
disable-verity only works for userdebug builds
Can you please help me?
Click to expand...
Click to collapse
you need to root it yourself or using the developer firmware in here:
https://developer.nvidia.com/gameworksdownload#?search=SHIELD
note that future OTA may fail because it will send you normal firmware even you are on developer firmware
DummyPLUG said:
you need to root it yourself or using the developer firmware in here:
note that future OTA may fail because it will send you normal firmware even you are on developer firmware
Click to expand...
Click to collapse
I did root my nvidia shield. It is supposed to be rooted, I got super user(superSU) installed on it and Everything..
Kylistar said:
I did root my nvidia shield. It is supposed to be rooted, I got super user(superSU) installed on it and Everything..
Click to expand...
Click to collapse
you mean mount -o remount,rw /system didn't work? but I suppose it can't as verity will prevent it, I hear SU in 7.0 will disable verity but I didn't try it before, sorry about this.
DummyPLUG said:
you mean mount -o remount,rw /system didn't work? but I suppose it can't as verity will prevent it, I hear SU in 7.0 will disable verity but I didn't try it before, sorry about this.
Click to expand...
Click to collapse
I actually got the kl file into the system/usr/keylayout directory now, using TWRP
with these steps:
Reboot to Bootloader
Type “adb reboot bootloader” and hit enter. The Shield TV should reboot into the bootloader screen.
Fastboot with TWRP
Type “fastboot devices” and make sure your Shield TV is visible.
If your Shield TV is listed, type “fastboot boot twrprecovery.img”
in the TWRP i can chose mount and check system, then i was able to move the .kl file from the sdcard to the keylayout directory, still my nvidia shield doesnt give it the new settings.. its given the same configuration as my nvidia controllers. I have double checked that Vendor nr and Product nr is the same as the controllers.
here's my .kl file:
# ps4
key 304 BUTTON_X
key 305 BUTTON_A
key 306 BUTTON_B
key 307 BUTTON_Y
key 308 BUTTON_L1
key 309 BUTTON_R1
key 310 BUTTON_L2
key 311 BUTTON_R2
key 312 BACK
key 313 HOME
key 314 BUTTON_THUMBL
key 315 BUTTON_THUMBR
key 316 BUTTON_START
looks correct?
Thanks for your time!
Kylistar said:
I actually got the kl file into the system/usr/keylayout directory now, using TWRP
with these steps:
Reboot to Bootloader
Type “adb reboot bootloader” and hit enter. The Shield TV should reboot into the bootloader screen.
Fastboot with TWRP
Type “fastboot devices” and make sure your Shield TV is visible.
If your Shield TV is listed, type “fastboot boot twrprecovery.img”
in the TWRP i can chose mount and check system, then i was able to move the .kl file from the sdcard to the keylayout directory, still my nvidia shield doesnt give it the new settings.. its given the same configuration as my nvidia controllers. I have double checked that Vendor nr and Product nr is the same as the controllers.
here's my .kl file:
# ps4
key 304 BUTTON_X
key 305 BUTTON_A
key 306 BUTTON_B
key 307 BUTTON_Y
key 308 BUTTON_L1
key 309 BUTTON_R1
key 310 BUTTON_L2
key 311 BUTTON_R2
key 312 BACK
key 313 HOME
key 314 BUTTON_THUMBL
key 315 BUTTON_THUMBR
key 316 BUTTON_START
looks correct?
Thanks for your time!
Click to expand...
Click to collapse
Yes TWRP can write into system, but last time when I try it trigger the verity protection sometime, don't investigate it though as I am lazy and just use the developer build since then. (another reason I semi brick my shield a few time with twrp)
the.kl looks correct, to see what is the problem try remove one of those key from the .kl, if shield load the file correctly that key should be disable, if not then the .kl file is not work.
I can't remember if the file need to be in unix EOL style or not, that means if you edit it in windows notepad it may not work, try notepad++ or pspad. (I may mix up with bt_config.conf, which I use to maually pair my xiaomi remote)
DummyPLUG said:
Yes TWRP can write into system, but last time when I try it trigger the verity protection sometime, don't investigate it though as I am lazy and just use the developer build since then. (another reason I semi brick my shield a few time with twrp)
the.kl looks correct, to see what is the problem try remove one of those key from the .kl, if shield load the file correctly that key should be disable, if not then the .kl file is not work.
I can't remember if the file need to be in unix EOL style or not, that means if you edit it in windows notepad it may not work, try notepad++ or pspad. (I may mix up with bt_config.conf, which I use to maually pair my xiaomi remote)
Click to expand...
Click to collapse
It looks like my shield wont recognize the files im putting in there, I tried replacing the Generic file with a modified one, after that the ps4 controller wont work at all, Before it just had the wrong buttons, then i tried changing back to the original file and the shield wont read it.
This should mean the reason my new .kl file for the ps4 controller wasnt recognized because of this.
Any idea what I do now? How do I get it to recognize the files? How do I get at least the generic back if that is not possible?
And yes, I do use pspad.
Kylistar said:
It looks like my shield wont recognize the files im putting in there, I tried replacing the Generic file with a modified one, after that the ps4 controller wont work at all, Before it just had the wrong buttons, then i tried changing back to the original file and the shield wont read it.
This should mean the reason my new .kl file for the ps4 controller wasnt recognized because of this.
Any idea what I do now? How do I get it to recognize the files? How do I get at least the generic back if that is not possible?
And yes, I do use pspad.
Click to expand...
Click to collapse
If you replace the generic file and it didn't work this mean the file is something wrong, the first thing I come in my mind is the file still using windows (CRLF) not Unix (LF), but as you said even you copy the original .kl back to shield it still didn't work then may be the dm-verity kick in
if it is dm-verity kick in the best and easiest way to recovey is flash the firmware again, as it is hard to modify the current system block to have the same hash as original one
I am having the same issue as above. My Shield doesn't recognize the changes made to the .kl file I edited.
I have a rooted Shield running on the latest Shield software 7.0.2 and a Fire TV Stick Remote connected.
I used cat /proc/bus/input/devices to see the remote uses vendor 1949 product 0404 key layout.
I went to system/usr/keylayouts, navigated to that kl file and then modified the 2 keys I wanted to change. Rewind and fast forward. I changed them to VOL_DOWN and VOL_UP.
I saved the changes and rebooted.
However they still act as MEDIA_REWIND and MEDIA_FAST_FORWARD.
I have verified the changes are still showing in the key layout file. I don't understand why it's not working.
The last time I rooted my Shield, I was using another Fire TV remote (the Alexa Voice Remote), which uses 1949 0407.kl file.
I modified that one to make the same changes and it worked. I could control the volume.
Since then though, I've factory reset the Shield am rooted onced again and this time I am using this fire tv stick remote, but can't seem to get the changes to the key layout file to actually take affect and I don't understand why it's not working. What is different than when I modified the other remote? Makes no sense.
EDIT: Ok so I figured it out basically right after making this post. I was trying to use VOL_UP and VOL_DOWN, which I could have sworn was the correct key code and what I used with my other Fire TV remote before I factory reset. However I tried again, this time though using VOLUME_UP and VOLUME_DOWN and it worked properly.
Damn, I'm dumb. Now it's working exactly how I wanted it to.
I am guessing by using the wrong key code, thus rendering it useless, it was falling back to the key code used for the same key ID in the generic.kl file?
thanks, i will try
How do we know the vendor number for external remote? I tried on android box and there is no system under /proc
how do i set the proper chmod when running the push command to put the file onto the device?
Thanks for this, but I am trying to use Mi remote with voice control
Everything works except the Google assistant button, it brings up assistant but doesn't detect any voice from remote.
Can something similar be done with an IR remote?
I'd love to have more buttons that I could use for all kinds of automations.
Thanks!
How to open app using this method? Suppose I want to open google chrome, how would I do that? @DummyPLUG

Categories

Resources