{"id":11371,"url":"https://patchwork.libcamera.org/api/1.1/patches/11371/?format=json","web_url":"https://patchwork.libcamera.org/patch/11371/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20210224094833.24219-2-paul.elder@ideasonboard.com>","date":"2021-02-24T09:48:31","name":"[libcamera-devel,v3,1/2] libcamera: camera_sensor: Print warning when orientation is unknown","commit_ref":"edc771ef2fab4ef6619dd970786681b218abdee7","pull_url":null,"state":"accepted","archived":false,"hash":"c2c8d996658435238a6b032dd7de8239e866712a","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/1.1/people/17/?format=json","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/11371/mbox/","series":[{"id":1723,"url":"https://patchwork.libcamera.org/api/1.1/series/1723/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1723","date":"2021-02-24T09:48:30","name":"Fix camera location","version":3,"mbox":"https://patchwork.libcamera.org/series/1723/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11371/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11371/checks/","tags":{},"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 64B2EBD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 24 Feb 2021 09:48:53 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EA48868A33;\n\tWed, 24 Feb 2021 10:48:52 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 40E9A6040F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 24 Feb 2021 10:48:52 +0100 (CET)","from pyrite.rasen.tech (unknown\n\t[IPv6:2400:4051:61:600:2c71:1b79:d06d:5032])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 895328E8;\n\tWed, 24 Feb 2021 10:48:50 +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=\"Tq11+pHW\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1614160132;\n\tbh=KeZdTDFRt/WBoFGtuupy9Hr1uWUsA4uj7HCYW1m4TZU=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=Tq11+pHWDDJlpEV8I56wLCSKzuPkp5F1suSPuSPZ5lFAU9l5GCcOFej6aDw7bmgXK\n\tl2eAQMqvDjYkcXj0wEuq/vpk8eeOuDk5atlLujZ/lEkIlDVhr9LjSHjJESu2t5EIW1\n\t9MlceMFykvfQ2JQ+LlWDy5LgAtJ1P6sjxcaQBPlg=","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 24 Feb 2021 18:48:31 +0900","Message-Id":"<20210224094833.24219-2-paul.elder@ideasonboard.com>","X-Mailer":"git-send-email 2.27.0","In-Reply-To":"<20210224094833.24219-1-paul.elder@ideasonboard.com>","References":"<20210224094833.24219-1-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v3 1/2] libcamera: camera_sensor: Print\n\twarning 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>","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>"},"content":"Print a warning when the orientation of a sensor is unknown. The\nlocation property is still defaulted to external.\n\nAlso add a recommended controls list, similar to the optional and\nmandatory controls list, to handle controls in a similar situation in\nthe future.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n---\nChanges in v3:\n- add recommendedControls\n\nChanges in v2:\n- expand the warning message\n---\n src/libcamera/camera_sensor.cpp | 23 +++++++++++++++++++++--\n 1 file changed, 21 insertions(+), 2 deletions(-)","diff":"diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\nindex 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","prefixes":["libcamera-devel","v3","1/2"]}