diff options
| author | 2022-05-18 09:42:52 -0700 | |
|---|---|---|
| committer | 2022-08-23 15:59:01 +0000 | |
| commit | 0ac62eb4b78df85291e73ab367ebba0e27cb7d76 (patch) | |
| tree | 888aa79e293d3b154d07536b34cdb56be23f9a22 /include | |
| parent | efe6ae66ec1e10390d53ea479fc65057a4f9f201 (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')
| -rw-r--r-- | include/input/InputDevice.h | 6 | ||||
| -rw-r--r-- | include/input/KeyLayoutMap.h | 6 | ||||
| -rw-r--r-- | include/input/Keyboard.h | 4 |
3 files changed, 10 insertions, 6 deletions
diff --git a/include/input/InputDevice.h b/include/input/InputDevice.h index c4f03c9119..3585392c2b 100644 --- a/include/input/InputDevice.h +++ b/include/input/InputDevice.h @@ -300,6 +300,8 @@ enum class InputDeviceConfigurationFileType : int32_t { /* * Gets the path of an input device configuration file, if one is available. * Considers both system provided and user installed configuration files. + * The optional suffix is appended to the end of the file name (before the + * extension). * * The device identifier is used to construct several default configuration file * names to try based on the device name, vendor, product, and version. @@ -307,8 +309,8 @@ enum class InputDeviceConfigurationFileType : int32_t { * Returns an empty string if not found. */ extern std::string getInputDeviceConfigurationFilePathByDeviceIdentifier( - const InputDeviceIdentifier& deviceIdentifier, - InputDeviceConfigurationFileType type); + const InputDeviceIdentifier& deviceIdentifier, InputDeviceConfigurationFileType type, + const char* suffix = ""); /* * Gets the path of an input device configuration file, if one is available. 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(); }; }; diff --git a/include/input/Keyboard.h b/include/input/Keyboard.h index 08ad8c6e5a..9a3e15f1cd 100644 --- a/include/input/Keyboard.h +++ b/include/input/Keyboard.h @@ -61,9 +61,7 @@ private: bool probeKeyMap(const InputDeviceIdentifier& deviceIdentifier, const std::string& name); status_t loadKeyLayout(const InputDeviceIdentifier& deviceIdentifier, const std::string& name); status_t loadKeyCharacterMap(const InputDeviceIdentifier& deviceIdentifier, - const std::string& name); - std::string getPath(const InputDeviceIdentifier& deviceIdentifier, - const std::string& name, InputDeviceConfigurationFileType type); + const std::string& name); }; /** |