Commit Graph

125 Commits

Author SHA1 Message Date
Siarhei Vishniakou
a3492cae1e Fix layout for Razer Serval
Ensure all of the keys are mapped.

Test: atest RazerServalTest
Bug: 136263708
Change-Id: I550d5e4e46cbc8549f0bcf075ad5ac39870c3487
2019-11-04 23:29:15 -06:00
Elias Wald
c91d78a680 Merge "Add keylayout for original xbox controller" into qt-dev am: aaaee164de am: 0a7a87b548 am: ec53916597
am: 18e089ebac

Change-Id: I4f3522a393397da4093620a685d8424b15579c81
2019-09-11 22:58:11 -07:00
Siarhei Vishniakou
0c1c820d9d Add keylayout for original xbox controller
We are still missing a key layout for the original xbox controller with
product id 02dd. Add the missing layout here.

Bug: 140808513
Test: manual test by plugging in the actual joystick and using the
custom tester app

Change-Id: Ib84e3ac04ff58f890ce7743423cc9b869af347db
2019-09-11 22:07:41 +01:00
Jared Henderson
b08c0be8a0 Update Xbox BT controller mapping for new FW
The Xbox controller (product id 0x02fd) is going to have a new firmware
update this fall that sends a different keycode (316/BUTTON_MODE) for
the Xbox button.  The goal is to enable the Xbox button to make it to
apps on all Android versions -- with our without a controller-specific
key mapping file.

Unfortunately, the new Vendor_045e_Product_02fd.kl key mapping file
that was added to Android Q maps the pre-firmware-update
Xbox key code (172) to BUTTON_MODE, yet it makes no mention of key 316.
This results in apps getting a raw 316 scan code instead of
a BUTTON_MODE KeyEvent when using a controller with the latest firmware
on Android Q.

The fix is to add an additional key mapping for 316 that *also* maps to
BUTTON_MODE.  With both mappings in place, both pre and post
firmware-updated controllers will get the correct behavior for the
Xbox button on Android Q.

Test: AFAIK, no CTS tests exist for Xbox controller key mappings;
we'll need to add some at a later date.  I was unable to test this
change because I'm unable to write to the system directory on any
of my devices, but I know that mapping 316 to BUTTON_MODE will
fix the issue.

Signed-off-by: Jared Henderson <jaredh.microsoft@gmail.com>

Bug: 139512030
Bug: 140808513

Merged-In: I8600ea79a0aa8557267d6ca712e5d56680e7a98b
Change-Id: I8600ea79a0aa8557267d6ca712e5d56680e7a98b
2019-09-11 15:13:07 +01:00
Jared Henderson
a1ef1ea27f Merge "Update Xbox BT controller mapping to support upcoming controller firmware update" am: 87700db4ef am: 7f1e92a654 am: b2cfc86e8b am: 37f8b552d3
am: 71b94722cb

Change-Id: If3d23854ba967939d61d095c0358b678ddcb68ac
2019-08-26 12:05:53 -07:00
Jared Henderson
7f1e92a654 Merge "Update Xbox BT controller mapping to support upcoming controller firmware update"
am: 87700db4ef

Change-Id: Ia43fd4b1458c8979da8d803083696e8dff26ae73
2019-08-23 03:15:53 -07:00
Jared Henderson
f829b5df5e Update Xbox BT controller mapping to support upcoming controller firmware update
The Xbox controller (product id 0x2fd) is going to have a new firmware update this fall that sends a different keycode (316/BUTTON_MODE) for the Xbox button.  The goal is to enable the Xbox button to make it to apps on all Android versions -- with our without a controller-specific key mapping file.

Unfortunately, the new Vendor_045e_Product_02fd.kl key mapping file that was added to Android Q maps the pre-firmware-update Xbox key code (172) to BUTTON_MODE, yet it makes no mention of key 316.  This results in apps getting a raw 316 scan code instead of a BUTTON_MODE KeyEvent when using a controller with the latest firmware on Android Q.

The fix is to add an additional key mapping for 316 that *also* maps to BUTTON_MODE.  With both mappings in place, both pre and post firmware-updated controllers will get the correct behavior for the Xbox button on Android Q.

Test: AFAIK, no CTS tests exist for Xbox controller key mappings; we'll need to add some at a later date.  I was unable to test this change because I'm unable to write to the system directory on any of my devices, but I know that mapping 316 to BUTTON_MODE will fix the issue.

Change-Id: I8600ea79a0aa8557267d6ca712e5d56680e7a98b
Signed-off-by: Jared Henderson <jaredh.microsoft@gmail.com>

Bug: 139372370
2019-08-22 21:18:57 +00:00
Siarhei Vishniakou
4fef274c01 Add keylayout for Xbox One USB controller
We are currently missing the key layout for the Xbox One USB controller
with the following meta information:
vendor 045e, product 02ea

This layout was copied from product 02d1.

Also fix the mappings of the middle buttons to generate "select - mode -
start", similar to what has already been done for the other xbox
controllers in ag/4836521 and ag/3162575

Bug: 132451971
Bug: 133514907
Bug: 139512030
Test: tested using custom app. CTS tests will be added later.

Change-Id: Ie18bce987b512211d3e91bd1f7334afe11d83cf8
Merged-In: Ie18bce987b512211d3e91bd1f7334afe11d83cf8
2019-08-19 13:21:15 -05:00
Siarhei Vishniakou
9d81ccc929 Keylayout for xbox controllers
Add layout for Xbox elite controller

Test: tested with a custom app
Bug: 132451971
Bug: 139512030
Change-Id: I1c600bc2c41db9d79d7a4e184ef41abe2b5f860e
Merged-In: I1c600bc2c41db9d79d7a4e184ef41abe2b5f860e
2019-08-19 13:18:05 -05:00
Siarhei Vishniakou
98498749fd Merge "Keylayout for xbox pdp controller" into qt-dev am: 927d44d9eb am: 9dec042f6a
am: f8020cc19b

Change-Id: I4104420c5ddd4943ed89f23a6f44822a58e7e997
2019-06-25 02:13:21 -07:00
Siarhei Vishniakou
75cf61f687 Keylayout for xbox pdp controller
Add layout for Xbox pdp controller

Test: tested with a custom app
Bug: 132451971
Change-Id: I35e0998e2643eae031141186637e5eb349334bcd
2019-06-24 14:41:51 -07:00
Siarhei Vishniakou
f178783e33 Merge "Keylayout for xbox controllers" into qt-dev am: 287b20ae0e am: f6e540e970
am: cb43b6a351

Change-Id: Ifb116b223e6ffd5b9224fc4bdb5593fe215bdaae
2019-06-24 13:19:00 -07:00
Siarhei Vishniakou
57a20b70c8 Keylayout for xbox controllers
Add layout for Xbox elite controller

Test: tested with a custom app
Bug: 132451971
Change-Id: I1c600bc2c41db9d79d7a4e184ef41abe2b5f860e
2019-06-24 11:30:01 -07:00
Siarhei Vishniakou
4055c79b56 Add mapping for KEYCODE_ASSIST
Linux has defined KEY_ASSISTANT, but it is not currently mapped in
Android by default. Add the missing mapping here.

Bug: None
Test: None
Change-Id: I85dfecf599ebb69dd2b9ac602b1fc425e13f93c4
2019-06-19 15:31:04 -07:00
TreeHugger Robot
6eca92dd43 Merge "Add key layout for Nintendo Switch controller" into qt-dev 2019-06-15 00:00:06 +00:00
Siarhei Vishniakou
94db68e031 Add key layout for Nintendo Switch controller
The controller for Nintendo Switch is currently missing a key layout,
and the resulting codes are incorrect. Provide the appropriate map here.

Also, update some button mappings for the Xbox 360 controller.

Bug: 135136477
Test: Tested using "gamepad tester". CTS test will be added in a future
release. Tested using custom app.

Change-Id: I1ffcabdcc11aa83316c483ea49cb10fc85f6264f
2019-06-14 11:45:21 -07:00
Siarhei Vishniakou
07749b72c6 Add keylayout for Xbox One USB controller
We are currently missing the key layout for the Xbox One USB controller
with the following meta information:
vendor 045e, product 02ea

This layout was copied from product 02d1.

Also fix the mappings of the middle buttons to generate "select - mode -
start", similar to what has already been done for the other xbox
controllers in ag/4836521 and ag/3162575

Bug: 132451971
Bug: 133514907

Test: tested using 'gamepadtester'. CTS tests will be added later.

Change-Id: Ie18bce987b512211d3e91bd1f7334afe11d83cf8
2019-06-11 11:12:21 -07:00
Kim Low
819e7528ee Merge "Added mapping files for DualShock3 and DualShock4" am: 85aadab7e4 am: d050a2edd6
am: 1f6af2e769

Change-Id: I239e8e9aff10e7472fb841261df7e23466202dd2
2018-09-19 18:05:08 -07:00
Kim Low
0a5109d955 Added mapping files for DualShock3 and DualShock4
All buttons and axes on DualShock3 and DualShock4 are mapped
explicitly, because some Linux drivers do not map them correctly.
Also, the definition of BUTTON_X/Y in Linux and Android is flipped.

The most significant bit (i.e. 0x8000 and 0x8111) in the "Version"
part of the filename indicates a newer Linux hid-sony driver (>=4.10
for DualShock4 and >=4.12 for DualShock3) which complies to the
mapping in Linux gamepad specifications, and supports all DualShock4
features (i.e. motions sensors, touchpad).

Older Linux driver which does not have the correct mapping will use
the mapping files without "Version".

All files with "Version_8000" and "Version_8100" are meant for
Bluetooth connected DualShock3/DualShock4, and all files with
"Version_8111" are meant for USB connected DualShock3/DualShock4.

Test: Connect DualShock3 and DualShock4, over USB and over Bluetooth.
Test: Check that the Dpad and left analog stick can be used to
      navigate the UI.
Test: If newer Linux driver is loaded, check that the touchpad can
      be used to navigate the UI.
Bug: 38511270
Change-Id: I5630c495af16185689bbff25943b3e2d3c93e709
2018-09-13 10:28:17 -07:00
Siarhei Vishniakou
7b0b609beb Add comments to Asus Gamepad button mappings
Currently, the circle button on odie (Asus Gamepad) is mapped to HOME.
But it is not clear which button is which just from looking at the key
layout file.
Add some annotations here.

Bug: 111431828
Bug: 110270125
Test: atest AsusGamepadTestCase (the test is currently in development)
Change-Id: I8d1317be7f403ceaf0c2d72d756623e3cd032559
2018-08-29 10:46:23 -07:00
Siarhei Vishniakou
0b607447b6 Fallback BUTTON_MODE to HOME
Currently, BUTTON_MODE falls back to MENU.
It is not clear which functionality relies on that. However, many
joysticks currently map their "branded" button, for example, the "XBOX"
key on the Xbox joystick, and "PS" key on the playstation joystick, to
the BUTTON_MODE. On other joysticks, the same button is mapped to
"HOME". So it would make sense to have this button to fall back to HOME
in order to make the behaviour consistent.

Also, remap the "XBOX" button on the Xbox controller to "BUTTON_MODE".
This would give apps the chance to intercept this key and actually use
it, instead of limiting it to the system.

Bug: 37115804
Bug: 77803694
Test: Made a test app to dump out joystick events in response to
dispatchKeyEvent. Then either returned true or false to ensure that the
fallback happens. If returning true, the app has handled the event, and
HOME is not dispatched. If returning false, the app does not care about
the event. Therefore, HOME is generated and the phone goes to home
screen (so the app gets closed).

Change-Id: I023620551f52d34638303db60f8a4ca37f06d4d8
Merged-In: I023620551f52d34638303db60f8a4ca37f06d4d8
2018-08-27 15:53:33 -07:00
Siarhei Vishniakou
bfb5b8b03e Remap PS key to BUTTON_MODE
In an earlier commit, ag/4071802, (Change-Id:
I33e922a2c52582f44d65f20024d7dca1f9d05a5e), this particular file was
overlooked.
Quick fix here to make everything consistent. We will add the other
variants of these devices in the future.

Test: partial cherry-pick from Sony CL on aosp
Bug: 79881694
Change-Id: I8ab46fde8650724464b1e799cd948682c56e5b52
Merged-In: I8ab46fde8650724464b1e799cd948682c56e5b52
2018-08-27 15:51:48 -07:00
Siarhei Vishniakou
da16f224b7 Fallback BUTTON_MODE to HOME
Currently, BUTTON_MODE falls back to MENU.
It is not clear which functionality relies on that. However, many
joysticks currently map their "branded" button, for example, the "XBOX"
key on the Xbox joystick, and "PS" key on the playstation joystick, to
the BUTTON_MODE. On other joysticks, the same button is mapped to
"HOME". So it would make sense to have this button to fall back to HOME
in order to make the behaviour consistent.

Also, remap the "XBOX" button on the Xbox controller to "BUTTON_MODE".
This would give apps the chance to intercept this key and actually use
it, instead of limiting it to the system.

Bug: 37115804
Bug: 77803694
Test: Made a test app to dump out joystick events in response to
dispatchKeyEvent. Then either returned true or false to ensure that the
fallback happens. If returning true, the app has handled the event, and
HOME is not dispatched. If returning false, the app does not care about
the event. Therefore, HOME is generated and the phone goes to home
screen (so the app gets closed).

Change-Id: I023620551f52d34638303db60f8a4ca37f06d4d8
2018-08-21 18:30:16 -07:00
Siarhei Vishniakou
bf2f882a9c Remap PS key to BUTTON_MODE
In an earlier commit, ag/4071802, (Change-Id:
I33e922a2c52582f44d65f20024d7dca1f9d05a5e), this particular file was
overlooked.
Quick fix here to make everything consistent. We will add the other
variants of these devices in the future.

Test: partial cherry-pick from Sony CL on aosp
Bug: 79881694
Change-Id: I8ab46fde8650724464b1e799cd948682c56e5b52
2018-07-17 16:37:29 +01:00
Siarhei Vishniakou
867968530e 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
2018-05-17 09:39:04 -07:00
Siarhei Vishniakou
ae911cb8ae Suppress key validation logs
If the validation of keylayouts / keycharmaps / keyconfigs succeeds, do
not log anything to reduce logspam. The "-q" argument was misplaced in
the original CL.

Bug: 35672363
Test: touch frameworks/base/data/keyboards/Vendor_045e_Product_028e.kl && m
Also, change the behaviour in tools/validatekeymaps/Main.cpp to always
ignore "-q", see that the logs come back.

Change-Id: I3cd2ef161942905c2d8ffce8fc93dd345868066d
2018-03-26 16:59:47 -07:00
Emilie Roberts
1ab70f3b37 Merge "Remove ESC key fallback mapping" 2018-02-07 22:03:38 +00:00
Emilie Roberts
3abea7fe3f Add Ctrl-Alt-Backspace to Back mapping
Android devices with a physical keyboard connected may not have a
way to execute the "Back Behaviour" without using a touchscreen
or pointer. This adds a ctrl-alt-backspace mapping to the
back behaviour, similar to TalkBalk.

Use cases include Pixel C, accessibility situations where
touchscreens are not convenient or feasible, or other phones/tablets
with a hardware keyboard attached and keyboard only interaction is
desired.

Previous to http://ag/3540362, ESC provided this functionality.

Bug: 71907807
Test: Manual testing on Marlin
Change-Id: I5015a17add26824a40e5eac1bced8e9ca7b98efa
2018-01-31 18:53:58 +00:00
Emilie Roberts
16d42def25 Remove ESC key fallback mapping
The escape key has a fallback "back" behaviour. On ChromeOS
or tablets with bluetooth/attached keyboards, pressing the ESC
key can unexpectedly close applications. This removes the
fallback mapping so that ESC does nothing.

Bug: 71907807
Test: Manual testing on Marlin
Change-Id: I747f0bd743ec117e6ae47fae527600a3ab5690ba
2018-01-31 16:46:46 +00:00
Yuichiro Hanada
c1415f3e3c Add new refresh key constant.
Bug: 64149858
Bug: 64662317
Test: Builds and manual tests with Chromebook.

Change-Id: I865d657ee7d78b5e45f642e786d26a65a14f49e1
2018-01-24 09:11:49 +09:00
Michael Wright
4cb42f3894 There is only one Generic.kl.
Generic.kl is a special file that defines the default mappings for all
devices. There can only be one and it cannot change regardless of the
product area the device is in. This should *never* have been checked in,
especially not without someone on the input team looking at it.

Also, add support for the POUND and STAR keys, which is why it was
forked in the first place.

Test: N/A
Change-Id: I894cbefe20fc77d827dc500daa3a380f252eb8b6
2017-12-05 18:45:41 +00:00
Michael Wright
9fc31ee1f8 Add OWNERS to system_server services.
Test: N/A
Change-Id: I60174fcbbf2a061df2961239ec1b45df2e6b20ed
2017-11-21 18:35:16 +00:00
Siarhei Vishniakou
46429ecd93 Add keylayout for xbox controller over bt
When connected over bluetooth, the device
registers with vendorId=045e, productId=02e0.
Add the keylayout for this here.

Bug: 37115804
Bug: 37115820
Test: connect the controller, use
'getevent' to keep track of the generated events

Change-Id: Ia4b80e54a547e5d6716ff0f83b068e4cc87dfbb0
2017-11-02 19:45:31 -07:00
Siarhei Vishniakou
c8f4acb6ba Add keylayout file for Sony DS4 v1 joystick
This file is a copy of Vendor_054c_Product_09cc.kl,
which is a v2 version of the same joystick.
They have the same layout.

Bug: 36693940
Test: mapped with getevent, works OK
Change-Id: I439caf97f2c51d643753e1fc8d5dd0213131927a
2017-09-12 15:19:26 -07:00
Siarhei Vishniakou
4dc796f180 Merge "Add keylayout file for Sony DS4 joystick." 2017-09-11 18:18:33 +00:00
Michael Wright
7185881062 Quiet keymap validation.
Adds a quiet option to validatekeyamps and uses it for the platform
build.

Bug: 35672363
Test: m -j12; see no messages about succesful keymap validation
Change-Id: I902a9f5813ae612ee48ee3df210ae8fa2988c4b3
2017-09-04 15:18:44 +01:00
Nick Felker
be1d81195a Adds POUND and STAR keys to Generic_Iot.kl
A following change will update the InputDriver-JNI
to take advantage of the new keys.

Bug: 64083153
Test: Building source and testing with InputDriver
Change-Id: I94c9d59ecf7f7278f2ec61c68c4eb80aa65f142c
2017-08-02 16:49:26 +00:00
Siarhei Vishniakou
ccdc8c1c8a Add keylayout file for Sony DS4 joystick.
Bug: 36693940
Test: mapped with getevent, works OK
Change-Id: I3c397914bbd874221d87bd77cbc1c9fe5f27336f
2017-06-27 18:39:10 -07:00
Nimrod Gileadi
9576ce6696 Add Wear keycodes to emulator key layout file.
am: 119a06ce55

Change-Id: I33d2b0f9b8281c22422677f03d6046a1be0bd94f
2017-02-01 17:57:16 +00:00
Nimrod Gileadi
119a06ce55 Add Wear keycodes to emulator key layout file.
The SLEEP keycode is used by Android Wear to indicate a
"palming" gesture (covering the screen with one's hand).

The STEM_* buttons are used for side buttons on Wear.

The keycode values were added to the emulator in
http://r.android.com/330771

Bug: 19996432
Change-Id: Ib90c3b27209b0059ebc1c2cce46cc732a677d557
2017-02-01 12:13:12 +00:00
Jim Kaye
d3a460233f Support keyboard entry of non-ASCII characters
am: b57679e2e7

* commit 'b57679e2e7fb6f133f6fe373d8036b74866476d8':
  Support keyboard entry of non-ASCII characters
2016-03-02 19:06:34 +00:00
Jim Kaye
b57679e2e7 Support keyboard entry of non-ASCII characters
Add characters to the keyboard mapping to allow them
to be entered into the AVD from the developer's PC
keyboard.

This mapping supports the non-ASCII keys that appear
on the "US International" keyboard. Most of the Latin-1
characters (but not all) appear on this keyboard.

This change does not remove support for any keys.

b.android.com/200042

Change-Id: I65d54eb36183382b171c388b26848941eb0ff8d9
(cherry picked from commit dac57966a9)
2016-03-02 18:56:10 +00:00
Michael Wright
584e8d11a8 Merge "Add keylayout for Xbox One controller" am: 7416762be0
am: 605d619b1e

* commit '605d619b1eeef901661c9536b7921ac47960d110':
  Add keylayout for Xbox One controller
2016-02-17 22:55:10 +00:00
Tim Clark
66a25396b0 Add keylayout for Xbox One controller
Change-Id: Ifb4005ed7b6345c9af126d8f1bd22c7e2921871f
2016-02-17 17:26:06 +00:00
Jim Kaye
e579edc76b Merge "Extend the \'qwerty\' key layout"
am: 9a83f115ad

* commit '9a83f115ade900a816f0fa2beae2cdd6f54bfc54':
  Extend the 'qwerty' key layout
2015-11-24 19:33:57 +00:00
Jim Kaye
b45d99d7d9 Extend the 'qwerty' key layout
Add the App Switch (Recents) key.
Add media control keys.

These are needed to support Emulator UI
buttons for these functions.

Change-Id: I3e9479bb49e21400f7bfd1435c50886038bbe0ff
2015-11-23 12:22:59 -08:00
Jim Kaye
5b77f70d8b Extend the 'qwerty' key layout
Add the App Switch (Recents) key.
Add media control keys.

These are needed to support Emulator UI
buttons for these functions.

Change-Id: I5d5d25a77625bfd831cf7b31c126fd342efc6c5b
2015-11-20 09:59:25 -08:00
Michael Wright
f6d7c67962 Add kernel keycode mapping for new cut / copy / paste keys
Bug: 25120948
Change-Id: I33a93fa6c067d15a9739ca33703e0e48e8cf6eff
2015-10-22 15:54:02 +01:00
Michael Wright
04fc7b7510 Fix broken KL file.
Buttons should be L1 and R1 instead of L and R.

Change-Id: I1e345f7e28ad6b47248656a7f79d5507c62aa007
2015-10-13 14:13:33 +01:00
Michael Wright
c51179e9ab Update NES controller key layout
Turns out they produce an SNES controller with the same VID/PID as
their NES controller. Just remap both at once.

Change-Id: Iba94fdd69fd846f99ca1b3205de9069989635c73
2015-10-13 12:34:05 +00:00