Ai button remapping?

Search This thread

büscher

Senior Member
Dec 13, 2010
659
548
Thank you for your answer. My phone is rooted with magisk and I did not install keylayout module. May you assist me how to edit gpio-keys.kl ?

You just need to opem the file with a text edior like qedit and change the line containing key 689 to
Code:
key 689 GOOGLE_ASSISTANT

Save the file and install the magisk module custom key layout again. The module will handle the rest.
 
  • Like
Reactions: MXKM

MXKM

Senior Member
Sep 27, 2012
55
18
www.gezdimgezdim.com
You just need to opem the file with a text edior like qedit and change the line containing key 689 to
Code:
key 689 GOOGLE_ASSISTANT

Save the file and install the magisk module custom key layout again. The module will handle the rest.

Thank you very much. I finally run tasker autovoice recognize with ai button. But it does not working while display off, works only display on.
 

büscher

Senior Member
Dec 13, 2010
659
548
Thank you very much. I finally run tasker autovoice recognize with ai button. But it does not working while display off, works only display on.

Yes, that seems to be a limitation with tasker or autoinput... I did not figure out how to get it working while screen is off...
 
  • Like
Reactions: MXKM

tesacrap

Member
May 3, 2017
33
5
Yes, that seems to be a limitation with tasker or autoinput... I did not figure out how to get it working while screen is off...

Is the tasker Workaround just working on the xiaomi.eu rom? I'm currently running the global and I am not getting Autoinput to recognize any of my keys..

€dit:
got it! had to change the seeting within Autoinput. Changed the settings in Autoinput/Root Settings/Select Input Device to gpio-keys. After that the simple renaming of:
Code:
key 689   AI
to
Code:
key 689   GOOGLE_ASSISTANT
made AutoInput able to recognize it. Thanx alot!
 
Last edited:

büscher

Senior Member
Dec 13, 2010
659
548
Is the tasker Workaround just working on the xiaomi.eu rom? I'm currently running the global and I am not getting Autoinput to recognize any of my keys..

€dit:
got it! had to change the seeting within Autoinput. Changed the settings in Autoinput/Root Settings/Select Input Device to gpio-keys. After that the simple renaming of:
Code:
key 689   AI
to
Code:
key 689   GOOGLE_ASSISTANT
made AutoInput able to recognize it. Thanx alot!

good you found out :highfive: and sorry for the late reply.
 
  • Like
Reactions: tesacrap

Joybeaver

New member
Mar 6, 2022
2
0
I have the opposite problem, hope someone can help.

My AI button doesn't do anything.

So the problem is, as i understand, that my mi 9 doesn't recognize the ai button as the ai button. I downloaded a few apps for remapping or just regestering the buttons, and they either show unknown 0 or nothing at all when I press the button (so it's definitely something with the software).

BUT this button works in this module to select the "other" option, so I'm confused.

(I suspect this could could have happened after I used a magisk module for remapping the DualShock 4 buttons, but I'm not sure)

So, my question is : how can I "tell" my mi 9 that the AI button is the AI button? I don't want to remap it or anything, i just want it to work again.
 

Attachments

  • Screenshot_2022-03-06-10-16-17-650_flar2.homebutton.jpg
    Screenshot_2022-03-06-10-16-17-650_flar2.homebutton.jpg
    103.2 KB · Views: 20
  • Screenshot_2022-03-06-10-16-02-875_com.flossga.android.whichbutton.jpg
    Screenshot_2022-03-06-10-16-02-875_com.flossga.android.whichbutton.jpg
    363 KB · Views: 20
  • Screenshot_2022-03-06-10-17-57-705_com.topjohnwu.magisk.jpg
    Screenshot_2022-03-06-10-17-57-705_com.topjohnwu.magisk.jpg
    392 KB · Views: 19

Top Liked Posts

  • There are no posts matching your filters.
  • 5
    I was able to remap AI Button on xiaomi.eu rom with some tricks. Now the button can serve as a real-AI button.

    You'll need the following Tools:

    • Magisk
    • Tasker
    • AutoInput

    Steps to get it work:
    • Create your custom Keylayout file and place it into /sdcard/Downloads/gpio-keys.kl
    Code:
    [...]
    key 115   VOLUME_UP
    key 114   VOLUME_DOWN
    key 102   HOME
    key 528   FOCUS
    key 766   CAMERA
    [B]key 689   GOOGLE_ASSISTANT[/B]

    Now install the following Magisk Module:
    https://xdaforums.com/apps/magisk/module-magisk-custom-keylayout-t3841125
    This module will place your custom gpio-keys.kl systemlessly to /system/usr/Keylayout

    After this you will be able to create a tasker Event with Plugin -> AutoInput -> Key
    Select Key Action "Key Down". For the Key code let the app help you, then press the AI button. It will show "0,".

    For both Tasker and AutoInput you need to enable Autostart, disable Battery optimization and even lock the apps in Recent Apps.

    Now you can assign tasks to this button. What I did so far:

    • Toggle AutoRotate on Doubleclick
    • Toggle AutoRotate in Gallery App
    • Launch Camera when on home screen
    • Close Camera if open
    • Toggle Mi Sound Enhancer in Poweramp
    • Share to Google Keep in specific Apps
    • Save Content in specific apps
    • In chrome, open new tab and click the search-field
    • If screen On but locked, toggle Torch

    May you guys have more ideas?

    What does not work:
    Every Task you want to execute while screen is off... No idea how this is accomplished.
    There seems to be no solution so far: https://forum.joaoapps.com/index.ph...ot-working-with-display-off.10342/#post-46702


    Remap without Tasker or AutoInput:
    Use Serbinhio's Mi AI Button Remapper magisk module to choose an action: https://xdaforums.com/Mi-9/themes/mod-mi-ai-button-remapper-t3918291
    His module works with screen off.
    2

    (Solved) I was able to remap the AI button by doing the following steps.

    Prerequisite: Mi Mix 3 must be rooted!

    1. Replace "AI" with "GOOGLE_ASSISTANT" in gpio-keys.kl#L32 (this is merely a place holder for the key, it may work by just removing "AI") using root-browser to navigate to the /system/usr/keylayout/ directory.
    2. Uninstall MI AI through ADB shell "pm uninstall -k --user 0 com.miui.voiceassist".
    3. Use BUTTON REMAPPER
    Enable Service
    Press "+" to assign new key
    Press the AI button
    Check longpress "0.25 sec"
    Action-Other...
    Choose "Voice Search" (or any other app you want to the AI button to open)
    4. Ensure the apps "Google" "Assistant" and "Button Mapper" can auto-start, modify system settings, and ignore battery optimizations.
    5. Enjoy (at your own risk, it works for me)
    1
    I've been looking for an answer to this.. I downloaded a couple of button remappers but there is no option to change this as far as I know... Someone please prove me wrong. This thing would be awesome with Ok Google launching instead of that Xiaoai...
    1
    replace it with what?

    Maybe CAMERA or something, then you should be able to remap even other functions with this app.
    https://play.google.com/store/apps/details?id=com.irishin.buttonsremapper&hl=en
    Currently I'm on GSI and can't test right now, though.
    1
    Is the tasker Workaround just working on the xiaomi.eu rom? I'm currently running the global and I am not getting Autoinput to recognize any of my keys..

    €dit:
    got it! had to change the seeting within Autoinput. Changed the settings in Autoinput/Root Settings/Select Input Device to gpio-keys. After that the simple renaming of:
    Code:
    key 689   AI
    to
    Code:
    key 689   GOOGLE_ASSISTANT
    made AutoInput able to recognize it. Thanx alot!

    good you found out :highfive: and sorry for the late reply.