From patchwork Wed Feb 24 09:48:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 11371 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 64B2EBD808 for ; Wed, 24 Feb 2021 09:48:53 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id EA48868A33; Wed, 24 Feb 2021 10:48:52 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Tq11+pHW"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 40E9A6040F for ; Wed, 24 Feb 2021 10:48:52 +0100 (CET) Received: from pyrite.rasen.tech (unknown [IPv6:2400:4051:61:600:2c71:1b79:d06d:5032]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 895328E8; Wed, 24 Feb 2021 10:48:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1614160132; bh=KeZdTDFRt/WBoFGtuupy9Hr1uWUsA4uj7HCYW1m4TZU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Tq11+pHWDDJlpEV8I56wLCSKzuPkp5F1suSPuSPZ5lFAU9l5GCcOFej6aDw7bmgXK l2eAQMqvDjYkcXj0wEuq/vpk8eeOuDk5atlLujZ/lEkIlDVhr9LjSHjJESu2t5EIW1 9MlceMFykvfQ2JQ+LlWDy5LgAtJ1P6sjxcaQBPlg= From: Paul Elder 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 warning when orientation is unknown 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" Print a warning when the orientation of a sensor is unknown. The location property is still defaulted to external. Also add a recommended controls list, similar to the optional and mandatory controls list, to handle controls in a similar situation in the future. Signed-off-by: Paul Elder Reviewed-by: Kieran Bingham Reviewed-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- Changes in v3: - add recommendedControls Changes in v2: - expand the warning message --- src/libcamera/camera_sensor.cpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp index c9e8d49b..8a1b9bd2 100644 --- a/src/libcamera/camera_sensor.cpp +++ b/src/libcamera/camera_sensor.cpp @@ -276,12 +276,13 @@ int CameraSensor::init() int CameraSensor::validateSensorDriver() { + int err = 0; + /* * Optional controls are used to register optional sensor properties. If * not present, some values will be defaulted. */ static constexpr uint32_t optionalControls[] = { - V4L2_CID_CAMERA_ORIENTATION, V4L2_CID_CAMERA_SENSOR_ROTATION, }; @@ -293,6 +294,23 @@ int CameraSensor::validateSensorDriver() << " not supported"; } + /* + * Recommended controls are similar to optional controls, but will + * become mandatory in the near future. Be loud if they're missing. + */ + static constexpr uint32_t recommendedControls[] = { + V4L2_CID_CAMERA_ORIENTATION, + }; + + for (uint32_t ctrl : recommendedControls) { + if (!controls.count(ctrl)) { + LOG(CameraSensor, Warning) + << "Recommended V4L2 control " << utils::hex(ctrl) + << " not supported"; + err = -EINVAL; + } + } + /* * Make sure the required selection targets are supported. * @@ -303,7 +321,6 @@ int CameraSensor::validateSensorDriver() * \todo Make support for selection targets mandatory as soon as all * test platforms have been updated. */ - int err = 0; Rectangle rect; int ret = subdev_->getSelection(pad_, V4L2_SEL_TGT_CROP_BOUNDS, &rect); if (ret) { @@ -446,6 +463,8 @@ int CameraSensor::initProperties() break; } } else { + LOG(CameraSensor, Warning) + << "Failed to retrieve the camera location, setting to External"; propertyValue = properties::CameraLocationExternal; } properties_.set(properties::Location, propertyValue); From patchwork Wed Feb 24 09:48:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 11372 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 A4272BD808 for ; Wed, 24 Feb 2021 09:48:56 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 6D3CF68A33; Wed, 24 Feb 2021 10:48:56 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Ok1L4Q21"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2F9BD6040F for ; Wed, 24 Feb 2021 10:48:55 +0100 (CET) Received: from pyrite.rasen.tech (unknown [IPv6:2400:4051:61:600:2c71:1b79:d06d:5032]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id BF8318A1; Wed, 24 Feb 2021 10:48:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1614160134; bh=hjzuJ8bvR9XmD/RkKVlB0p8PlG0TMS8+qNatkv9wm50=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ok1L4Q21Y+EbNIm8zCGy5l+uqOBumpFvTfDjo1vqUYaVbio5DUpfH6/bTAmnQ7zBr 6nUVrM+lM+Qqw/BKZlJ+rAB8e0anp4BEQ6Y0qhXKlXO4v868TO+X4UEgX18+W5IEdd lon4K1B1TGDv6zOXOqGJh3/Jfbxqv3Hiyklt9WbA= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Wed, 24 Feb 2021 18:48:32 +0900 Message-Id: <20210224094833.24219-3-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 2/2] android: camera_device: Set the camera location to Front if 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" Our android HAL implementation currently does not support external cameras, so if the camera location property is external, set it to front. This allows the following CTS test to pass: - android.hardware.camera2.cts.CameraManagerTest#testCameraManagerGetDeviceIdList Signed-off-by: Paul Elder Reviewed-by: Kieran Bingham Reviewed-by: Niklas Söderlund Reviewed-by: Laurent Pinchart Reviewed-by: Jacopo Mondi --- No change in v2 --- src/android/camera_device.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index 1e2a5b5f..16cb8c6d 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -405,7 +405,11 @@ int CameraDevice::initialize() facing_ = CAMERA_FACING_BACK; break; case properties::CameraLocationExternal: - facing_ = CAMERA_FACING_EXTERNAL; + /* + * \todo Set this to EXTERNAL once we support + * HARDWARE_LEVEL_EXTERNAL + */ + facing_ = CAMERA_FACING_FRONT; break; } }