summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/android/camera_hal_config.cpp26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/android/camera_hal_config.cpp b/src/android/camera_hal_config.cpp
index 0942263c..b2047e26 100644
--- a/src/android/camera_hal_config.cpp
+++ b/src/android/camera_hal_config.cpp
@@ -67,24 +67,40 @@ int CameraHalConfig::Private::parseConfigFile(File &file,
cameras_ = cameras;
std::unique_ptr<YamlObject> root = YamlParser::parse(file);
- if (!root)
+ if (!root) {
+ LOG(HALConfig, Error) << "Failed to parse " << file.fileName()
+ << ": not a valid yaml file";
return -EINVAL;
+ }
- if (!root->isDictionary())
+ if (!root->isDictionary()) {
+ LOG(HALConfig, Error) << "Failed to parse " << file.fileName()
+ << ": not a dictionary";
return -EINVAL;
+ }
/* Parse property "cameras" */
- if (!root->contains("cameras"))
+ if (!root->contains("cameras")) {
+ LOG(HALConfig, Error) << "Failed to parse " << file.fileName()
+ << ": missing 'cameras' property";
return -EINVAL;
+ }
const YamlObject &yamlObjectCameras = (*root)["cameras"];
- if (!yamlObjectCameras.isDictionary())
+ if (!yamlObjectCameras.isDictionary()) {
+ LOG(HALConfig, Error) << "Failed to parse " << file.fileName()
+ << ": malformed 'cameras' dictionary";
return -EINVAL;
+ }
for (const auto &[cameraId, configData] : yamlObjectCameras.asDict()) {
- if (parseCameraConfigData(cameraId, configData))
+ if (parseCameraConfigData(cameraId, configData)) {
+ LOG(HALConfig, Error) << "Failed to parse " << file.fileName()
+ << ": invalid camera entry: "
+ << cameraId;
return -EINVAL;
+ }
}
return 0;