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-08-23 15:59:01 +0000
commit0ac62eb4b78df85291e73ab367ebba0e27cb7d76 (patch)
tree888aa79e293d3b154d07536b34cdb56be23f9a22 /include/input/KeyLayoutMap.h
parentefe6ae66ec1e10390d53ea479fc65057a4f9f201 (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 Merged-In: I0d2ab6298bd41df6dc56120bf0385e10da6c3bfe Change-Id: 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 d1925f4eee..50849506a4 100644
--- a/include/input/KeyLayoutMap.h
+++ b/include/input/KeyLayoutMap.h
@@ -22,6 +22,7 @@
#include <utils/Errors.h>
#include <utils/KeyedVector.h>
#include <utils/Tokenizer.h>
+#include <set>
#include <input/InputDevice.h>
@@ -64,7 +65,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);
@@ -104,6 +106,7 @@ private:
KeyedVector<int32_t, Led> mLedsByScanCode;
KeyedVector<int32_t, Led> mLedsByUsageCode;
std::unordered_map<int32_t, Sensor> mSensorsByAbsCode;
+ std::set<std::string> mRequiredKernelConfigs;
std::string mLoadFileName;
KeyLayoutMap();
@@ -124,6 +127,7 @@ private:
status_t parseAxis();
status_t parseLed();
status_t parseSensor();
+ status_t parseRequiredKernelConfig();
};
};