Keylayout file not working with Controller - Android Q&A, Help & Troubleshooting

Hi!
I'm trying to re-assign buttons for my nintendo switch Left Joy-Con. The vendor ID is 057e and the product ID is 2006.
I created a file named Vendor_057e_Product_2006.kl in /System/usr/keylayout with 644 permissions owned by root user and in root group.
I tried this key binding in the file:
key 304 LEFT
key 305 DOWN
key 306 UP
key 307 RIGHT
I got the key codes from the gamepad tester app. But somehow when I start the phone and connect the controller, the generic.kl file is still used for the Joy-Con.
Does anyone have any idea why it would be?
Thank you

Related

[MOD][SK17i][Ver:1][ALPHA] Playstation GamePad 14/8/12

First: I am not responsible if this mod destroys your device!
WARNING: It is only for the Xperia Mini Pro (sk17i)
PlayStation GamePad​
This mod just remaps the hardware keyboard's buttons to look like the playstation one's.
Remaped Buttons:
W --> up
A --> left
Z --> down
D --> right
I --> triangle
M --> cross
J --> square (Actually "BACK" button)
L --> circle
Q --> R1
BackSpace --> L1
< --> start
> --> select
Requirements:
ES file explorer (Market Link: https://play.google.com/store/apps/...sMSwxLDEsImNvbS5lc3Ryb25ncy5hbmRyb2lkLnBvcCJd )
Root
Terminal Emulator (Market Link: https://play.google.com/store/apps/...251bGwsMSwxLDEsImphY2twYWwuYW5kcm9pZHRlcm0iXQ.. )
ClockWorkMod Recovery.
The attached file below.
This mod will place two files in the system folder
Gamepad (at /system) . It is a script that backups the qurrent keyboard mapping and replace it with the gamepad mapping!
gamepad.kl (at /system/usr/keylayout) Actually the new buttons
How to install:
Backup ROM.
Flash the attached file at ClockWorkMod Recovery.
Install Terminal Emulator and ES File Manager.
Open ES File Manager, go to Settings, Check "Root Explorer", "Mount File System", "Backup System App".
Pess "Allow".
Go to the terminal Emulator and type "su".
Press "Allow".
Then type "sh system/gamepad".
The device will reboot. Once it boots open a game and...
Enjoy!
How to uninstall:
Uninstall works only since you haven't changed ES File Manger Settings from the "How to install" proccess.
Open ES File Manager.
Press "HOME" button.
Open Terminal Emulator and type: "su".
Press Allow if needed.
Type "sh system/gamepad".
The device reboots...
Done!
I'm telling you to open the ES File Managen in order to mount the /system Read-Write! I will fix it in a later version!
Credits to:
BPaul (for the idea!)
Download: PS_Gamepad_v1.zip
Tested only on stock ics 4.0.4...
ChangeLog:
Version 1: Initial Release
this is your mod ? thanks anyway
Why everyone is so suspicious here? The original idea came from: http://forum.xda-developers.com/showthread.php?t=1503977 . I modded BPaul's files so they meet our device, taken his permissions and voila!
can you change deleting gamepad.kl? then we can change normal and gamepad mode without always paste gamepad.kl sorry for my bad english i'm from poland...
hye friend
this is work for ics custom rom,,i use ics serenity v2.1,,thanks for anwers:fingers-crossed:
It's Not Working on Some Key since there's a change, i've edit "gamepad.kl" to this
Code:
# Copyright (c) 2009, Code Aurora Forum.
#
# 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.
#
#
key 102 HOME WAKE
key 115 VOLUME_UP WAKE
key 114 VOLUME_DOWN WAKE
key 528 FOCUS
key 212 CAMERA WAKE
key 17 DPAD_UP WAKE_DROPPED
key 44 DPAD_DOWN WAKE_DROPPED
key 30 DPAD_LEFT WAKE_DROPPED
key 32 DPAD_RIGHT WAKE_DROPPED
key 23 BUTTON_Y WAKE_DROPPED
key 38 BUTTON_B WAKE_DROPPED
key 36 BUTTON_X WAKE_DROPPED
key 50 BUTTON_A WAKE_DROPPED
key 14 BUTTON_L1 WAKE_DROPPED
key 16 BUTTON_R1 WAKE_DROPPED
key 56 MENU WAKE_DROPPED
key 108 BUTTON_START
key 103 BUTTON_SELECT
which game can be play by this mod ?
fifa12 ?pes12?nfs most wanted ?
is it can be use to play ppsspp emulator ?
you can play fifa 12 xperia play version & asphalt seris & virtual tennis
sorry for my bad English
Works on CM 10.1
but buttons are not correst, W is left and Z is right and so on
fchaster said:
which game can be play by this mod ?
fifa12 ?pes12?nfs most wanted ?
is it can be use to play ppsspp emulator ?
Click to expand...
Click to collapse
see here
http://forum.xda-developers.com/showthread.php?t=1217060

[TUT] Disable Capacitive touch buttons+Home key on Xperia 2011 MDPI

[Only for those who don't like Capacitive touch buttons+Home key]
1 First of all make sure you have on-screen
buttons enabled. If you don't have on-screen buttons then just go to this thread to find out how to enable them-
http://forum.xda-developers.com/showthread.php?t=1940842
2 Download a root explorer or any similar explorer like that.
3 Navigate to
system>usr>keylayout, and look for a file named as " cyttsp_key.kl ".
4 Select it and open it as text with Root explorer's text editor.
5 There you will find following lines-
#KEY_MENU, KEY_BACK
key 139 MENU VIRTUAL
key 158 BACK VIRTUAL
6 Now all you have to do put # before these lines as shown below-
#key 139 MENU VIRTUAL
#key 158 BACK VIRTUAL
And done.
Now if you want to disable home key also then-
7 Again navigate to
system>usr>keylayout, and look for a file named as " pm8058-keypad.kl ".
8 Select it and open it as text with Root explorer's text editor.
9 There you will find following lines-
# this corresponds to kernel/arch/arm/mach-msm/keypad-hallon.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
10 Now again all you have to do put # before the line " key 102 HOME WAKE_DROPPED" as shown below-
# this corresponds to kernel/arch/arm/mach-msm/keypad-hallon.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
11 Now just reboot and DONE!
This tutorial should be applicable to Xperia Ray users also because it has same button like our devices.
Press thanks if you think this post is useful to you.
Nice guide, been searching for this while I'm using Paranoid Android ( 3 months ago )
via XDA for Timescape™
Diaz1999 said:
Nice guide, been searching for this while I'm using Paranoid Android ( 3 months ago )
via XDA for Timescape™
Click to expand...
Click to collapse
Mankotialovely said:
Click to expand...
Click to collapse
Are we can disable the "big & ugly" home key with adding "#" in front of HOME_KEY
via XDA for Timescape™
Diaz1999 said:
Are we can disable the "big & ugly" home key with adding "#" in front of HOME_KEY
via XDA for Timescape™
Click to expand...
Click to collapse
Yes my friend, sure.
Home key is also added in this tutorial.
Great but one question, after performing this will keys work in cwm or not ?
vivek856 said:
Great but one question, after performing this will keys work in cwm or not ?
Click to expand...
Click to collapse
Keys will definitely work in cwm.
Disable Home
Thanks for the idea, and it works,
But my Home key is nonfunctional , so i would like to change my home key action into my camera key . IS it possible, I mean when i press camera key i want to wake up my 4n
sesath said:
Thanks for the idea, and it works,
But my Home key is nonfunctional , so i would like to change my home key action into my camera key . IS it possible, I mean when i press camera key i want to wake up my 4n
Click to expand...
Click to collapse
Yes it is possible but before that can you provide me little info about your rom and phone ?
Hello. Can make longpressing the menu button to bring tasks list? (multistak app list). Tq!

Solution: Get Rid of Google Voice Search Popping In At Random While Using Headphones

With the latest software update of my Sony Z5P I faced a really annoying issue, which essentially prevents me from listening to the music with the device. Symptoms are as following: during headphones connect or disconnect, or even slight movement of the jack in the audio port, volume randomly goes all way up or down and, the most annoyingly, music pauses and Voice Search is activated. Very frustrating.
I searched for the possible fixes in the Internet and found that there are dozens of posts on various web resources, regarding exactly the same issue. The issue exists on a very broad range of phones, tablets and Android versions. There are a lot of solutions too, generally "Try to install app X" or even "disable Google Search", but nothing worked for me (and probably for majority of users). And I didn't wanted to disable Voice Search, because it's a useful feature.
Looking into the problem further, I discovered that the issue is caused by the wrong detection of a headphones by Android. The system decides that it's not headphones, but a headset, that is the headphones with a mic and hardware buttons to control audio. The system even places an icon to the upper bar and there is a "Headset is plugged in" notification in the drawer.
Due to a hardware difference between connectors of headphones and a headset, every time it is slightly moved in port generates random electric signals which Android mistakenly recognizes as commands from a hardware remote control. If you are listening to the music while walking or especially running, the chances are pretty high, that connector is moving slightly. And the music become constantly interrupted by Voice Assistant or its volume is being decreased or increased. That's really, really disturbing.
One particular useful post which I found was this one. From it I learned there is a /system/usr/keylayout directory in Android filesystem, with files handling hardware buttons. Other useful insight is a link to the small Chris Boyle's app for keypresses debug (he even made a blog post about it). With this knowledge and this small useful tool I started to dig into my phone's system.
Using Key Test app mentioned above I figured out that any slight jack movement generates keypresses with scan codes 226 and 582 (HEADSETHOOK and VOICE_ASSIST) and occasionally 114 and 115 (VOLUME_DOWN and VOLUME_UP). That's what I should find in the system.
At first I should state that to make my solution work, you will need a rooted phone. All dirty hacks need root privileges. For Sony Z5 Premium rooting I assembled a dedicated guide, although it should work with most recent Sony devices. If you have a phone from some other OEM, please search this forum, there are plenty of rooting guides.
Okay, you have a topic problem, your phone is rooted and your adb works. That's how I fixed my phone.
At first you should check contents of your phone's /system/usr/keylayout directory and inspect individual files. It's easier to do on a computer, so copy this folder (maybe with some file manager like ES File Explorer) to your internal or external storage (for example to /sdcard) and then transfer by MTP to the computer (in Windows use File Explorer, the directory is in the This PC\Xperia Z5 Premium Dual folder or something like this).
Once you have keylayout directory on your computer, use some text editor tool which can search multiple text files for a particular text (I use Notepad++, but if you are on a Unix-like OS, you may use grep as well). You should search you files for this text strings:
Code:
HEADSETHOOK
and
Code:
VOICE_ASSIST
On the latest Z5 Premium firmware (Android 6.0.1, build .224) these particular strings were found in the Generic.kl and msm8994-tomtom-snd-card_Button_Jack.kl files. While the former is a generic keymapping file of all Android devices, the latter is specific to Z5P, because of it's name, which suggests that it is somehow related to MSM 8994, which is a partnumber of Qualcomm Snapdragon 810 SoC. In fact, this file is obviously handles headset keypresses, and its contents are:
Code:
key 226 HEADSETHOOK
key 115 VOLUME_UP
key 114 VOLUME_DOWN
key 582 VOICE_ASSIST
key 260 VENDOR_1
Your phone may have file with some other name but contents should be similar. What worked in my case is a changing the codes in this file to some different values which are not used elsewhere. I changed mine to this:
Code:
key 995 HEADSETHOOK
key 996 VOLUME_UP
key 997 VOLUME_DOWN
key 998 VOICE_ASSIST
key 999 VENDOR_1
And that's how I placed modified msm8994-tomtom-snd-card_Button_Jack.kl back into its original place in the phone. This is particularly tricky and you absolutely need rooted phone to do this.
First, place the file into the phone's memory with a guaranteed write access. /sdcard usually is a such place:
Code:
adb.exe push msm8994-tomtom-snd-card_Button_Jack.kl /sdcard/
Then login to the phone's shell and become superuser (root):
Code:
adb.exe shell
[email protected]:/ $ su
[email protected]:/ #
After that make /system mounted as a read/write filesystem:
Code:
[email protected]:/ # mount -o remount,rw /system
And copy the modified file back in place. After that reboot:
Code:
root[email protected]:/ # cp /sdcard/msm8994-tomtom-snd-card_Button_Jack.kl /system/usr/keylayout/
[email protected]:/ # reboot
Once the file was updated and the phone rebooted, I checked keypresses with Key Test again. These keypresses were generated as before, with the same scan codes, but this time key codes were registered as KEYCODE_UNKNOWN and did not any harm. The system cannot recognize them and doesn't react to them in any sensible way.
That's it. Be informed, that if you plan to use a real headset, with this hack its keys will not work at all.
tl;dr
- Enable ADB and root access for ADB
- In ADB shell:
Code:
$ su
# mount -o remount,rw /system
# sed -i "s/\(key.*HEADSETHOOK\)/#\1/g" /system/usr/keylayout/Generic.kl
# sed -i "s/\(key.*VOICE_ASSIST\)/#\1/g" /system/usr/keylayout/Generic.kl
# reboot

How to swap Menu and Back Key of RN3 (Snapdragon) in CM13

I am on official build (cm-13.0-20160820-SNAPSHOT-ZNH5YAO0J4-kenzo.zip), I want to swap the menu and back key, so I use root explorer to change the value of Menu key (from 139 to 158) and the value of Back key (from 158 to 139) of the 3 files located at /system/usr/keylayout (Atmel_maXTouch_Touchscreen.kl, Generic.kl & qwerty.kl), after that I reboot the phone and found that it was not successful, the menu key and the back key remain unchanged.
Is there any apps or methods can be easily assign the layout of the hardware touch buttons of RN3? Thanks.

remap ing remote control keys (really want to)

I've browsed through other threads that look to have promising titles but to no avail.
I;ve got a remote-contol that has a dedicated "Kodi" button. I want to remap this to open SPMC instead. can anyone help me achieve this please?
************************************************************************************************
FURTHER INFO
***********************************************************************************
I've replaced kodi with the latest spmc fork instead and now the dedicated remote button does nothing,
I've ran "getevent" over a rooted ADB shell and have found the relevent entry in the ".kl" file (for me it is key 394 on aml_keypad. on /dev/input/event0 018c).
The file I found with the entry is Vendor_0001_Product_0001.kl and key 394 is mapped to "KODI" (Can I simply edit KODI to say SPMC16 and have it work? is this call to KOD,I a script hidden further in the file system that causes kodi to execute?)

Categories

Resources