[{"id":15305,"web_url":"https://patchwork.libcamera.org/comment/15305/","msgid":"<20210224095723.rwltoosql43d37kf@uno.localdomain>","date":"2021-02-24T09:57:23","subject":"Re: [libcamera-devel] [PATCH v3 1/2] libcamera: camera_sensor:\n\tPrint warning when orientation is unknown","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Paul,\n\nOn Wed, Feb 24, 2021 at 06:48:31PM +0900, Paul Elder wrote:\n> Print a warning when the orientation of a sensor is unknown. The\n> location property is still defaulted to external.\n>\n> Also add a recommended controls list, similar to the optional and\n> mandatory controls list, to handle controls in a similar situation in\n> the future.\n>\n> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>\n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n>\n\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n\nThanks\n  j\n\n> ---\n> Changes in v3:\n> - add recommendedControls\n>\n> Changes in v2:\n> - expand the warning message\n> ---\n>  src/libcamera/camera_sensor.cpp | 23 +++++++++++++++++++++--\n>  1 file changed, 21 insertions(+), 2 deletions(-)\n>\n> diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\n> index c9e8d49b..8a1b9bd2 100644\n> --- a/src/libcamera/camera_sensor.cpp\n> +++ b/src/libcamera/camera_sensor.cpp\n> @@ -276,12 +276,13 @@ int CameraSensor::init()\n>\n>  int CameraSensor::validateSensorDriver()\n>  {\n> +\tint err = 0;\n> +\n>  \t/*\n>  \t * Optional controls are used to register optional sensor properties. If\n>  \t * not present, some values will be defaulted.\n>  \t */\n>  \tstatic constexpr uint32_t optionalControls[] = {\n> -\t\tV4L2_CID_CAMERA_ORIENTATION,\n>  \t\tV4L2_CID_CAMERA_SENSOR_ROTATION,\n>  \t};\n>\n> @@ -293,6 +294,23 @@ int CameraSensor::validateSensorDriver()\n>  \t\t\t\t<< \" not supported\";\n>  \t}\n>\n> +\t/*\n> +\t * Recommended controls are similar to optional controls, but will\n> +\t * become mandatory in the near future. Be loud if they're missing.\n> +\t */\n> +\tstatic constexpr uint32_t recommendedControls[] = {\n> +\t\tV4L2_CID_CAMERA_ORIENTATION,\n> +\t};\n> +\n> +\tfor (uint32_t ctrl : recommendedControls) {\n> +\t\tif (!controls.count(ctrl)) {\n> +\t\t\tLOG(CameraSensor, Warning)\n> +\t\t\t\t<< \"Recommended V4L2 control \" << utils::hex(ctrl)\n> +\t\t\t\t<< \" not supported\";\n> +\t\t\terr = -EINVAL;\n> +\t\t}\n> +\t}\n> +\n>  \t/*\n>  \t * Make sure the required selection targets are supported.\n>  \t *\n> @@ -303,7 +321,6 @@ int CameraSensor::validateSensorDriver()\n>  \t * \\todo Make support for selection targets mandatory as soon as all\n>  \t * test platforms have been updated.\n>  \t */\n> -\tint err = 0;\n>  \tRectangle rect;\n>  \tint ret = subdev_->getSelection(pad_, V4L2_SEL_TGT_CROP_BOUNDS, &rect);\n>  \tif (ret) {\n> @@ -446,6 +463,8 @@ int CameraSensor::initProperties()\n>  \t\t\tbreak;\n>  \t\t}\n>  \t} else {\n> +\t\tLOG(CameraSensor, Warning)\n> +\t\t\t<< \"Failed to retrieve the camera location, setting to External\";\n>  \t\tpropertyValue = properties::CameraLocationExternal;\n>  \t}\n>  \tproperties_.set(properties::Location, propertyValue);\n> --\n> 2.27.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 CD4E2BD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 24 Feb 2021 09:56:57 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 619C168A34;\n\tWed, 24 Feb 2021 10:56:57 +0100 (CET)","from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net\n\t[217.70.183.200])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 313296040F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 24 Feb 2021 10:56:56 +0100 (CET)","from uno.localdomain (93-34-118-233.ip49.fastwebnet.it\n\t[93.34.118.233]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 968412000B;\n\tWed, 24 Feb 2021 09:56:55 +0000 (UTC)"],"X-Originating-IP":"93.34.118.233","Date":"Wed, 24 Feb 2021 10:57:23 +0100","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Paul Elder <paul.elder@ideasonboard.com>","Message-ID":"<20210224095723.rwltoosql43d37kf@uno.localdomain>","References":"<20210224094833.24219-1-paul.elder@ideasonboard.com>\n\t<20210224094833.24219-2-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20210224094833.24219-2-paul.elder@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v3 1/2] libcamera: camera_sensor:\n\tPrint warning when orientation is unknown","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=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":15307,"web_url":"https://patchwork.libcamera.org/comment/15307/","msgid":"<YDYo6F0yJDVTOwA8@pendragon.ideasonboard.com>","date":"2021-02-24T10:22:32","subject":"Re: [libcamera-devel] [PATCH v3 1/2] libcamera: camera_sensor:\n\tPrint warning when orientation is unknown","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Paul,\n\nThank you for the patch.\n\nOn Wed, Feb 24, 2021 at 06:48:31PM +0900, Paul Elder wrote:\n> Print a warning when the orientation of a sensor is unknown. The\n> location property is still defaulted to external.\n> \n> Also add a recommended controls list, similar to the optional and\n> mandatory controls list, to handle controls in a similar situation in\n> the future.\n> \n> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>\n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n> Changes in v3:\n> - add recommendedControls\n> \n> Changes in v2:\n> - expand the warning message\n> ---\n>  src/libcamera/camera_sensor.cpp | 23 +++++++++++++++++++++--\n>  1 file changed, 21 insertions(+), 2 deletions(-)\n> \n> diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\n> index c9e8d49b..8a1b9bd2 100644\n> --- a/src/libcamera/camera_sensor.cpp\n> +++ b/src/libcamera/camera_sensor.cpp\n> @@ -276,12 +276,13 @@ int CameraSensor::init()\n>  \n>  int CameraSensor::validateSensorDriver()\n>  {\n> +\tint err = 0;\n> +\n>  \t/*\n>  \t * Optional controls are used to register optional sensor properties. If\n>  \t * not present, some values will be defaulted.\n>  \t */\n>  \tstatic constexpr uint32_t optionalControls[] = {\n> -\t\tV4L2_CID_CAMERA_ORIENTATION,\n>  \t\tV4L2_CID_CAMERA_SENSOR_ROTATION,\n>  \t};\n>  \n> @@ -293,6 +294,23 @@ int CameraSensor::validateSensorDriver()\n>  \t\t\t\t<< \" not supported\";\n>  \t}\n>  \n> +\t/*\n> +\t * Recommended controls are similar to optional controls, but will\n> +\t * become mandatory in the near future. Be loud if they're missing.\n> +\t */\n> +\tstatic constexpr uint32_t recommendedControls[] = {\n> +\t\tV4L2_CID_CAMERA_ORIENTATION,\n> +\t};\n> +\n> +\tfor (uint32_t ctrl : recommendedControls) {\n> +\t\tif (!controls.count(ctrl)) {\n> +\t\t\tLOG(CameraSensor, Warning)\n> +\t\t\t\t<< \"Recommended V4L2 control \" << utils::hex(ctrl)\n> +\t\t\t\t<< \" not supported\";\n> +\t\t\terr = -EINVAL;\n> +\t\t}\n> +\t}\n> +\n>  \t/*\n>  \t * Make sure the required selection targets are supported.\n>  \t *\n> @@ -303,7 +321,6 @@ int CameraSensor::validateSensorDriver()\n>  \t * \\todo Make support for selection targets mandatory as soon as all\n>  \t * test platforms have been updated.\n>  \t */\n> -\tint err = 0;\n>  \tRectangle rect;\n>  \tint ret = subdev_->getSelection(pad_, V4L2_SEL_TGT_CROP_BOUNDS, &rect);\n>  \tif (ret) {\n> @@ -446,6 +463,8 @@ int CameraSensor::initProperties()\n>  \t\t\tbreak;\n>  \t\t}\n>  \t} else {\n> +\t\tLOG(CameraSensor, Warning)\n> +\t\t\t<< \"Failed to retrieve the camera location, setting to External\";\n>  \t\tpropertyValue = properties::CameraLocationExternal;\n>  \t}\n>  \tproperties_.set(properties::Location, propertyValue);","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 63658BD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 24 Feb 2021 10:23:04 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C8C3468A39;\n\tWed, 24 Feb 2021 11:23:03 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4C3516040F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 24 Feb 2021 11:23:02 +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 5A2A48A1;\n\tWed, 24 Feb 2021 11:23:01 +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=\"LvQgIVjn\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1614162181;\n\tbh=SPT6Mv6QAGVlj2/+AN3ffpfRVUAYZi26T17GjUtRrs4=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=LvQgIVjntNzs71kzWNok90jgU4BgBaOZzt/EFFHEOUcGvrJS9muinnZdBUxsabfCn\n\tcx0gq4suAwr1f4HbsViQ+r4sq3eM2yn1tvvHyqrxMBNldBptTBTMXt/Itf7Ck6Kmsd\n\tXhkbAXQ0PxxmXTY4oN7/0k0C0Nq2YaOklEK+BHtk=","Date":"Wed, 24 Feb 2021 12:22:32 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Paul Elder <paul.elder@ideasonboard.com>","Message-ID":"<YDYo6F0yJDVTOwA8@pendragon.ideasonboard.com>","References":"<20210224094833.24219-1-paul.elder@ideasonboard.com>\n\t<20210224094833.24219-2-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20210224094833.24219-2-paul.elder@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v3 1/2] libcamera: camera_sensor:\n\tPrint warning when orientation is unknown","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=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]