diff options
Diffstat (limited to 'init/ueventd_parser.cpp')
-rw-r--r-- | init/ueventd_parser.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/init/ueventd_parser.cpp b/init/ueventd_parser.cpp index 54b0d16aa..677938e10 100644 --- a/init/ueventd_parser.cpp +++ b/init/ueventd_parser.cpp | |||
@@ -84,6 +84,23 @@ Result<Success> ParseFirmwareDirectoriesLine(std::vector<std::string>&& args, | |||
84 | return Success(); | 84 | return Success(); |
85 | } | 85 | } |
86 | 86 | ||
87 | Result<Success> ParseModaliasHandlingLine(std::vector<std::string>&& args, | ||
88 | bool* enable_modalias_handling) { | ||
89 | if (args.size() != 2) { | ||
90 | return Error() << "modalias_handling lines take exactly one parameter"; | ||
91 | } | ||
92 | |||
93 | if (args[1] == "enabled") { | ||
94 | *enable_modalias_handling = true; | ||
95 | } else if (args[1] == "disabled") { | ||
96 | *enable_modalias_handling = false; | ||
97 | } else { | ||
98 | return Error() << "modalias_handling takes either 'enabled' or 'disabled' as a parameter"; | ||
99 | } | ||
100 | |||
101 | return Success(); | ||
102 | } | ||
103 | |||
87 | class SubsystemParser : public SectionParser { | 104 | class SubsystemParser : public SectionParser { |
88 | public: | 105 | public: |
89 | SubsystemParser(std::vector<Subsystem>* subsystems) : subsystems_(subsystems) {} | 106 | SubsystemParser(std::vector<Subsystem>* subsystems) : subsystems_(subsystems) {} |
@@ -182,6 +199,9 @@ UeventdConfiguration ParseConfig(const std::vector<std::string>& configs) { | |||
182 | parser.AddSingleLineParser("firmware_directories", | 199 | parser.AddSingleLineParser("firmware_directories", |
183 | std::bind(ParseFirmwareDirectoriesLine, _1, | 200 | std::bind(ParseFirmwareDirectoriesLine, _1, |
184 | &ueventd_configuration.firmware_directories)); | 201 | &ueventd_configuration.firmware_directories)); |
202 | parser.AddSingleLineParser("modalias_handling", | ||
203 | std::bind(ParseModaliasHandlingLine, _1, | ||
204 | &ueventd_configuration.enable_modalias_handling)); | ||
185 | 205 | ||
186 | for (const auto& config : configs) { | 206 | for (const auto& config : configs) { |
187 | parser.ParseConfig(config); | 207 | parser.ParseConfig(config); |