summaryrefslogtreecommitdiff
path: root/tools/validatekeymaps/Main.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Require CONFIG_HID_PLAYSTATION for DualSense key layoutSiarhei Vishniakou2022-08-231-0/+5
| | | | | | | | | | | | | | | | | | | | | | | Some olders kernels don't yet support HID_PLAYSTATION. While they are working on supporting this driver, provide this temporary solution. Before this patch, if the key layout is loaded, but there is no HID_PLAYSTATION, then the mappings on the device will be incorrect. With this patch, this key layout will not be loaded unless there is a CONFIG_HID_PLAYSTATION enabled on the device. Instead, when the main layout cannot be loaded, we make another attempt to load a fallback layout. This way, the mappings on DualSense can be correct even if the HID_PLAYSTATION module is not loaded. In this CL, the fallback layout was tested using controllerTester. Bug: 228005926 Test: tested mappings with a DualSense controller on a device that does not have CONFIG_HID_PLAYSTATION Change-Id: I7e46ae1943cd2c63b8c0b03fdf5d71adeea89f6f
* Prevent some keylayouts from being added to AndroidSiarhei Vishniakou2021-09-241-0/+44
| | | | | | | | | | | | | | | | | | | | | | | Some of the custom key layouts cause problems. Specifically: 1. Microsoft designed some of its devices to work with Generic.kl, and if we add a custom layout, it could break these devices. We should check with Microsoft prior to adding such layouts. Often, we should just tell the users to update the firmware on their controllers to get it working properly. 2. Some devices use the same vendor id / product id (incorrectly). They should all have unique numbers, but they have chosen to reuse Broadcom's numbers instead. As a result, adding a layout for one of them breaks the others. Matching by name is fine, though. Fail the build to prevent these from being added. Bug: 191720859 Bug: 194334400 Test: added one of these layouts and tried to build Android, observed build failure Change-Id: I26c44dd3d322154cc1eeecbc7cab65b1add130d0
* Add explicit Result::ok() where missingBernie Innocenti2020-12-221-2/+2
| | | | | | | | | | This is part of a large-scale cleanup to remove operator bool() from android::base::expected. For more details, see aosp/1533001. Bug: 176148206 Test: m checkbuild continuous_instrumentation_tests continuous_instrumentation_tests_api_coverage continuous_native_tests device-tests platform_tests Exempt-From-Owner-Approval: mechanical large-scale change Change-Id: Ie8cf279c20c9284ad6476280e80dc25545f833de
* Convert validatekeymaps to enum classMichael Wright2020-11-041-52/+52
| | | | | | Test: compiles Bug: 160010896 Change-Id: I4e582a442a267c2a35bea7a5d4fc7e080d281ecf
* Convert KeyCharacterMap to enum classMichael Wright2020-11-041-2/+2
| | | | | | Test: compiles Bug: 160010896 Change-Id: I178ef13f77279950db38174614f31044aa8096d3
* Update usage of PropertyMap::loadSiarhei Vishniakou2020-09-181-5/+5
| | | | | | | | | Now that PropertyMap returns an owned object, update the usage in validatekeymaps. Bug: 163171599 Test: presubmit Change-Id: I75b9abe3fa1d418951a8c23a624771046a89b3f8
* Merge "Move PropertyMap from libutils to libinput" am: bf37f0d136 am: ↵Treehugger Robot2020-09-081-1/+1
|\ | | | | | | | | | | | | | | 27e25ee89e am: 3b71c8c742 am: 3faf298e70 am: 775215738b Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1419037 Change-Id: I47ffc1d0578763e1b00a2400d04087753d8082ac
| * Merge "Move PropertyMap from libutils to libinput" am: bf37f0d136Treehugger Robot2020-09-081-1/+1
| |\ | | | | | | | | | | | | | | | Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1419037 Change-Id: I79f94c2c458d3314246cbe0980b28acac4d97cb4
| | * Move PropertyMap from libutils to libinputSiarhei Vishniakou2020-09-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Since PropertyMap has moved, update the #include directives. Bug: 163171599 Test: make only Change-Id: Ia12463cf80e4d47e0dcaf81104635b2717d28748
* | | Move KeyCharacterMap from RefBase to shared_ptr.Chris Ye2020-08-301-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move KeyCharacterMap from RefBase and make it shared_ptr in it's owner class like EventHub and InputDeviceInfo. When loaded from file, KeyCharacterMap as shared_ptr is stored in both InputDeviceInfo and EventHub device. Bug: 160010896 Test: atest inputflinger, atest libinput_tests Change-Id: Ib3c489c3e87e04d68e4681994e430e43aa46164b
* | | Move KeyLayoutMap from RefBase to shared_ptr.Chris Ye2020-08-281-4/+3
|/ / | | | | | | | | | | | | | | | | Move KeyLayoutMap from inheriting RefBase and use shared_ptr to store in owner class like KeyMap. Bug: 160010896 Test: atest inputflinger, atest libinput_tests Change-Id: I5caca94bfc4a7e038729479a53f09a89d97a1c23
* / Remove 'no errors' logSiarhei Vishniakou2019-06-211-1/+0
|/ | | | | | | | | This log is redundant because "success" will already be printed at the end if the parsing has succeeded. Bug: none Test: validatekeymaps data/keyboards/Vendor_045e_Product_0b0c.kl Change-Id: I6e25b04d142d137101a6a9cca6e837ad35edb619
* Update VirtualKeyMap usageSiarhei Vishniakou2019-02-201-5/+3
| | | | | | | | | | Since the VirtualKeyMap has been refactored, updated the validation tool to use the new signature. Bug: 113575658 Test: atest libinput_tests inputflinger_tests Change-Id: Ifb0eb5b2913020f1e1402dcb6a36c9038c345807
* Refactor String8 to std::string callsSiarhei Vishniakou2018-07-111-4/+3
| | | | | | | | | | DisplayViewport::uniqueId is now std::string, so change the calls appropriately. Do some additional cleanups and conversions. This almost completely removes the dependency on String8. Test: build only Bug: 111108021 Change-Id: Ibbb6ca59e9061954d4a5fb930ef03d42cb0230db
* Quiet keymap validation.Michael Wright2017-09-041-16/+39
| | | | | | | | | 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
* Revert "Move frameworks/base/tools/ to frameworks/tools/"Adam Lesinski2014-01-271-0/+147
| | | | This reverts commit 9f6a119c8aa276432ece4fe2118bd8a3c9b1067e.
* Move frameworks/base/tools/ to frameworks/tools/Mike Lockwood2013-08-281-147/+0
| | | | Change-Id: I3ffafdab27cc4aca256c3a5806b630795b75d5c8
* Move input library code to frameworks/native.Jeff Brown2013-07-011-3/+3
| | | | | | | | | No longer compile libandroidfw as a static library on the device since it already exists as a shared library. Keeping the static library would force us to provide a static library version of libinput for the device as well which doesn't make sense. Change-Id: I3517881b87b47dcc209d80dbd0ac6b5cf29a766f
* Support loading keyboard layout overlays from resources.Jeff Brown2012-04-171-1/+2
| | | | | | | | | | | | | | | | | | | | | | Added the concept of a keyboard layout overlay, which is a key character map file that has "type OVERLAY". Added support for loading keyboard layout overlays from resources dynamically. The layouts are reloaded whenever they are changed in the Settings application or an application is installed. This is somewhat more aggressive than necessary so we might want to optimize it later. Before system-ready, the input system uses just the generic keyboard layouts that are included on the device system image. After system-ready, it considers the user's selected keyboard layout overlay and attempts to load it as necessary. We need to wait until system-ready before doing this because we need to be in a state where it is safe to start applications or access their resources. Bug: 6110399 Change-Id: Iae0886d3356649b0d2440aa00910a888cedd8323
* Request key maps from input manager service.Jeff Brown2012-04-101-2/+4
| | | | | | | | | | | | | | | | | | Instead of each application loading the KeyCharacterMap from the file system, get them from the input manager service as part of the InputDevice object. Refactored InputManager to be a proper singleton instead of having a bunch of static methods. InputManager now maintains a cache of all InputDevice objects that it has loaded. Currently we never invalidate the cache which can cause InputDevice to return stale motion ranges if the device is reconfigured. This will be fixed in a future change. Added a fake InputDevice with ID -1 to represent the virtual keyboard. Change-Id: If7a695839ad0972317a5aab89e9d1e42ace28eb7
* Fix build break.Jeff Brown2012-02-171-3/+3
| | | | Change-Id: I0bc8ac6e76ff28bd4c3585afbd6b3aa1930bf710
* Add new axes for joysticks and mouse wheels.Jeff Brown2011-02-191-3/+18
| | | | | | | | | | | | | | | | | | Added API on InputDevice to query the set of axes available. Added API on KeyEvent and MotionEvent to convert keycodes and axes to symbolic name strings for diagnostic purposes. Added API on KeyEvent to query if a given key code is a gamepad button. Added a new "axis" element to key layout files to specify the mapping between raw absolute axis values and motion axis ids. Expanded the axis bitfield to 64bits to allow for future growth. Modified the Makefile for keyboard prebuilts to run the keymap validation tool during the build. Added layouts for two game controllers. Added default actions for game pad button keys. Added more tests. Fixed a bunch of bugs. Change-Id: I73f9166c3b3c5bcf4970845b58088ad467525525
* Improve support for external keyboards.Jeff Brown2010-12-021-3/+22
| | | | | | | | | | | | | | | | | | | | | | | | | Use Vendor ID, Product ID and optionally the Version to locate keymaps and configuration files for external devices. Moved virtual key definition parsing to native code so that EventHub can identify touch screens with virtual keys and load the appropriate key layout file. Cleaned up a lot of old code in EventHub. Fixed a regression in ViewRoot's fallback event handling. Fixed a minor bug in FileMap that caused it to try to munmap or close invalid handled when released if the attempt to map the file failed. Added a couple of new String8 conveniences for formatting strings. Modified Tokenizer to fall back to open+read when mmap fails since we can't mmap sysfs files as needed to open the virtual key definition files in /sys/board_properties/. Change-Id: I6ca5e5f9547619fd082ddac47e87ce185da69ee6
* Fix build on Linux due to different strrchr prototype.Jeff Brown2010-11-231-1/+1
| | | | | | | It seems Linux host build has a fancy strrchr overload that preserves constness. That's nice but it broke this. Change-Id: I3c9b57b9ce9abc5d334d1e7b2498a3248bd20a6a
* Port Emulator keymaps.Jeff Brown2010-11-231-0/+110
Also added a validation tool for keymaps (not currently integrated into the build system but getting there). This change brings back Android.mk with the intent that it will be used to validate keymaps in a later change. Added some missing keys that are present on phones. Bug: 3215210 Bug: 3225421 Change-Id: Id817c6e2215164616942c51a42752915d9ceacd3