summaryrefslogtreecommitdiff
path: root/include/input/KeyLayoutMap.h
diff options
context:
space:
mode:
author Siarhei Vishniakou <svv@google.com> 2022-05-18 09:42:52 -0700
committer Siarhei Vishniakou <svv@google.com> 2022-06-15 18:59:19 +0000
commitec70ee2c604b82f9261513dbd3110ecdc9bc1f13 (patch)
treef3358f369ed95766f7bb5208c996d01fe361844a /include/input/KeyLayoutMap.h
parent984f40b9cdd9e19554eb662378bf74a77c4651ff (diff)
Do not load keylayout if required kernel module is missing
Some key layouts require the presence of a specific kernel module. If the kernel module is not present, the layout should not be loaded. In this CL, we add an option to specify which kernel modules / configs are needed inside the kl file. Bug: 228005926 Test: atest libinput_tests Change-Id: I0d2ab6298bd41df6dc56120bf0385e10da6c3bfe Merged-In: I0d2ab6298bd41df6dc56120bf0385e10da6c3bfe
Diffstat (limited to 'include/input/KeyLayoutMap.h')
-rw-r--r--include/input/KeyLayoutMap.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/include/input/KeyLayoutMap.h b/include/input/KeyLayoutMap.h
index 006c0684e3..1da78aa0c1 100644
--- a/include/input/KeyLayoutMap.h
+++ b/include/input/KeyLayoutMap.h
@@ -21,6 +21,7 @@
#include <stdint.h>
#include <utils/Errors.h>
#include <utils/Tokenizer.h>
+#include <set>
#include <input/InputDevice.h>
@@ -63,7 +64,8 @@ struct AxisInfo {
*/
class KeyLayoutMap {
public:
- static base::Result<std::shared_ptr<KeyLayoutMap>> load(const std::string& filename);
+ static base::Result<std::shared_ptr<KeyLayoutMap>> load(const std::string& filename,
+ const char* contents = nullptr);
static base::Result<std::shared_ptr<KeyLayoutMap>> loadContents(const std::string& filename,
const char* contents);
@@ -103,6 +105,7 @@ private:
std::unordered_map<int32_t, Led> mLedsByScanCode;
std::unordered_map<int32_t, Led> mLedsByUsageCode;
std::unordered_map<int32_t, Sensor> mSensorsByAbsCode;
+ std::set<std::string> mRequiredKernelConfigs;
std::string mLoadFileName;
KeyLayoutMap();
@@ -123,6 +126,7 @@ private:
status_t parseAxis();
status_t parseLed();
status_t parseSensor();
+ status_t parseRequiredKernelConfig();
};
};