[{"id":15908,"web_url":"https://patchwork.libcamera.org/comment/15908/","msgid":"<YF0RDWBfcJRN6Yi4@oden.dyn.berto.se>","date":"2021-03-25T22:39:09","subject":"Re: [libcamera-devel] [PATCH 6/7] android: camera_device: Get\n\tproperties from config","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Jacopo,\n\nThanks for your work.\n\nOn 2021-03-24 12:25:26 +0100, Jacopo Mondi wrote:\n> Create the CameraDevice with a reference to the HAL configuration\n> file and use it to retrieve device and camera properties.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/android/camera_device.cpp      | 71 ++++++++++++++++--------------\n>  src/android/camera_device.h        |  8 +++-\n>  src/android/camera_hal_manager.cpp |  3 +-\n>  3 files changed, 47 insertions(+), 35 deletions(-)\n> \n> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\n> index 72a89258386d..403d149e4f68 100644\n> --- a/src/android/camera_device.cpp\n> +++ b/src/android/camera_device.cpp\n> @@ -312,33 +312,22 @@ CameraDevice::Camera3RequestDescriptor::~Camera3RequestDescriptor()\n>   * back to the framework using the designated callbacks.\n>   */\n>  \n> -CameraDevice::CameraDevice(unsigned int id, const std::shared_ptr<Camera> &camera)\n> -\t: id_(id), running_(false), camera_(camera), staticMetadata_(nullptr),\n> -\t  facing_(CAMERA_FACING_FRONT), orientation_(0)\n> +CameraDevice::CameraDevice(unsigned int id, const std::shared_ptr<Camera> &camera,\n> +\t\t\t   CameraHalConfig &halConfig)\n> +\t: id_(id), running_(false), camera_(camera), halConfig_(&halConfig),\n> +\t  staticMetadata_(nullptr), facing_(CAMERA_FACING_FRONT), orientation_(0)\n>  {\n> -\tcamera_->requestCompleted.connect(this, &CameraDevice::requestComplete);\n> -\n> -\tmaker_ = \"libcamera\";\n> -\tmodel_ = \"cameraModel\";\n> -\n> -\t/* \\todo Support getting properties on Android */\n> -\tstd::ifstream fstream(\"/var/cache/camera/camera.prop\");\n> -\tif (!fstream.is_open())\n> -\t\treturn;\n> -\n> -\tstd::string line;\n> -\twhile (std::getline(fstream, line)) {\n> -\t\tstd::string::size_type delimPos = line.find(\"=\");\n> -\t\tif (delimPos == std::string::npos)\n> -\t\t\tcontinue;\n> -\t\tstd::string key = line.substr(0, delimPos);\n> -\t\tstd::string val = line.substr(delimPos + 1);\n> -\n> -\t\tif (!key.compare(\"ro.product.model\"))\n> -\t\t\tmodel_ = val;\n> -\t\telse if (!key.compare(\"ro.product.manufacturer\"))\n> -\t\t\tmaker_ = val;\n> +\tmaker_ = halConfig_->deviceMaker();\n> +\tmodel_ = halConfig_->deviceModel();\n> +\tif (maker_.empty() || model_.empty()) {\n> +\t\tmaker_ = \"libcamera\";\n> +\t\tmodel_ = \"cameraModel\";\n> +\t\tLOG(HAL, Warning)\n> +\t\t\t<< \"Cannot find manufacturer information. \"\n> +\t\t\t<< \"Default it to '\" << maker_ << \" - \" << model_;\n>  \t}\n> +\n> +\tcamera_->requestCompleted.connect(this, &CameraDevice::requestComplete);\n>  }\n>  \n>  CameraDevice::~CameraDevice()\n> @@ -351,9 +340,10 @@ CameraDevice::~CameraDevice()\n>  }\n>  \n>  std::shared_ptr<CameraDevice> CameraDevice::create(unsigned int id,\n> -\t\t\t\t\t\t   const std::shared_ptr<Camera> &cam)\n> +\t\t\t\t\t\t   const std::shared_ptr<Camera> &cam,\n> +\t\t\t\t\t\t   CameraHalConfig &halConfig)\n>  {\n> -\tCameraDevice *camera = new CameraDevice(id, cam);\n> +\tCameraDevice *camera = new CameraDevice(id, cam, halConfig);\n>  \treturn std::shared_ptr<CameraDevice>(camera);\n>  }\n>  \n> @@ -380,11 +370,28 @@ int CameraDevice::initialize()\n>  \t\t\tbreak;\n>  \t\t}\n>  \t} else {\n> -\t\t/*\n> -\t\t * \\todo Retrieve the camera location from configuration file\n> -\t\t * if not available from the library.\n> -\t\t */\n> -\t\tfacing_ = CAMERA_FACING_FRONT;\n> +\t\tstd::string location = halConfig_->cameraLocation(camera_->id());\n> +\t\tif (location.empty()) {\n> +\t\t\tLOG(HAL, Error) << \"Location for camera \"\n> +\t\t\t\t\t<< camera_->id() << \" not reported\";\n> +\t\t\treturn -EINVAL;\n> +\t\t}\n\nWould it make sens to cameraLocation() to translate from the string to \nthe enum value?\n\n> +\n> +\t\tif (location == \"front\") {\n> +\t\t\tfacing_ = CAMERA_FACING_FRONT;\n> +\t\t} else if (location == \"back\") {\n> +\t\t\tfacing_ = CAMERA_FACING_BACK;\n> +\t\t} else if (location == \"external\") {\n> +\t\t\tfacing_ = CAMERA_FACING_EXTERNAL;\n> +\t\t} else {\n> +\t\t\tLOG(HAL, Error) << \"Unsupported camera location \"\n> +\t\t\t\t\t<< location;\n> +\t\t\treturn -EINVAL;\n> +\t\t}\n> +\n> +\t\tLOG(HAL, Debug)\n> +\t\t\t<< \"Camera location retrieved from configration file: \"\n> +\t\t\t<< location;\n>  \t}\n>  \n>  \t/*\n> diff --git a/src/android/camera_device.h b/src/android/camera_device.h\n> index 823d561cc295..33bfd115a703 100644\n> --- a/src/android/camera_device.h\n> +++ b/src/android/camera_device.h\n> @@ -24,6 +24,7 @@\n>  #include \"libcamera/internal/log.h\"\n>  #include \"libcamera/internal/message.h\"\n>  \n> +#include \"camera_hal_config.h\"\n>  #include \"camera_metadata.h\"\n>  #include \"camera_stream.h\"\n>  #include \"camera_worker.h\"\n> @@ -33,7 +34,8 @@ class CameraDevice : protected libcamera::Loggable\n>  {\n>  public:\n>  \tstatic std::shared_ptr<CameraDevice> create(unsigned int id,\n> -\t\t\t\t\t\t    const std::shared_ptr<libcamera::Camera> &cam);\n> +\t\t\t\t\t\t    const std::shared_ptr<libcamera::Camera> &cam,\n> +\t\t\t\t\t\t    CameraHalConfig &halConfig);\n>  \t~CameraDevice();\n>  \n>  \tint initialize();\n> @@ -66,7 +68,8 @@ protected:\n>  \tstd::string logPrefix() const override;\n>  \n>  private:\n> -\tCameraDevice(unsigned int id, const std::shared_ptr<libcamera::Camera> &camera);\n> +\tCameraDevice(unsigned int id, const std::shared_ptr<libcamera::Camera> &camera,\n> +\t\t     CameraHalConfig &halConfig);\n>  \n>  \tstruct Camera3RequestDescriptor {\n>  \t\tCamera3RequestDescriptor(libcamera::Camera *camera,\n> @@ -113,6 +116,7 @@ private:\n>  \tbool running_;\n>  \tstd::shared_ptr<libcamera::Camera> camera_;\n>  \tstd::unique_ptr<libcamera::CameraConfiguration> config_;\n> +\tCameraHalConfig *halConfig_;\n>  \n>  \tCameraMetadata *staticMetadata_;\n>  \tstd::map<unsigned int, const CameraMetadata *> requestTemplates_;\n> diff --git a/src/android/camera_hal_manager.cpp b/src/android/camera_hal_manager.cpp\n> index a19f80edede8..4fb5c87e2a68 100644\n> --- a/src/android/camera_hal_manager.cpp\n> +++ b/src/android/camera_hal_manager.cpp\n> @@ -129,7 +129,8 @@ void CameraHalManager::cameraAdded(std::shared_ptr<Camera> cam)\n>  \t}\n>  \n>  \t/* Create a CameraDevice instance to wrap the libcamera Camera. */\n> -\tstd::shared_ptr<CameraDevice> camera = CameraDevice::create(id, std::move(cam));\n> +\tstd::shared_ptr<CameraDevice> camera = CameraDevice::create(id, std::move(cam),\n> +\t\t\t\t\t\t\t\t    halConfig_);\n>  \tint ret = camera->initialize();\n>  \tif (ret) {\n>  \t\tLOG(HAL, Error) << \"Failed to initialize camera: \" << cam->id();\n> -- \n> 2.30.0\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 73112C32EA\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 25 Mar 2021 22:39:13 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CC6CB68D6A;\n\tThu, 25 Mar 2021 23:39:12 +0100 (CET)","from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com\n\t[IPv6:2a00:1450:4864:20::22e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 982E1603FE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 25 Mar 2021 23:39:11 +0100 (CET)","by mail-lj1-x22e.google.com with SMTP id f26so5174941ljp.8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 25 Mar 2021 15:39:11 -0700 (PDT)","from localhost (h-209-203.A463.priv.bahnhof.se. [155.4.209.203])\n\tby smtp.gmail.com with ESMTPSA id\n\tj14sm666999lfg.134.2021.03.25.15.39.10\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 25 Mar 2021 15:39:10 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=ragnatech-se.20150623.gappssmtp.com\n\theader.i=@ragnatech-se.20150623.gappssmtp.com\n\theader.b=\"jXIZtwSD\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to;\n\tbh=Bnf3G5EWg57o643PFC9KSdwv9ovmp8PXOYc1JuxYOm8=;\n\tb=jXIZtwSDYgwyzA+VbKwJBeLrPPemmJohztn/zf/4rmSsco5fy9B21D5ldEJxpdjEkm\n\teSYxhP3vPsfV/ruDHygYSMUme1ctNATMISuFzYvHykk+oFitobOdsT3IemjVAJO7+T4S\n\tQ7IzvZvEo2pYx+mYA97yFlyQfECL673rsU+X30NUWXfFCRhoa4KJJdtKwDpzI6Jtv3H6\n\tomlsZ3R8tdbiMaxHcFRCYPRs4Hxh77umuiJibswAyPSURLlcnSe0oCzE1tVYnWwiHS4i\n\taSuieWfoEXTQYwnPpxxNpNDS3gaI0dE8DNS2V5+tWTvabt7gjgYpA5UmmffxfN5NhMHz\n\tfAzg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to;\n\tbh=Bnf3G5EWg57o643PFC9KSdwv9ovmp8PXOYc1JuxYOm8=;\n\tb=lPzSQZj4btNvytNXBJfZbIyIYe7m2numqG3AisxM/SyFIERQvHBC7RRy4PSIdJlMew\n\tkXqx5NsTtPvtlle7Yco1ocSp7Rg6w5jAAxkw6P87kJ2RcrKkZ60j31iED4gPFXJmJZJW\n\tD6nqpZxYz72gIad04bpqksdzutP2gOY6B0Cbo2OnnzF8ZtQC7IcScMsJGa4IS+gSpYBL\n\tW/PsqZtOxJGhSKNjQJDSwEGqf2o9GwD2z3KO6fjsKLWTFY3XYJCgi4i3H5kZIdTTuqSN\n\t93vDSyPIbkFcfH7OAR/BL1em3JdVia2Uj+4XqmrHwBw6hMJSm/xf7G9ga6s7cZVbG2Wp\n\tgCWg==","X-Gm-Message-State":"AOAM530emhy1inBGNc/fww2rF5eYQuYkMeYov+ijAGMFn52lW3KcUZWl\n\tsQ4eLHtm6ONcqAMqo9N4CmdUPA==","X-Google-Smtp-Source":"ABdhPJz5jWGlXBNxgNxVzKFShPP5Y5dmlP3Ql4k3Aqu2PwSmqhajXBP7S+XSVcX7YlfbW+amjeyELg==","X-Received":"by 2002:a2e:819a:: with SMTP id\n\te26mr7155359ljg.222.1616711950975; \n\tThu, 25 Mar 2021 15:39:10 -0700 (PDT)","Date":"Thu, 25 Mar 2021 23:39:09 +0100","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<YF0RDWBfcJRN6Yi4@oden.dyn.berto.se>","References":"<20210324112527.63701-1-jacopo@jmondi.org>\n\t<20210324112527.63701-7-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20210324112527.63701-7-jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [PATCH 6/7] android: camera_device: Get\n\tproperties from config","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"iso-8859-1\"","Content-Transfer-Encoding":"quoted-printable","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":15933,"web_url":"https://patchwork.libcamera.org/comment/15933/","msgid":"<YF1XwOX8SCeVZSwF@pendragon.ideasonboard.com>","date":"2021-03-26T03:40:48","subject":"Re: [libcamera-devel] [PATCH 6/7] android: camera_device: Get\n\tproperties from config","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nThank you for the patch.\n\nOn Thu, Mar 25, 2021 at 11:39:09PM +0100, Niklas Söderlund wrote:\n> On 2021-03-24 12:25:26 +0100, Jacopo Mondi wrote:\n> > Create the CameraDevice with a reference to the HAL configuration\n> > file and use it to retrieve device and camera properties.\n> > \n> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> > ---\n> >  src/android/camera_device.cpp      | 71 ++++++++++++++++--------------\n> >  src/android/camera_device.h        |  8 +++-\n> >  src/android/camera_hal_manager.cpp |  3 +-\n> >  3 files changed, 47 insertions(+), 35 deletions(-)\n> > \n> > diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\n> > index 72a89258386d..403d149e4f68 100644\n> > --- a/src/android/camera_device.cpp\n> > +++ b/src/android/camera_device.cpp\n> > @@ -312,33 +312,22 @@ CameraDevice::Camera3RequestDescriptor::~Camera3RequestDescriptor()\n> >   * back to the framework using the designated callbacks.\n> >   */\n> >  \n> > -CameraDevice::CameraDevice(unsigned int id, const std::shared_ptr<Camera> &camera)\n> > -\t: id_(id), running_(false), camera_(camera), staticMetadata_(nullptr),\n> > -\t  facing_(CAMERA_FACING_FRONT), orientation_(0)\n> > +CameraDevice::CameraDevice(unsigned int id, const std::shared_ptr<Camera> &camera,\n> > +\t\t\t   CameraHalConfig &halConfig)\n> > +\t: id_(id), running_(false), camera_(camera), halConfig_(&halConfig),\n> > +\t  staticMetadata_(nullptr), facing_(CAMERA_FACING_FRONT), orientation_(0)\n> >  {\n> > -\tcamera_->requestCompleted.connect(this, &CameraDevice::requestComplete);\n> > -\n> > -\tmaker_ = \"libcamera\";\n> > -\tmodel_ = \"cameraModel\";\n> > -\n> > -\t/* \\todo Support getting properties on Android */\n> > -\tstd::ifstream fstream(\"/var/cache/camera/camera.prop\");\n> > -\tif (!fstream.is_open())\n> > -\t\treturn;\n> > -\n> > -\tstd::string line;\n> > -\twhile (std::getline(fstream, line)) {\n> > -\t\tstd::string::size_type delimPos = line.find(\"=\");\n> > -\t\tif (delimPos == std::string::npos)\n> > -\t\t\tcontinue;\n> > -\t\tstd::string key = line.substr(0, delimPos);\n> > -\t\tstd::string val = line.substr(delimPos + 1);\n> > -\n> > -\t\tif (!key.compare(\"ro.product.model\"))\n> > -\t\t\tmodel_ = val;\n> > -\t\telse if (!key.compare(\"ro.product.manufacturer\"))\n> > -\t\t\tmaker_ = val;\n> > +\tmaker_ = halConfig_->deviceMaker();\n> > +\tmodel_ = halConfig_->deviceModel();\n> > +\tif (maker_.empty() || model_.empty()) {\n> > +\t\tmaker_ = \"libcamera\";\n> > +\t\tmodel_ = \"cameraModel\";\n> > +\t\tLOG(HAL, Warning)\n> > +\t\t\t<< \"Cannot find manufacturer information. \"\n> > +\t\t\t<< \"Default it to '\" << maker_ << \" - \" << model_;\n> >  \t}\n\nShould we do this ? The existing code handles Chrome OS natively, isn't\nit better than duplicating information in our configuration file ?\n\n> > +\n> > +\tcamera_->requestCompleted.connect(this, &CameraDevice::requestComplete);\n> >  }\n> >  \n> >  CameraDevice::~CameraDevice()\n> > @@ -351,9 +340,10 @@ CameraDevice::~CameraDevice()\n> >  }\n> >  \n> >  std::shared_ptr<CameraDevice> CameraDevice::create(unsigned int id,\n> > -\t\t\t\t\t\t   const std::shared_ptr<Camera> &cam)\n> > +\t\t\t\t\t\t   const std::shared_ptr<Camera> &cam,\n> > +\t\t\t\t\t\t   CameraHalConfig &halConfig)\n> >  {\n> > -\tCameraDevice *camera = new CameraDevice(id, cam);\n> > +\tCameraDevice *camera = new CameraDevice(id, cam, halConfig);\n> >  \treturn std::shared_ptr<CameraDevice>(camera);\n> >  }\n> >  \n> > @@ -380,11 +370,28 @@ int CameraDevice::initialize()\n> >  \t\t\tbreak;\n> >  \t\t}\n> >  \t} else {\n> > -\t\t/*\n> > -\t\t * \\todo Retrieve the camera location from configuration file\n> > -\t\t * if not available from the library.\n> > -\t\t */\n> > -\t\tfacing_ = CAMERA_FACING_FRONT;\n> > +\t\tstd::string location = halConfig_->cameraLocation(camera_->id());\n> > +\t\tif (location.empty()) {\n> > +\t\t\tLOG(HAL, Error) << \"Location for camera \"\n> > +\t\t\t\t\t<< camera_->id() << \" not reported\";\n> > +\t\t\treturn -EINVAL;\n> > +\t\t}\n> \n> Would it make sens to cameraLocation() to translate from the string to \n> the enum value?\n\nSeems like a good idea.\n\n> > +\n> > +\t\tif (location == \"front\") {\n> > +\t\t\tfacing_ = CAMERA_FACING_FRONT;\n> > +\t\t} else if (location == \"back\") {\n> > +\t\t\tfacing_ = CAMERA_FACING_BACK;\n> > +\t\t} else if (location == \"external\") {\n> > +\t\t\tfacing_ = CAMERA_FACING_EXTERNAL;\n> > +\t\t} else {\n> > +\t\t\tLOG(HAL, Error) << \"Unsupported camera location \"\n> > +\t\t\t\t\t<< location;\n> > +\t\t\treturn -EINVAL;\n> > +\t\t}\n> > +\n> > +\t\tLOG(HAL, Debug)\n> > +\t\t\t<< \"Camera location retrieved from configration file: \"\n> > +\t\t\t<< location;\n> >  \t}\n> >  \n> >  \t/*\n> > diff --git a/src/android/camera_device.h b/src/android/camera_device.h\n> > index 823d561cc295..33bfd115a703 100644\n> > --- a/src/android/camera_device.h\n> > +++ b/src/android/camera_device.h\n> > @@ -24,6 +24,7 @@\n> >  #include \"libcamera/internal/log.h\"\n> >  #include \"libcamera/internal/message.h\"\n> >  \n> > +#include \"camera_hal_config.h\"\n\nA forward declaratio of CameraHalConfig should be enough in this file.\n\n> >  #include \"camera_metadata.h\"\n> >  #include \"camera_stream.h\"\n> >  #include \"camera_worker.h\"\n> > @@ -33,7 +34,8 @@ class CameraDevice : protected libcamera::Loggable\n> >  {\n> >  public:\n> >  \tstatic std::shared_ptr<CameraDevice> create(unsigned int id,\n> > -\t\t\t\t\t\t    const std::shared_ptr<libcamera::Camera> &cam);\n> > +\t\t\t\t\t\t    const std::shared_ptr<libcamera::Camera> &cam,\n> > +\t\t\t\t\t\t    CameraHalConfig &halConfig);\n\nconst CameraHalConfig, as the camera device shouldn't change the\nconfiguration ?\n\n> >  \t~CameraDevice();\n> >  \n> >  \tint initialize();\n> > @@ -66,7 +68,8 @@ protected:\n> >  \tstd::string logPrefix() const override;\n> >  \n> >  private:\n> > -\tCameraDevice(unsigned int id, const std::shared_ptr<libcamera::Camera> &camera);\n> > +\tCameraDevice(unsigned int id, const std::shared_ptr<libcamera::Camera> &camera,\n> > +\t\t     CameraHalConfig &halConfig);\n> >  \n> >  \tstruct Camera3RequestDescriptor {\n> >  \t\tCamera3RequestDescriptor(libcamera::Camera *camera,\n> > @@ -113,6 +116,7 @@ private:\n> >  \tbool running_;\n> >  \tstd::shared_ptr<libcamera::Camera> camera_;\n> >  \tstd::unique_ptr<libcamera::CameraConfiguration> config_;\n> > +\tCameraHalConfig *halConfig_;\n\nAs this should never change during the lifetime of the CameraDevice, you\ncan make it a reference.\n\n> >  \n> >  \tCameraMetadata *staticMetadata_;\n> >  \tstd::map<unsigned int, const CameraMetadata *> requestTemplates_;\n> > diff --git a/src/android/camera_hal_manager.cpp b/src/android/camera_hal_manager.cpp\n> > index a19f80edede8..4fb5c87e2a68 100644\n> > --- a/src/android/camera_hal_manager.cpp\n> > +++ b/src/android/camera_hal_manager.cpp\n> > @@ -129,7 +129,8 @@ void CameraHalManager::cameraAdded(std::shared_ptr<Camera> cam)\n> >  \t}\n> >  \n> >  \t/* Create a CameraDevice instance to wrap the libcamera Camera. */\n> > -\tstd::shared_ptr<CameraDevice> camera = CameraDevice::create(id, std::move(cam));\n> > +\tstd::shared_ptr<CameraDevice> camera = CameraDevice::create(id, std::move(cam),\n> > +\t\t\t\t\t\t\t\t    halConfig_);\n> >  \tint ret = camera->initialize();\n> >  \tif (ret) {\n> >  \t\tLOG(HAL, Error) << \"Failed to initialize camera: \" << cam->id();","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id F0240C32EA\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 26 Mar 2021 03:41:34 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 69C8E603FE;\n\tFri, 26 Mar 2021 04:41:34 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 691FE602E3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 26 Mar 2021 04:41:32 +0100 (CET)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C6889443;\n\tFri, 26 Mar 2021 04:41:31 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"bqSYIWBR\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1616730092;\n\tbh=id5sefkK9DRwPBddrwd6DhVBpx5gVm8DlfAiDHtILDw=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=bqSYIWBRVQul3RhI++2pOtQjtjd8F6LafcQcN3Mm79lw3uJSpr9m6/I/TghOl/6xl\n\tq5FOw0aKT7zmONGXc5nB8nyp6aBe9jsUol4CXIBdqLuMvyBKZnyzH1gZk56pRcFFjQ\n\tTpOa9QpKsymzId69nzrefcKoaBiWDXVzy8Rez++o=","Date":"Fri, 26 Mar 2021 05:40:48 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<YF1XwOX8SCeVZSwF@pendragon.ideasonboard.com>","References":"<20210324112527.63701-1-jacopo@jmondi.org>\n\t<20210324112527.63701-7-jacopo@jmondi.org>\n\t<YF0RDWBfcJRN6Yi4@oden.dyn.berto.se>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<YF0RDWBfcJRN6Yi4@oden.dyn.berto.se>","Subject":"Re: [libcamera-devel] [PATCH 6/7] android: camera_device: Get\n\tproperties from config","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]