Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 86796853 authored by Siarhei Vishniakou's avatar Siarhei Vishniakou
Browse files

Remap PS key to BUTTON_MODE on DS4 joystick

Currently, the PS key on the DS4 joystick maps to HOME, which means that
this key will not be delivered to apps. However, such apps as Remote
Play require access to this key for proper operation.

Map it to BUTTON_MODE here to allow the apps to handle it. Also, map the
touchpad click to BUTTON_1, which is a generic gamepad button.

The mapping to HOME is not specified in Android. By the Linux
spec, it is more correct to generate BUTTON_MODE for this button (even
though it is drawn slighly above the two sticks in the spec, and it is
physically located more in-line or slightly below these).
The historical reason for this mapping was the fact that
the touchpad generated a click, which meant that touchpad click was more
aligned with the Linux spec. In addition, on some other controllers,
this button actually has a "house" drawn on it, which
would make it consistent with "HOME", and it is currently mapped to
HOME. On this (and several others) joystick, however, there is no such
drawing, and BUTTON_MODE is appropriate.

In Q, this will be addressed by changing the branded buttons on other
controllers to also generate "BUTTON_MODE", and then changing the
Generic fallback mapping for BUTTON_MODE to HOME.

Bug: 79881694
Test: connected DS4 joystick. Made a test app that overrides
dispatchKeyEvent and dumps out every event to the logcat. Then pressed
every button to ensure that the keys are generated as expected. In the
long run, this will be tested in the CTS test
input.cts.tests.AsusGamepadTestCase.
Change-Id: I33e922a2c52582f44d65f20024d7dca1f9d05a5e
parent 3ffdfbfb
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -62,6 +62,10 @@ key 0x138 BUTTON_SELECT
key 0x139    BUTTON_START

# PS key
key 0x13c    HOME
key 0x13c    BUTTON_MODE

# Touchpad press
key 0x13d   BUTTON_MODE
# The touchpad for this joystick will become a separate input device in future releases
# and this button will be equivalent to left mouse button
# Therefore, map it to KEYCODE_BUTTON_1 here to allow apps to still handle this on earlier versions
key 0x13d   BUTTON_1
+6 −2
Original line number Diff line number Diff line
@@ -62,6 +62,10 @@ key 0x138 BUTTON_SELECT
key 0x139    BUTTON_START

# PS key
key 0x13c    HOME
key 0x13c    BUTTON_MODE

# Touchpad press
key 0x13d   BUTTON_MODE
# The touchpad for this joystick will become a separate input device in future releases
# and this button will be equivalent to left mouse button
# Therefore, map it to KEYCODE_BUTTON_1 here to allow apps to still handle this on earlier versions
key 0x13d   BUTTON_1