summaryrefslogtreecommitdiff
path: root/tools/validatekeymaps/Main.cpp
diff options
context:
space:
mode:
author Siarhei Vishniakou <svv@google.com> 2022-05-18 13:34:55 -0700
committer Siarhei Vishniakou <svv@google.com> 2022-06-03 14:12:29 -0700
commitdf6630ae1fb3ae9e64454b7ef87df75674665d09 (patch)
tree91239c2e1f96dec1c302ab2070661170977a0c80 /tools/validatekeymaps/Main.cpp
parent08d1f11fb9c18ea8b68990b26da810529940d479 (diff)
Require CONFIG_HID_PLAYSTATION for DualSense key layout
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
Diffstat (limited to 'tools/validatekeymaps/Main.cpp')
-rw-r--r--tools/validatekeymaps/Main.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/validatekeymaps/Main.cpp b/tools/validatekeymaps/Main.cpp
index 817effd24a2d..0d7d5f949a08 100644
--- a/tools/validatekeymaps/Main.cpp
+++ b/tools/validatekeymaps/Main.cpp
@@ -141,6 +141,11 @@ static bool validateFile(const char* filename) {
}
base::Result<std::shared_ptr<KeyLayoutMap>> ret = KeyLayoutMap::load(filename);
if (!ret.ok()) {
+ if (ret.error().message() == "Missing kernel config") {
+ // It means the layout is valid, but won't be loaded on this device because
+ // this layout requires a certain kernel config.
+ return true;
+ }
error("Error %s parsing key layout file.\n\n", ret.error().message().c_str());
return false;
}