From patchwork Wed Dec 30 23:06:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10789 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 9C86FC0F1A for ; Wed, 30 Dec 2020 23:05:59 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A622F6200D; Thu, 31 Dec 2020 00:05:58 +0100 (CET) Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A1DB46031F for ; Thu, 31 Dec 2020 00:05:55 +0100 (CET) X-Originating-IP: 2.224.242.101 Received: from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101]) (Authenticated sender: jacopo@jmondi.org) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 3BAFFC0002; Wed, 30 Dec 2020 23:05:55 +0000 (UTC) From: Jacopo Mondi 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 'location' to External X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" If the sensor driver does not report the camera location default it to 'External' instead of 'Front'. As the camera location is used to construct the camera unique name presented to the user, it makes more sense to report multiple 'External' cameras instead of multiple 'Front' ones. Reviewed-by: Laurent Pinchart Signed-off-by: Jacopo Mondi Reviewed-by: Niklas Söderlund --- src/libcamera/camera_sensor.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp index bf0d6b06ae20..98207cde71f5 100644 --- a/src/libcamera/camera_sensor.cpp +++ b/src/libcamera/camera_sensor.cpp @@ -349,7 +349,6 @@ int CameraSensor::initProperties() const ControlInfoMap &controls = subdev_->controls(); int32_t propertyValue; - /* Camera Location: default is front location. */ const auto &orientation = controls.find(V4L2_CID_CAMERA_ORIENTATION); if (orientation != controls.end()) { int32_t v4l2Orientation = orientation->second.def().get(); @@ -358,20 +357,20 @@ int CameraSensor::initProperties() default: LOG(CameraSensor, Warning) << "Unsupported camera location " - << v4l2Orientation << ", setting to Front"; + << v4l2Orientation << ", setting to External"; /* Fall-through */ + case V4L2_CAMERA_ORIENTATION_EXTERNAL: + propertyValue = properties::CameraLocationExternal; + break; case V4L2_CAMERA_ORIENTATION_FRONT: propertyValue = properties::CameraLocationFront; break; case V4L2_CAMERA_ORIENTATION_BACK: propertyValue = properties::CameraLocationBack; break; - case V4L2_CAMERA_ORIENTATION_EXTERNAL: - propertyValue = properties::CameraLocationExternal; - break; } } else { - propertyValue = properties::CameraLocationFront; + propertyValue = properties::CameraLocationExternal; } properties_.set(properties::Location, propertyValue);