{"id":10789,"url":"https://patchwork.libcamera.org/api/patches/10789/?format=json","web_url":"https://patchwork.libcamera.org/patch/10789/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20201230230603.123486-5-jacopo@jmondi.org>","date":"2020-12-30T23:06:01","name":"[libcamera-devel,v4,4/6] libcamera: camera_sensor: Default 'location' to External","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"5ba9650e483e536066efe3c8c5566e2dfd4a34a5","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/10789/mbox/","series":[{"id":1561,"url":"https://patchwork.libcamera.org/api/series/1561/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1561","date":"2020-12-30T23:05:57","name":"libcamera: camera_sensor: Make validation more strict","version":4,"mbox":"https://patchwork.libcamera.org/series/1561/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/10789/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/10789/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 9C86FC0F1A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 30 Dec 2020 23:05:59 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A622F6200D;\n\tThu, 31 Dec 2020 00:05:58 +0100 (CET)","from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net\n\t[217.70.183.198])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A1DB46031F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 31 Dec 2020 00:05:55 +0100 (CET)","from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 3BAFFC0002;\n\tWed, 30 Dec 2020 23:05:55 +0000 (UTC)"],"X-Originating-IP":"2.224.242.101","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Thu, 31 Dec 2020 00:06:01 +0100","Message-Id":"<20201230230603.123486-5-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.29.2","In-Reply-To":"<20201230230603.123486-1-jacopo@jmondi.org>","References":"<20201230230603.123486-1-jacopo@jmondi.org>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v4 4/6] libcamera: camera_sensor: Default\n\t'location' to External","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":"If the sensor driver does not report the camera location default it\nto 'External' instead of 'Front'.\n\nAs the camera location is used to construct the camera unique name\npresented to the user, it makes more sense to report multiple 'External'\ncameras instead of multiple 'Front' ones.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/camera_sensor.cpp | 11 +++++------\n 1 file changed, 5 insertions(+), 6 deletions(-)","diff":"diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\nindex bf0d6b06ae20..98207cde71f5 100644\n--- a/src/libcamera/camera_sensor.cpp\n+++ b/src/libcamera/camera_sensor.cpp\n@@ -349,7 +349,6 @@ int CameraSensor::initProperties()\n \tconst ControlInfoMap &controls = subdev_->controls();\n \tint32_t propertyValue;\n \n-\t/* Camera Location: default is front location. */\n \tconst auto &orientation = controls.find(V4L2_CID_CAMERA_ORIENTATION);\n \tif (orientation != controls.end()) {\n \t\tint32_t v4l2Orientation = orientation->second.def().get<int32_t>();\n@@ -358,20 +357,20 @@ int CameraSensor::initProperties()\n \t\tdefault:\n \t\t\tLOG(CameraSensor, Warning)\n \t\t\t\t<< \"Unsupported camera location \"\n-\t\t\t\t<< v4l2Orientation << \", setting to Front\";\n+\t\t\t\t<< v4l2Orientation << \", setting to External\";\n \t\t\t/* Fall-through */\n+\t\tcase V4L2_CAMERA_ORIENTATION_EXTERNAL:\n+\t\t\tpropertyValue = properties::CameraLocationExternal;\n+\t\t\tbreak;\n \t\tcase V4L2_CAMERA_ORIENTATION_FRONT:\n \t\t\tpropertyValue = properties::CameraLocationFront;\n \t\t\tbreak;\n \t\tcase V4L2_CAMERA_ORIENTATION_BACK:\n \t\t\tpropertyValue = properties::CameraLocationBack;\n \t\t\tbreak;\n-\t\tcase V4L2_CAMERA_ORIENTATION_EXTERNAL:\n-\t\t\tpropertyValue = properties::CameraLocationExternal;\n-\t\t\tbreak;\n \t\t}\n \t} else {\n-\t\tpropertyValue = properties::CameraLocationFront;\n+\t\tpropertyValue = properties::CameraLocationExternal;\n \t}\n \tproperties_.set(properties::Location, propertyValue);\n \n","prefixes":["libcamera-devel","v4","4/6"]}