mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-13 15:29:45 +03:00
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>
This commit is contained in:
parent
3a3f6ae22e
commit
229653a59b
2 changed files with 28 additions and 0 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue