[ROOT] DualShock 4 Correct Keymaps & Controller Bug Fix - .KL File

Search This thread

jessesam

Senior Member
Jul 31, 2006
331
11
Any new updates on this mapping app ??...Is it possible to install this without rooting my fire tv ??
 

kristoffoneshoe

New member
Nov 30, 2014
2
0
Possible Thoughts on Pairing Issue

I, too, have issues with pairing my PS4 controller to my Fire TV. What I've noticed, however, is that I can pair my friend's controller without any issue. I purchased my controllers at launch when I bought my PS4, and he bought his several months later.

Looking at the two controllers, I noticed a slight difference in what information is printed on the backside:

Launch Controller - Model: CUH-ZCT1U Version: 4-473-498-01 G
Newer Controller - Model: CUH-ZCT1U Version: 4-473-498-02 G

The newer controller also has a notation for ANATEL No. 2507-13-6223 whereas the launch controller does not have this notation on it. I would be interested in seeing if the version numbering matches with the findings of others who are successfully using PS4 controllers.
 

geopgin

Member
Mar 2, 2015
11
0
Hey Guys,

I'm using keytest and trying to map the right joystick of my ds4. It however doesn't seem to register when i hit the directions, is this expected?
 

h00ligan

Senior Member
Jul 12, 2006
91
2
Great job on this

I'm having two issues extreme lag I don't get with my vita and there's no way to go back to the psi home screen? If I press the PA button it goes to the android launcher

Thoughts appreciated and keep up the great work

Galaxy tab pro 8.4 sixaxis compatible
 

BigB42078

Senior Member
May 6, 2010
63
2
How do I return this to stock? It keeps my nyko controllers from working correctly. They work fine on my firetv sticks.
 
Last edited:

deanr1977

Senior Member
Apr 17, 2011
1,000
316
lost somewhere.... Help
Hey Guys,

I noticed the Amazon Fire TV was actually misreading the Dual Shock 4 Controller as The Amazon Fire Controller, which caused some mismapped keys and weird analog jumps and jitters and came up with a .KL file that fixes all that.

You need to be rooted for this to work.

Copy my file to you system/usr/keylayout folder and disconnect your controller, then reconnect. Your buttons will be set.

I mapped the buttons like a Dual Shock 3 but kept the axis items for GAS & Break the same. The Touchpad is mapped as Menu, With Back and Home being Removed for full control in Emulators. Heres all the info if you wanna make your own modded version. Just edit the .kl file i included and you should be fine.

Dual Shock 4 Scancodes
sq=304
tri=307
cir=306
x=305
l1=308
r1=309
l2=310
r2=311
option=313
share=312
touch=317
l3=BACK=314
r3=MENU=315
psbutton=HOME=172



DATA from my .KL file for the DS4

# Buttons
key 164 MEDIA_PLAY_PAUSE
key 168 MEDIA_REWIND
key 172 HOME
key 208 MEDIA_FAST_FORWARD
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 BUTTON_SELECT
key 313 BUTTON_START
key 314 BUTTON_THUMBL
key 315 BUTTON_THUMBR
key 317 MENU

# Joystick and game controller axes.
axis 0x00 X flat 0
axis 0x01 Y flat 0
axis 0x02 Z flat 0
axis 0x05 RZ flat 0
axis 0x09 GAS
axis 0x0a BRAKE
axis 0x10 HAT_X
axis 0x11 HAT_Y


NOTE: You need to rename my file from .txt to .kl for it to work!!!

Take it this is for the AFTV gen 1? I was looking for AFTV 2 compatibility
 

JaqFb

Member
May 1, 2016
5
4
Layout 2016

I also made key bindings file for DS4.

You can find Key Layout File in this post: http://xdaforums.com/showpost.php?p=66644357&postcount=11

Interesting is that I haven't found key 172 on the controller. Instead I found that PS button has 317 keycode
The key 164 MEDIA_PLAY_PAUSE and key 168 MEDIA_REWIND are not present on the controller, eater axis 0x09 and axis 0x0a.

Binding non-existing buttons causes Big input lag.

Also analog L2 and R2 triggers axis were missing in lilcza1 post.

*I also attach .kl file here
 

Attachments

  • PS4Gamepad4Android.KeyLayoutConfig.zip
    1.1 KB · Views: 297
Last edited:
  • Like
Reactions: ACiDxCHRiST

Savvas_SV5

New member
Jan 5, 2017
1
0
I have a problem. When I connect my dualshock 4 with remote play the buttons aren't correct. How can I change them to be the correct ones? (I don't have Fire TV and I don't know what it is)
 

JaqFb

Member
May 1, 2016
5
4
I have a problem. When I connect my dualshock 4 with remote play the buttons aren't correct. How can I change them to be the correct ones? (I don't have Fire TV and I don't know what it is)

If you copied Key Layout File to your smartphone from post above, then change it's name to something like "backup_Wireless_Controller.kl".
But, if you haven't done anything, just download this file http://www.thingiverse.com/download:3154410 , it's text file with proper DS4 key binds for android.
Copy it to /system/usr/keylayout/ path on your smartphone ( Some good file explorer needed ). After you connect your DS4, everything should be fine.
 

atoneapone

Member
Jun 16, 2016
9
4
I have a new problem. I adb pushed the KL file a couple times & it didn't seem to change/fix the button mapping.

I have an old rooted Fire TV 1 (51.1.6.3os3 root; not os5 root), but unable to get proper button mapping to work with a "Newer 2016 Dual Shock 4(cuh-zct2u)" controller. Only the Square and Cross buttons seem to work, but "square" only acts like the A button on xbox360 controller, while "cross" acts like B button (back button). The Square should have acted like an x button, Cross acted like A button, and Circle like a B Button.etc, so I'm hoping to get buttons fixed like this.

I was wondering if there is an incompatibility with the new DS4 controller in using this KL file button mapping fix guide? Or am I possibly installing it wrong?
Thanks for any help on this.
 
Last edited:

JaqFb

Member
May 1, 2016
5
4
There might be some changes made by Sony about buttons mapping in new controller. I don't have one to check that, but I can guide you to make your own .kl file.
What you need is:
  1. Windows pc ;)
  2. Some more advanced text editor like "Notepad2" or "Notepad++"
  3. The wireless_controller.kl file to work with
  4. Android app called Gamepad Tester by Wisely Loh. Link...
First, to troubleshoot if the .kl file is even working with cuh-zct2u connect it to Windows PC, go to Device Manager then HID compliant devices and double click "Controller compatible with HID". Go to Details tab and select hardware IDs. Check if there is PID&05c4.

If yes you can rename the Wireless_Controller.kl to Vendor_054c_Product_05c4.kl, if not change it accordingly.
Vendor_054c means Sony and Product_05c4 means DualShock4 cuh-zct1e. It's just another way of naming .kl files (more info here)
Now you need to customize .kl file. Connect your gamepad to android device and use Gamepad Tester app to write down what button number corresponds to physical button on device. Now open .kl file with notepad and edit numbers there, remember when saving file to double check if "line breaking symbol" is set to Unix, otherwise it won't work with android.

Congratulations! You just created device-specific .kl file. It can be used with Wireless_Controller.kl file simultaneously, android system will automatically assign Vendor_XXXX_Product_XXXX.kl file to cuh-zct2u model when detected (if it's different than PID&05c4). If cuh-zct2u has same PID, you can try find version ID in device manager and change name to Vendor_XXXX_Product_XXXX_Version_XXXX.kl.

I hope this helps.

---------- Post added at 08:06 PM ---------- Previous post was at 08:04 PM ----------

I adb pushed the KL file a couple times & it didn't seem to change/fix the button mapping.

You must also change file permissions after copying the .kl to same as files around. Otherwise it won't work
 
Last edited:
  • Like
Reactions: MTKnife

atoneapone

Member
Jun 16, 2016
9
4
Thanks for all the help & great guide on finding new controller device id & renaming KL file, JaqFB!
I Have it working now. The New 2016 DS4 controller Device id is
VID 054c, PID 09cc.
All I had to do was rename the original KL file to Vendor_054c_Product_09cc.kl
So all button mapping problems work great on my old rooted OS3 firetv1 with renamed KL file.

(Now the only minor aggravation sometimes occurs after I finish a game; the controller gets laggy and freezes my firetv, so I just wait, power off controller and power it on again after starting another game, everything is good during gameplay. If it becomes laggy again, then repeat power off/on cycle of controller. So I've been living with that.)

Update: I just had to fix L2/R2 mapping with kingerc old post on page 2
axis 0x04 GAS
axis 0x03 BRAKE
I posted this file in attachment for everyone to download.
And this allowed me to play PS4 Remote Play app perfectly on my Firetv 1 (just as good as PC windows Remote Play app). But I couldn't get the KL file to work with rooted Firetv 2 (rbox 5.0.5), so not sure if it is compatible with rootedFTV2 or maybe my supersu is not working right and needs a reinstall of prerooted rom. But Input lag is much greater on FIretv2 so I may just give it up and only use my rooted Firetv 1.
 

Attachments

  • Vendor_054c_Product_09cc.zip
    819 bytes · Views: 471
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 5
    Hey Guys,

    I noticed the Amazon Fire TV was actually misreading the Dual Shock 4 Controller as The Amazon Fire Controller, which caused some mismapped keys and weird analog jumps and jitters and came up with a .KL file that fixes all that.

    You need to be rooted for this to work.

    Copy my file to you system/usr/keylayout folder and disconnect your controller, then reconnect. Your buttons will be set.

    I mapped the buttons like a Dual Shock 3 but kept the axis items for GAS & Break the same. The Touchpad is mapped as Menu, With Back and Home being Removed for full control in Emulators. Heres all the info if you wanna make your own modded version. Just edit the .kl file i included and you should be fine.

    Dual Shock 4 Scancodes
    sq=304
    tri=307
    cir=306
    x=305
    l1=308
    r1=309
    l2=310
    r2=311
    option=313
    share=312
    touch=317
    l3=BACK=314
    r3=MENU=315
    psbutton=HOME=172



    DATA from my .KL file for the DS4

    # Buttons
    key 164 MEDIA_PLAY_PAUSE
    key 168 MEDIA_REWIND
    key 172 HOME
    key 208 MEDIA_FAST_FORWARD
    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 BUTTON_SELECT
    key 313 BUTTON_START
    key 314 BUTTON_THUMBL
    key 315 BUTTON_THUMBR
    key 317 MENU

    # Joystick and game controller axes.
    axis 0x00 X flat 0
    axis 0x01 Y flat 0
    axis 0x02 Z flat 0
    axis 0x05 RZ flat 0
    axis 0x09 GAS
    axis 0x0a BRAKE
    axis 0x10 HAT_X
    axis 0x11 HAT_Y


    NOTE: You need to rename my file from .txt to .kl for it to work!!!
    2
    Hey Guys,

    I noticed the Amazon Fire TV was actually misreading the Dual Shock 4 Controller as The Amazon Fire Controller, which caused some mismapped keys and weird analog jumps and jitters and came up with a .KL file that fixes all that.

    You need to be rooted for this to work.

    Copy my file to you system/usr/keylayout folder and disconnect your controller, then reconnect. Your buttons will be set.

    I mapped the buttons like a Dual Shock 3 but kept the axis items for GAS & Break the same. The Touchpad is mapped as Menu, With Back and Home being Removed for full control in Emulators. Heres all the info if you wanna make your own modded version. Just edit the .kl file i included and you should be fine.

    STUFFF


    NOTE: You need to rename my file from .txt to .kl for it to work!!!

    With this method can i pair multiple Dualshock 4 controllers to the same Amazon Fire TV? Also is there a kl file for PlayStation 3 Dualshock 3 controllers? from my understanding dualshock 3 dont work correctly.
    2
    Thanks for all the help & great guide on finding new controller device id & renaming KL file, JaqFB!
    I Have it working now. The New 2016 DS4 controller Device id is
    VID 054c, PID 09cc.
    All I had to do was rename the original KL file to Vendor_054c_Product_09cc.kl
    So all button mapping problems work great on my old rooted OS3 firetv1 with renamed KL file.

    (Now the only minor aggravation sometimes occurs after I finish a game; the controller gets laggy and freezes my firetv, so I just wait, power off controller and power it on again after starting another game, everything is good during gameplay. If it becomes laggy again, then repeat power off/on cycle of controller. So I've been living with that.)

    Update: I just had to fix L2/R2 mapping with kingerc old post on page 2
    axis 0x04 GAS
    axis 0x03 BRAKE
    I posted this file in attachment for everyone to download.
    And this allowed me to play PS4 Remote Play app perfectly on my Firetv 1 (just as good as PC windows Remote Play app). But I couldn't get the KL file to work with rooted Firetv 2 (rbox 5.0.5), so not sure if it is compatible with rootedFTV2 or maybe my supersu is not working right and needs a reinstall of prerooted rom. But Input lag is much greater on FIretv2 so I may just give it up and only use my rooted Firetv 1.
    1
    ...WHOLE LOT OF AWESOME...

    Great job! I've had a bunch of readers ask about this exact issue. Thanks for figuring it out. I wrote up a more detailed guide for those that need it: here
    1
    Thanks for the configuration! Works like a charm.... Quick question: any way to disconnect the dualshock 4 without rebooting fire TV?