Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PS4 controller doesn't have proper button mappings. #5

Closed
sigmaxipi opened this issue Dec 4, 2019 · 6 comments
Closed

PS4 controller doesn't have proper button mappings. #5

sigmaxipi opened this issue Dec 4, 2019 · 6 comments

Comments

@sigmaxipi
Copy link
Owner

sigmaxipi commented Dec 4, 2019

The Dualshock controller isn't handled properly by Android + Chrome + Gamepad API. Going to https://html5gamepad.com/ on a Windows browser shows the expected mapping and navigator.getGamepads()[0] returns {id: "Wireless Controller (STANDARD GAMEPAD Vendor: 054c Product: 09cc)".... Going to that page on Android Chrome + a BT or USB Dualshock controller shows {id: "Wireless Controller",... and the mapping is incorrect.

The expected button mapping is X, O, Square, Triangle, L1, R1, L2, R2, Share, Options, Left thumbstick, Right thumbstick, dUp, dDown, dLeft, dRight, PS, Touchpad and this works on Windows.

On Android, the detected mapping is O, null, X, Square, Triangle, null, null, null, L2, R2, Share, Options,, dUp, dDown, dLeft, dRight, PS. And the touchpad maps to a mouse.

@sigmaxipi
Copy link
Owner Author

This is caused by an incorrect mapping for the PS4 controllers. This should be fixed upstream in Chrome, but I'll patch this repo to fix it for now.

@sigmaxipi sigmaxipi reopened this Dec 4, 2019
@sigmaxipi
Copy link
Owner Author

Broken button mapping may still occur on pre-Android 10 devices. This can be tested with https://html5gamepad.com/. Using an older version of the apk may help.

@nondebug
Copy link

Relevant upstream patch, should be in Chrome 81 once it lands:

https://chromium-review.googlesource.com/c/chromium/src/+/1958910

Your patch uses the new mapping for Build.VERSION_CODES.P and newer, do you know of any devices with Android P that need the new mapping?

@sigmaxipi
Copy link
Owner Author

An S9 with starqltesq:9/PPR1.180610.011/G960USQS7CSJ9: and Chrome 78.0.3904.108 has the wrong mapping on html5gamepad.com. But it works with my Chromium apk. I think I used >=P because of articles like https://www.xda-developers.com/android-pie-support-playstation-4-dualshock-4/ which stated DualShock support was added to P. but I didn't investigate in depth.

@nondebug
Copy link

I tried with a Pixel 3 on PD1A.180720.031 (the oldest build I could flash) and it also needed the new mapping. Tested with:

DS4 v2 USB & Bluetooth (CUH-ZCT2U)
SIXAXIS USB (CECHZC1U)
DS3 USB (CECHZC2U)

I also tried a DS4 v1 (CUH-ZCT1E) but it only worked over Bluetooth. Over USB there's an issue with hid-sony that breaks with this particular DS4 version. The label on the back has "4-472-348-02 G", I've only seen this issue with devices that have that particular revision code but maybe there are others.

It seems Android 9 includes some of the hid-sony patches that fix the DS3 and DS4 mappings, while Android 10 pulls in all upstream patches to date. I'll change my patch to use >=P.

@Behniha
Copy link

Behniha commented Feb 5, 2021

This is caused by an incorrect mapping for the PS4 controllers. This should be fixed upstream in Chrome, but I'll patch this repo to fix it for now.

PS4 controller doesn't have proper button mappings!!!
I have the same issue, my phone is honor 8c, please help me out!
I'm so new in github :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants