From 1345d656a2740079b95ff360e755c07962ce70a8 Mon Sep 17 00:00:00 2001 From: Siarhei Vishniakou Date: Wed, 18 May 2022 13:34:55 -0700 Subject: 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 Merged-In: I7e46ae1943cd2c63b8c0b03fdf5d71adeea89f6f Change-Id: I7e46ae1943cd2c63b8c0b03fdf5d71adeea89f6f --- tools/validatekeymaps/Main.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tools/validatekeymaps/Main.cpp') diff --git a/tools/validatekeymaps/Main.cpp b/tools/validatekeymaps/Main.cpp index 991b28071515..cbfdfe4d89c4 100644 --- a/tools/validatekeymaps/Main.cpp +++ b/tools/validatekeymaps/Main.cpp @@ -97,6 +97,11 @@ static bool validateFile(const char* filename) { case FileType::KEY_LAYOUT: { base::Result> 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; } -- cgit v1.2.3-59-g8ed1b