[Q] How to map gamepad/joystick axes to control the UI? - Android Q&A, Help & Troubleshooting

I have a joystick with 6 axes an 2 buttons. If I connect that joystick to my device (nexus 7) through an otg cable it gets recognized as HID device.
The two buttons are both mapped by android to ENTER and the X + Y axes to direction keys.
So it is already possible to control some UI sections (ie app icon selection on launcher).
I added a key layout map in "/system/usr/keylayout/Vendor_046d_Product_c626.kl" to customize the two buttons.
I was also able to remap and invert all 6 axes.
Code:
# left / right
axis 0x00 RX
# forth / back
axis 0x01 RY
# up / down
axis 0x02 RZ
# roll forth / back
axis 0x03 Y
# roll left / right
axis 0x04 X
# turn left / right
axis 0x05 Z
# left button
key 256 VOLUME_DOWN
# right button
key 257 VOLUME_UP
As you can see I mapped the two buttons to the volume controls, which works fine.
Unfortunately I'm not able to figure out how to map axes to keystrokes.
As the X + Y axes are mapped to direction keys, there must be a setting somewhere for this.
I would like to use all 6 axes and map them to simple keystrokes.
Can sombody help?

Hello g-e-c-o.
I know this thread is a lil bit older but I'm getting faced with the same problem soon. Did you find any solution for mapping the axes?

Try this
key 105 DPAD_LEFT
key 106 DPAD_RIGHT
key 108 DPAD_DOWN
key 103 DPAD_UP
key 256 BUTTON_1
key 257 BACK

Related

[Fix] Make the volume adjustable while locked

So, there's the problem with the X2 having the volume buttons not work when it's locked. I just got one a couple days ago, and decided to poke around to see if I could get it going. I messed with my old Nexus One and reassigned the Search button to the camera, so I started with the keylayout directory. Well, after some experimenting, I got it going. While you have to press the button for each incremental change in volume, it beats having to turn the device on.
Note: I can't post links due to a low post count. So my lack of helpful links is the forums' fault, not mine. My apologies.
What you'll need before you begin;
1) Root access. The X2 can be rooted with Gingerbreak.
2) A file manager. I use Root Explorer.
2b) If you're manually applying the changes, and you're using a file manager without one built-in, you'll need a text editor. Root Explorer has one, so...figure it out.
The Long Method
=Step One=
Navigate to "/system/usr/keylayout". The file we're working with is "tegra-kbc.kl"
=Step Two=
Mount the file system as read/write, make a backup of tegra-kbc.kl(I'm partial to adding a .ori to the end, but that's me), and open tegra-kbc.kl in a text editor.
=Step Three=
Lines six and seven, right below Camera, are the volume buttons we're looking for. We're going to append "WAKE" at the end of the line, to tell the phone to listen when they're pressed. Mine looks like this;
key 115 VOLUME_UP WAKE
key 114 VOLUME_DOWN WAKE
Obviously, it's not too picky about spacing. So the sky and your anal-retentiveness is the limit.
=Step Four=
Save the file, set correct permissions if they got mangled somehow(rw-r--r--, for reference), and restart.
The Short Method
=Step One=
Download the needed file. Take any public dropbox file link, and replace the end with "/u/3487229/Android/tegra-kbc.kl"
Look, I'd just give the link, but low post count and all. My apologies.
=Step Two=
Make a backup of, then copy the file over /system/usr/keylayout/tegra-kbc.kl
=Step Three=
Reset any mangled permissions(rw-r--r--, for reference), and restart.
Awesome.
10char
Worked a champ. Was trying to figure out how to do this last night.
Could someone paste the tegra file. I think I may have deleted it while attempting to make a backup. Many Thanks!
Sent from my Xoom using XDA App
Just tried this and did not work. Looking at file now, says WAKE after each, restarted and still doesn't work.
This may sound dumb, but I don't think this method "fixed" anything. I accidentally deleted the tegra-kbl.kl file but my volume can be adjusted while locked. The trick is to press volume multiple times rather than holding to adjust. FYI I never got a chance to adjust the file per the OP. Lemme know if this works for anyone else.
ALSO I STILL WOULD REALLY APPRECIATE SOMEONE POSTING THE TEGRA-KBL.KL FILE. THANK!
Sent from my DROID X2 using XDA App
Elite49 said:
Just tried this and did not work. Looking at file now, says WAKE after each, restarted and still doesn't work.
Click to expand...
Click to collapse
Does it match the above, where there's at least one space between WAKE and the word preceding it? Also, are the permissions correct?
cmanatam said:
This may sound dumb, but I don't think this method "fixed" anything. I accidentally deleted the tegra-kbl.kl file but my volume can be adjusted while locked. The trick is to press volume multiple times rather than holding to adjust. FYI I never got a chance to adjust the file per the OP. Lemme know if this works for anyone else.
ALSO I STILL WOULD REALLY APPRECIATE SOMEONE POSTING THE TEGRA-KBL.KL FILE. THANK!
Click to expand...
Click to collapse
That's how this works when implemented; you can't just hold down volume, but each click changes the volume by one increment.
I'm not sure how you got to where you are; when I accidently deleted the keylayout file on my Nexus One, none of the physical buttons worked, except the power button to power it on.
That was a fun one to recover from.
While I see someone else posted the entire original file in another thread, let me post what mine looks like, for comparison.
Modified tegra-kbc.kl, with volume fix and Search reassigned to Camera;
Code:
key 102 HOME WAKE
key 139 MENU WAKE_DROPPED
key 158 BACK WAKE_DROPPED
key 212 FOCUS
key 211 CAMERA
key 115 VOLUME_UP WAKE
key 114 VOLUME_DOWN WAKE
key 217 SEARCH WAKE_DROPPED
key 28 ENTER
key 103 DPAD_UP WAKE_DROPPED
key 108 DPAD_DOWN WAKE_DROPPED
key 105 DPAD_LEFT WAKE_DROPPED
key 106 DPAD_RIGHT WAKE_DROPPED
key 232 DPAD_CENTER WAKE_DROPPED
#
# IKXETNA-128 Verizon UTS tool support
#
key 2 1 WAKE_DROPPED
key 3 2 WAKE_DROPPED
key 4 3 WAKE_DROPPED
key 5 4 WAKE_DROPPED
key 6 5 WAKE_DROPPED
key 7 6 WAKE_DROPPED
key 8 7 WAKE_DROPPED
key 9 8 WAKE_DROPPED
key 10 9 WAKE_DROPPED
key 11 0 WAKE_DROPPED
key 56 ALT_LEFT WAKE_DROPPED
key 42 SHIFT_LEFT WAKE_DROPPED
key 62 ENDCALL WAKE_DROPPED
key 61 CALL WAKE_DROPPED
key 228 POUND WAKE_DROPPED
key 227 STAR WAKE_DROPPED
key 231 CALL WAKE_DROPPED
key 162 POWER WAKE
key 14 DEL
key 57 SPACE
key 52 PERIOD
key 51 COMMA
key 16 Q
key 17 W
key 18 E
key 19 R
key 20 T
key 21 Y
key 22 U
key 23 I
key 24 O
key 25 P
key 30 A
key 31 S
key 32 D
key 33 F
key 34 G
key 35 H
key 36 J
key 37 K
key 38 L
key 44 Z
key 45 X
key 46 C
key 47 V
key 48 B
key 49 N
key 50 M
Mine looks just like that, still doesn't work.
@Elite49;
Here's what I'd do, on your device. I know we might be treading old ground, but just to rule anything out, try this;
1) Download the attached file. Lop off the file extension so it's just "tegra-kbc.kl"
2) Copy it, and head over to /system/usr/keylayout. Take the existing "tegra-kbc.kl" and put on a file extension that renders it inoperable(I like .ori, but that's just me).
3) Paste the downloaded "tegra-kbc.kl" into the keylayout folder.
4) Check permissions and ownership. Ownership needs to be root on both group and user, and permissions should be rw-r--r--.
5) Power-cycle.
6) Try it out. The quickest way, with that file, is to hold down the search key. If it's using that key layout file, after a few moments your camera app should come up. If it does, then your volume buttons should also be usable when your device is locked.
If you don't want camera on your search key, here's how you change it back. I only suggest doing this after you've verified your device is using this key layout file. If you do it before, then we're back to square one because we're only testing the volume buttons. This's changing two functions, making it easier to see whether it's a hardware or software issue.
1) Open /system/usr/keylayout/tegra-kbc.kl
2) Find CAMERA. Change the key from 211 to 217.
3) Find SEARCH. Change the key from 217 to 211.
4) Save file, check ownership and permissions, reboot. Ta-da.
Thanks!
This marks a huge negative off of my list! I think I will keep it now.
-JJ

[TWEAK]Walkman Key in LIVE

This is a little example for how to use walkman key as search key so with this u can use any app u want with that kay by just using an app that changes search key behavior
1.Using any file explorer with root go to /system/usr/keylayout/
2. Edit with texteditor file: pm8058-keypad.kl
It should look like this:
Code:
# this corresponds to kernel/arch/arm/mach-msm/keypad-coconut.c
#
# defines for values are in frameworks/base/include/ui/KeycodeLabels.h
key 115 VOLUME_UP WAKE
key 114 VOLUME_DOWN WAKE
# KEY_HOME
key 102 HOME WAKE_DROPPED
# CAMERA Related Key
key 212 CAMERA
key 528 FOCUS
# WALKMAN key
key 200 VENDOR_1
At the bottom of the file u can see:
Code:
# WALKMAN key
key 200 VENDOR_1
VENDOR_1 is used to tell android which action the key will take
so if we change VENDOR_1 to SEARCH wolkman key will be recognized as a SEARCH key.
So the file after changing it should look like this:
Code:
# this corresponds to kernel/arch/arm/mach-msm/keypad-coconut.c
#
# defines for values are in frameworks/base/include/ui/KeycodeLabels.h
key 115 VOLUME_UP WAKE
key 114 VOLUME_DOWN WAKE
# KEY_HOME
key 102 HOME WAKE_DROPPED
# CAMERA Related Key
key 212 CAMERA
key 528 FOCUS
# WALKMAN key
key 200 SEARCH
After editing the file save it and reboot device.
U can map any action to this kay that android will recognize for the rest of actions availdable u can use qwerty.kl as refrance:
Code:
key 399 GRAVE
key 2 1
key 3 2
key 4 3
key 5 4
key 6 5
key 7 6
key 8 7
key 9 8
key 10 9
key 11 0
key 158 BACK WAKE_DROPPED
key 230 SOFT_RIGHT WAKE
key 60 SOFT_RIGHT WAKE
key 107 ENDCALL WAKE_DROPPED
key 62 ENDCALL WAKE_DROPPED
key 229 MENU WAKE_DROPPED
key 139 MENU WAKE_DROPPED
key 59 MENU WAKE_DROPPED
key 127 SEARCH WAKE_DROPPED
key 217 SEARCH WAKE_DROPPED
key 228 POUND
key 227 STAR
key 231 CALL WAKE_DROPPED
key 61 CALL WAKE_DROPPED
key 232 DPAD_CENTER WAKE_DROPPED
key 108 DPAD_DOWN WAKE_DROPPED
key 103 DPAD_UP WAKE_DROPPED
key 102 HOME WAKE
key 105 DPAD_LEFT WAKE_DROPPED
key 106 DPAD_RIGHT WAKE_DROPPED
key 115 VOLUME_UP WAKE
key 114 VOLUME_DOWN WAKE
key 116 POWER WAKE
key 212 CAMERA
key 16 Q
key 17 W
key 18 E
key 19 R
key 20 T
key 21 Y
key 22 U
key 23 I
key 24 O
key 25 P
key 26 LEFT_BRACKET
key 27 RIGHT_BRACKET
key 43 BACKSLASH
key 30 A
key 31 S
key 32 D
key 33 F
key 34 G
key 35 H
key 36 J
key 37 K
key 38 L
key 39 SEMICOLON
key 40 APOSTROPHE
key 14 DEL
key 44 Z
key 45 X
key 46 C
key 47 V
key 48 B
key 49 N
key 50 M
key 51 COMMA
key 52 PERIOD
key 53 SLASH
key 28 ENTER
key 56 ALT_LEFT
key 100 ALT_RIGHT
key 42 SHIFT_LEFT
key 54 SHIFT_RIGHT
key 15 TAB
key 57 SPACE
key 150 EXPLORER
key 155 ENVELOPE
key 12 MINUS
key 13 EQUALS
key 215 AT
# On an AT keyboard: ESC, F10
key 1 BACK WAKE_DROPPED
key 68 MENU WAKE_DROPPED
And the most useful with Walkman:
Code:
key 200 MEDIA_PLAY_PAUSE WAKE
key 201 MEDIA_PLAY_PAUSE WAKE
key 166 MEDIA_STOP WAKE
key 163 MEDIA_NEXT WAKE
key 165 MEDIA_PREVIOUS WAKE
key 168 MEDIA_REWIND WAKE
key 208 MEDIA_FAST_FORWARD WAKE
When changing action taken by walkman key to one of the above like MEDIA_PLAY_PAUSE its advised to add this WAKE too if u want to use this button when phone is sleeping
So it should look like this:
Code:
# WALKMAN key
key 200 MEDIA_PLAY_PAUSE WAKE
Hope this helps
wow ...
its great .... tks tks
very good work
thanks
/
# WALKMAN key
key 200 HEADSETHOOK WAKE
to end call, BEGIN CALL and music control (the button will work like buttun on headset)
so if i want to launch poweramp application with this walkman button, how do i do that? will simply mention app name work?
key 200 POWERAMP
If u want to assign poweramp app to Walkman key the only option for now is to assign it as search key and then with app for example: LaunchKey assign an app to long press search key.
kenny313 said:
If u want to assign poweramp app to Walkman key the only option for now is to assign it as search key and then with app for example: LaunchKey assign an app to long press search key.
Click to expand...
Click to collapse
can you give an example?
i want to assign double twist player to walkman key
this is awesome, the walkman key finally works on cm7
In CM7.2 Walkman button is not working, is there any way to fix it??
Sent from my WT19i using XDA
in cm7 use the above method to allocate search to walkman key and then go to settings, cm settings, input, search key behavior and choose whatever app you want for the long press action, for the short press whenever a search is possible, that will turn up instead of the app.
kenny313 said:
If u want to assign poweramp app to Walkman key the only option for now is to assign it as search key and then with app for example: LaunchKey assign an app to long press search key.
Click to expand...
Click to collapse
Good work man but i would like to assign the key to poweramp too how to do that? i am on hyprom v15 and tried to do search example to assign poweramp but it dosent work for me
Great!
Anyone know where VENDOR_1 is set? There should be the same line in another file pointing to the walkman apk. I would also like to change the button to launch Ubermusic.
badawy85 said:
Good work man but i would like to assign the key to poweramp too how to do that? i am on hyprom v15 and tried to do search example to assign poweramp but it dosent work for me
Click to expand...
Click to collapse
i don't know, i tried all sorts of things.. can't get it done
EDIT: removed, cannot delete on mobile app.
Sent from my WT19i using xda premium
worked for me
i lost Walkman button after installing cyanogen 7.2 on LWW
got it back now
thx
Hi guys!
What the codename "smartkey"? MH1 LiveSound headset extra key.
Thx!
i tried to change the keys..
loke..
the CAMERA key to POWER key..
but its not working
i wud like to use my walkman button to use use as power key to wake device instead of power or home key in stock rom
dis works well in cm based roms but in stock i tried but failed
anikanu said:
i wud like to use my walkman button to use use as power key to wake device instead of power or home key in stock rom
dis works well in cm based roms but in stock i tried but failed
Click to expand...
Click to collapse
Pls check ur PM ^^
Sent from my Xperia Miro using xda premium
anikanu said:
i wud like to use my walkman button to use use as power key to wake device instead of power or home key in stock rom
dis works well in cm based roms but in stock i tried but failed
Click to expand...
Click to collapse
plz anyone
anikanu said:
plz anyone
Click to expand...
Click to collapse
anikanu said:
i wud like to use my walkman button to use use as power key to wake device instead of power or home key in stock rom
dis works well in cm based roms but in stock i tried but failed
Click to expand...
Click to collapse
I also want to use walkman key as Power key bcoz my power key is broken

[Q] A very disturbing keyboard issue with xperia pro(mk16i)(rom independent)

Guys i have a very disturbing issue with my xperia pro (mk16i)
When i gently apply a pressure to the screen, one of the buttons in the physical keyboard is pressed down and the phone wakes up.
This often causes phone to unlock in my pocket and do random stuff(calls someone, plays mp3...)
So my question is that is it not possible to deactivate the keyboard buttons when the physical keyboard is closed.
Any help will be appreciated much.
Thanks...
The solutİon!!!
An intensive research yielded the solution.
"/system/usr/keylayout/pm8xxx-keypad.kl" file has all the information about which keys will wake the phone up and which keys don't.
Originally it was:
Code:
# file pm8xxx-keypad.kl
# this corresponds to kernel/arch/arm/mach-msm/keypad-iyokan.c
#
# defines for values are in frameworks/base/include/ui/KeycodeLabels.h
# KEY_VOLUMEUP, KEY_VOLUMEDOWN
key 115 VOLUME_UP WAKE
key 114 VOLUME_DOWN WAKE
# KEY_MENU, KEY_HOME, KEY_BACK
key 139 MENU
key 102 HOME WAKE_DROPPED
key 158 BACK
# KEY_CAMERA, KEY_CAMERA_FOCUS
key 212 CAMERA
key 528 FOCUS
key 108 DPAD_LEFT WAKE_DROPPED
key 103 DPAD_RIGHT WAKE_DROPPED
key 105 DPAD_UP WAKE_DROPPED
key 106 DPAD_DOWN WAKE_DROPPED
key 16 Q WAKE
key 17 W WAKE
key 18 E WAKE
key 19 R WAKE
key 20 T WAKE
key 21 Y WAKE
key 22 U WAKE
key 23 I WAKE
key 24 O WAKE
key 25 P WAKE
key 30 A WAKE_DROPPED
key 31 S WAKE_DROPPED
key 32 D WAKE_DROPPED
key 33 F WAKE_DROPPED
key 34 G WAKE
key 35 H WAKE
key 36 J WAKE
key 37 K WAKE_DROPPED
key 38 L WAKE_DROPPED
key 44 Z WAKE_DROPPED
key 45 X WAKE_DROPPED
key 46 C WAKE_DROPPED
key 47 V WAKE_DROPPED
key 48 B WAKE_DROPPED
key 49 N WAKE_DROPPED
key 50 M WAKE_DROPPED
key 40 APOSTROPHE WAKE_DROPPED
key 51 COMMA WAKE_DROPPED
key 52 PERIOD WAKE_DROPPED
key 57 SPACE WAKE_DROPPED
key 14 DEL WAKE_DROPPED
key 28 ENTER WAKE_DROPPED
key 56 ALT_LEFT WAKE_DROPPED
key 42 SHIFT_LEFT WAKE_DROPPED
key 26 AT WAKE_DROPPED
key 27 GRAVE WAKE_DROPPED
key 127 PICTSYMBOLS WAKE_DROPPED
key 368 CAPS_LOCK WAKE_DROPPED
As one can realize, the keys with "WAKE" or "WAKE_DROPPED" labels wakes the phone up. So i deleted the "WAKE" labels of all the buttons of slide-out keyboard with root browser. Then the new form is like this:
Code:
# file pm8xxx-keypad.kl
# this corresponds to kernel/arch/arm/mach-msm/keypad-iyokan.c
#
# defines for values are in frameworks/base/include/ui/KeycodeLabels.h
# KEY_VOLUMEUP, KEY_VOLUMEDOWN
key 115 VOLUME_UP WAKE
key 114 VOLUME_DOWN WAKE
# KEY_MENU, KEY_HOME, KEY_BACK
key 139 MENU
key 102 HOME WAKE_DROPPED
key 158 BACK
# KEY_CAMERA, KEY_CAMERA_FOCUS
key 212 CAMERA
key 528 FOCUS
key 108 DPAD_LEFT
key 103 DPAD_RIGHT
key 105 DPAD_UP
key 106 DPAD_DOWN
key 16 Q
key 17 W
key 18 E
key 19 R
key 20 T
key 21 Y
key 22 U
key 23 I
key 24 O
key 25 P
key 30 A
key 31 S
key 32 D
key 33 F
key 34 G
key 35 H
key 36 J
key 37 K
key 38 L
key 44 Z
key 45 X
key 46 C
key 47 V
key 48 B
key 49 N
key 50 M
key 40 APOSTROPHE
key 51 COMMA
key 52 PERIOD
key 57 SPACE
key 14 DEL
key 28 ENTER
key 56 ALT_LEFT
key 42 SHIFT_LEFT
key 26 AT
key 27 GRAVE
key 127 PICTSYMBOLS
key 368 CAPS_LOCK
AND THE PROBLEM HAS GONE AWAY...
I attach the file you can use. But it may be specific to CM11 rom! Be careful.
A further info:
WAKE: The key should wake the device when it is asleep. For historical reasons, this flag behaves in the same manner as WAKE_DROPPED below.
WAKE_DROPPED: The key should wake the device when it is asleep but the key itself should be dropped when the wake-up occurs. In a sense, the key's action was to wake the device, but the key itself is not processed.
Thanks...

How to disable fingerprint sensor - backward functionality

Hi,
I cannot figure out how to disable the "backward functionality" of the fingerprint sensor.
A swipe over this device brings the M5 back to the home screen.
This is very annoying while playing a game.
I already switched the method of input in the settings to use Android's softkeys at the bottom but the "backward functionality" works as before.
I also tried to use a different launcher.
-> Didn't help
Does anybody have a clue?
Cheers,
Janny
yes very painful...can't find anywhere to disable...i keep hitting it accidentally.
Rotate your device the other way around so that the fingerprint reader is either on top of on the left side. It might help
Yes I would like time a way to disable it completely as well, it's pretty annoying right now.
Xposed Edge Pro has been used to remap the fingerprint sensor on other Huawei devices. But it requires Xposed.
Hi, same problem... ?
hi all!
I have the same problem, obviously, and till someone finds the way to disable the infamous button (that I don't use at all), I found a very simple trick...
I used a small piece of paper tape to cover the button...
ugly but it really works...
no more accidental touches and jumps to the home page while playing!
Pierluigi
If you have root access, just edit or remove the relevant key mappings /vendor/usr/keylayout/fingerprint.kl to your liking.
I edited mine so that a tap = home, swipe up = recents, swipe down = back
^^ can I ask if you could share the changes you made to fingerprint.kl? I have struggled to make good sense of it and am reluctant to experiment blindly. I'd ideally like mine to do nothing on tap or longpress, go back on double click, screenshot on triple click, and pull up Recents on swipe.
Do I set 'doubleclick' to key 174 and delete entries for click and longpress? I still want to be able to use it to wake the screen.
Stock file:
#
# Touch sensor driver
#
# Copyright (c) 2013,2014 Fingerprint Cards AB <[email protected]>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License Version 2
# as published by the Free Software Foundation.
#
# "click"
key 28 ENTER
# "finger wakeup"
key 113 KEYCODE_FINGERPRINT_FINGER_UP
key 111 KEYCODE_FINGERPRINT_DOUBLECLICK
key 105 KEYCODE_FINGERPRINT_LEFT
key 106 KEYCODE_FINGERPRINT_RIGHT
key 108 KEYCODE_FINGERPRINT_DOWN
key 103 KEYCODE_FINGERPRINT_UP
key 174 KEYCODE_FINGERPRINT_CLICK
key 117 KEYCODE_FINGERPRINT_FINGER_DOWN
key 118 KEYCODE_FINGERPRINT_FINGER_IDENTIFY
key 119 KEYCODE_FINGERPRINT_IDENTIFY_END
key 120 KEYCODE_FINGERPRINT_FINGER_ENROLL
Sure, here's mine.
Code:
key 28 HOME
key 105 BACK
key 106 APP_SWITCH
key 174 VOICE_ASSIST
28 = tap button
105 = swipe down
106 = swipe up
174 = tap and hold
Just delete the entries you don't want, or comment them out with a # then reboot
Didn't really work for me on the stock rom, with off-screen navigation enabled. I tried 'key 105 BACK, key 106 APP_SWITCH.' Upon reboot, it did nothing on tap or swipe, but still returned me home on longpress.
Got the same issue on both my 8.4 and pro really really annoying.
Op, why not use huawei game app?
It will disable tap to back function which it's helpful during gaming.
But it's still possible to go home screen when long press fingerprint.
This is very annoying
Try this:
Download and install Game suite from APKMirror:
https://www.apkmirror.com/apk/huawei/game-suite/game-suite-8-0-1-101-release/game-suite-8-0-1-101-android-apk-download/
Open Game suite and add your game or application.
Enable Gaming mode.
Enable Mistouch prevention.
That's it, works for me!
Since I don't really care about using this button for anything other than the fingerprint unlock, I rooted and modified the /vendor/usr/keylayout/fingerprint.kl and added a # sign to every line. The button is ultimately disabled when you are using the device.
I'll just have to repeat the process with each firmware update, but since Huawei is so slow at updating, this isn't an issue.
Lee82UK said:
Sure, here's mine.
Code:
key 28 HOME
key 105 BACK
key 106 APP_SWITCH
key 174 VOICE_ASSIST
28 = tap button
105 = swipe down
106 = swipe up
174 = tap and hold
Just delete the entries you don't want, or comment them out with a # then reboot
Click to expand...
Click to collapse
Are you on Stock Rom? I didn't find these in my 8.1 Stock build. Can you please share your file.

Guide ASUS Kunai Fixes (Analog Drift + M1 as Start / M2 as Select) **ROOT only**

Hello everyone,
I made this thread to address two common issues that some may encounter with the Kunais. Unless there is ever an external updater released by ASUS, the known way to fix the "Right Kunai getting stuck" when in Handheld mode is to either update to CN .63 or WW .64 (it is to be assumed that later revisions should also fix that). When you first boot any of these 2, you'll be greeted with a firmware update for your accessory once connected.
The update should be 1.3.9, that will fix the right side having "stuck buttons" or the "analog drift" that occurs while using the Left side analog. From my personal testing, I was able to rollback to an older firmware with the problem no longer occuring, as long as the accessory was updated to 1.3.9 firmware.
As for the M1 and M2 buttons located behind the Kunais, when using the central unit, they can be used as extra buttons. When used in handheld mode, the hardware values leave you with two buttons that, yes can be mapped, but do not natively act as Select nor Start. That can be a problem in games/programs such as Stadia, Moonlight, or anything that do not let you remap in the software itself.
This can be fixed but will require root access. Assuming that you do:
-open up Root Explorer (quick Google search for "Root Explorer apk" if you don't have it and install that)
-once in Root Explorer, go to the root folder and click on "Mount R/W" it should change to "Mount R/O"
-Go to folder /system/usr/keylayout/
-Hold click on file "Vendor_0b05_Product_4500.kl" and make a Copy in the same folder
-It should create a copy, rename it to "Vendor_0b05_Product_7900.kl"
-Click on file you just renamed and pick "Text Editor"
-Add another blank line under "key 318..."
-Type "key 264 BUTTON_START"
-Enter another blank line
-Type "key 265 BUTTON_SELECT''
-Click on 3 dots top right and choose "Save and Exit"
From there, you can disconnect AND reconnect your Gamepad and your M1 and M2 buttons should now behave as START and SELECT respectively as would any BT gamepad.
If for any reason, that does not work, it is possible the your Kunais revision bears a different Vendor and Product ID. In such case, I would recommend getting any free Gamepad Tester program from Play Store and when testing, most if not all, should give you the name, vendor ID and product ID of your hardware being tested. If these numbers are different than the values in this guide, simply swap the values of the .kl file and that should work.
Cheers!
Your method works to reassign m1 and m2 into start and select, but unfortunately it makes left and right triggers into some key representing (|) for both. If there is a way to fix this then your method would be great. I tested it in a gamepad tester.
Left and right trigger register as key 313 in the gamepad tester.
iBluesurge said:
Your method works to reassign m1 and m2 into start and select, but unfortunately it makes left and right triggers into some key representing (|) for both. If there is a way to fix this then your method would be great. I tested it in a gamepad tester.
Left and right trigger register as key 313 in the gamepad tester.
Click to expand...
Click to collapse
That 313 trigger seems to come from "Keyboard" if anything, I'd assume whichever game you ran tests with probably has AirTrigger or a Gamepad Mapping still functional because that Keyboard trigger for 313 would most likely be something mimicking the touchscreen OR some BT device. But for reference, that is what my .kl looks like.
# Asus Gamepad
key 304 BUTTON_A
key 305 BUTTON_B
key 307 BUTTON_X
key 308 BUTTON_Y
key 310 BUTTON_L1
key 311 BUTTON_R1
key 316 BUTTON_MODE
key 317 BUTTON_THUMBL
key 318 BUTTON_THUMBR
key 265 BUTTON_SELECT
key 264 BUTTON_START
key 158 BACK
key 172 HOME
axis 0x00 X
axis 0x01 Y
axis 0x02 Z
axis 0x05 RZ
axis 0x09 RTRIGGER
axis 0x0a LTRIGGER
axis 0x10 HAT_X
axis 0x11 HAT_Y
WhyKlwd said:
That 313 trigger seems to come from "Keyboard" if anything, I'd assume whichever game you ran tests with probably has AirTrigger or a Gamepad Mapping still functional because that Keyboard trigger for 313 would most likely be something mimicking the touchscreen OR some BT device. But for reference, that is what my .kl looks like.
# Asus Gamepad
key 304 BUTTON_A
key 305 BUTTON_B
key 307 BUTTON_X
key 308 BUTTON_Y
key 310 BUTTON_L1
key 311 BUTTON_R1
key 316 BUTTON_MODE
key 317 BUTTON_THUMBL
key 318 BUTTON_THUMBR
key 265 BUTTON_SELECT
key 264 BUTTON_START
key 158 BACK
key 172 HOME
axis 0x00 X
axis 0x01 Y
axis 0x02 Z
axis 0x05 RZ
axis 0x09 RTRIGGER
axis 0x0a LTRIGGER
axis 0x10 HAT_X
axis 0x11 HAT_Y
Click to expand...
Click to collapse
Would you be willing to show me that left and right trigger still function for you on a gamepad tester? Also I copy and pasted what you have shown and it still shows a keyboard key for left and right trigger in the gamepad tester.
Is it possible to change the right analog sensitivity using this method?
iBluesurge said:
Would you be willing to show me that left and right trigger still function for you on a gamepad tester? Also I copy and pasted what you have shown and it still shows a keyboard key for left and right trigger in the gamepad tester.
Click to expand...
Click to collapse
Uh....That's interesting, it wasn't registering as button 312 and yet, now it does... Both L2 and R2 does it. I'll have to dig deeper and see what causes that but yeah, it seems you are right, there must be a trigger of some kind.
UPDATE: You are absolutely right, it breaks the mapping. I'm working on fixing it, if not in the next hour, it'll be updated in the next 12hours.
Hello, I've tested the WW .64 firmware, and I can confirm that it really fix the issue with the right controller. But im also encountering right now an issue with the right analog. When i gently press the right analog to the left and let it go, it seems like the input doesn't properly go back to the center. I've already tested with the holder directly connected to the phone and it doesn't occur. Can you please also test if it is also happening to your controller? Thanks
@xenken: I might be too tired to read this properly but at least when trying to recreate your conflict, I haven't had any issues as you seem to encounter, but I'll try again tomorrow.
Alright, I will make edits for the guide tomorrow cause right now, I'm exhausted and my bed is calling me. That being said, here is an edited .kl which is, so far, the best compromise I found. All keys work and have values that they should, L2 and R2 can now be mapped independently in ASUS's software but SELECT (M2) does not map any longer.
I get the feeling that some HEX path overlap between keys and is what causes the conflict, I tried many alternatives to no avail.
# Copyright (C) 2014 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Asus Gamepad
key 264 BUTTON_START
key 265 BUTTON_SELECT
key 304 BUTTON_A
key 305 BUTTON_B
key 307 BUTTON_X
key 308 BUTTON_Y
key 310 BUTTON_L1
key 311 BUTTON_R1
key 312 BUTTON_L2
key 313 BUTTON_R2
key 316 BUTTON_MODE
key 317 BUTTON_THUMBL
key 318 BUTTON_THUMBR
key 158 BACK
key 172 HOME
axis 0x00 X
axis 0x01 Y
axis 0x02 Z
axis 0x05 RZ
axis 0x09 RTRIGGER
axis 0x0a LTRIGGER
axis 0x10 HAT_X
axis 0x11 HAT_Y
Click to expand...
Click to collapse
THREAD CLOSED because a thread regarding this subject already exists:
https://forum.xda-developers.com/rog-phone-2/accessories/figuring-whats-wrong-kunai-t4015171
The posts from this thread have been copied to there.
XDA Forum Rules (excerpt):
...
5. Create a thread topic or post a message only once, this includes external links & streaming media.
As a large forum, we don't need unnecessary clutter. You're free to edit your message as you like, so if you do not receive an answer, revisit your message and see if you can describe your problem better. Not everyone is online at the same time so it might take a while before you receive an answer.
You can bump your unanswered question once every 24 hours
Duplicate threads and posts will be removed
Always post in an existing thread if a topic already exists, before creating a new thread.
Use our search function to find the best forum for your device.
Links to an external source are only allowed if relevant to the topic in hand. A description must be included, no copy & pasting from the original source.
Self-promotion is forbidden, this includes blogs, social media and video channels etc. Random links will be removed.
...
Click to expand...
Click to collapse

Categories

Resources