summaryrefslogtreecommitdiff
path: root/src/android/camera_device.cpp
diff options
context:
space:
mode:
authorPaul Elder <paul.elder@ideasonboard.com>2021-01-21 17:44:14 +0900
committerPaul Elder <paul.elder@ideasonboard.com>2021-01-27 12:07:05 +0900
commit229653a59ba635b1649590aa119a4354989314a8 (patch)
tree91dd8707acbb3be0b88c4929c11a229e640f7177 /src/android/camera_device.cpp
parent3a3f6ae22e88c592425a4374734cd17df76d7db2 (diff)
android: camera_device: Load make and model from platform settings
In ChromeOS the camera make and model is saved in /var/cache/camera/camera.prop. Load and save these values at construction time, if available. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src/android/camera_device.cpp')
-rw-r--r--src/android/camera_device.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index 1a384460..7929877c 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -9,6 +9,7 @@
#include "camera_ops.h"
#include "post_processor.h"
+#include <fstream>
#include <sys/mman.h>
#include <tuple>
#include <vector>
@@ -351,6 +352,28 @@ CameraDevice::CameraDevice(unsigned int id, const std::shared_ptr<Camera> &camer
* streamConfiguration.
*/
maxJpegBufferSize_ = 13 << 20; /* 13631488 from USB HAL */
+
+ maker_ = "libcamera";
+ model_ = "cameraModel";
+
+ /* \todo Support getting properties on Android */
+ std::ifstream fstream("/var/cache/camera/camera.prop");
+ if (!fstream.is_open())
+ return;
+
+ std::string line;
+ while (std::getline(fstream, line)) {
+ std::string::size_type delimPos = line.find("=");
+ if (delimPos == std::string::npos)
+ continue;
+ std::string key = line.substr(0, delimPos);
+ std::string val = line.substr(delimPos + 1);
+
+ if (!key.compare("ro.product.model"))
+ model_ = val;
+ else if (!key.compare("ro.product.manufacturer"))
+ maker_ = val;
+ }
}
CameraDevice::~CameraDevice()