From patchwork Fri Jan 15 17:00:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10864 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 04A79C3383 for ; Fri, 15 Jan 2021 17:00:21 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0A3D2680F9; Fri, 15 Jan 2021 18:00:20 +0100 (CET) Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8C714680D1 for ; Fri, 15 Jan 2021 18:00:18 +0100 (CET) X-Originating-IP: 93.34.118.233 Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 5C8ED240004 for ; Fri, 15 Jan 2021 17:00:18 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Fri, 15 Jan 2021 18:00:24 +0100 Message-Id: <20210115170033.27124-2-jacopo@jmondi.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210115170033.27124-1-jacopo@jmondi.org> References: <20210115170033.27124-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v7 01/10] libcamera: Document sensor driver requirements 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" Document the feature an image sensor driver has to provide to be fully libcamera-compliant. Reviewed-by: Laurent Pinchart Reviewed-by: Niklas Söderlund Signed-off-by: Jacopo Mondi Reviewed-by: Kieran Bingham --- Documentation/index.rst | 1 + Documentation/meson.build | 1 + Documentation/sensor_driver_requirements.rst | 64 ++++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 Documentation/sensor_driver_requirements.rst diff --git a/Documentation/index.rst b/Documentation/index.rst index c49db18d52bd..285ca7c3e5ae 100644 --- a/Documentation/index.rst +++ b/Documentation/index.rst @@ -18,3 +18,4 @@ Pipeline Handler Writer's Guide Tracing guide Environment variables + Sensor driver requirements diff --git a/Documentation/meson.build b/Documentation/meson.build index b1f5bb52474c..9950465ded6e 100644 --- a/Documentation/meson.build +++ b/Documentation/meson.build @@ -57,6 +57,7 @@ if sphinx.found() 'guides/pipeline-handler.rst', 'guides/tracing.rst', 'index.rst', + 'sensor_driver_requirements.rst', '../README.rst', ] diff --git a/Documentation/sensor_driver_requirements.rst b/Documentation/sensor_driver_requirements.rst new file mode 100644 index 000000000000..0e658aaa03b5 --- /dev/null +++ b/Documentation/sensor_driver_requirements.rst @@ -0,0 +1,64 @@ +.. SPDX-License-Identifier: CC-BY-SA-4.0 + +.. _sensor-driver-requirements: + +Sensor Driver Requirements +========================== + +libcamera handles imaging devices in the CameraSensor class and defines +through its API a consistent interface towards other library components. + +The CameraSensor class uses the V4L2 subdev kernel API to interface with the +camera sensor through one or multiple sub-devices exposed in userspace by +the sensor driver. + +In order for libcamera to be fully operational and provide to applications and +pipeline handlers all the required information to interface with the camera +sensor, a set of mandatory and optional features the driver has to support +has been defined. + +Mandatory Requirements +---------------------- + +The sensor driver is assumed to be fully compliant with the V4L2 specification. + +The sensor driver shall support the following V4L2 controls: + +* `V4L2_CID_HBLANK`_ +* `V4L2_CID_PIXEL_RATE`_ + +.. _V4L2_CID_HBLANK: https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/ext-ctrls-image-source.html +.. _V4L2_CID_PIXEL_RATE: https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/ext-ctrls-image-process.html + +Both controls are used to compute the sensor output timings. + +Optional Requirements +--------------------- + +The sensor driver should support the following V4L2 controls: + +* `V4L2_CID_CAMERA_ORIENTATION`_ +* `V4L2_CID_CAMERA_SENSOR_ROTATION`_ + +.. _V4L2_CID_CAMERA_ORIENTATION: https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/ext-ctrls-camera.html +.. _V4L2_CID_CAMERA_SENSOR_ROTATION: https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/ext-ctrls-image-process.html + +The controls are used to register the camera location and orientation. + +The sensor driver should implement support for the V4L2 Selection API, +specifically it should implement support for the +`VIDIOC_SUBDEV_G_SELECTION`_ ioctl with support for the following selection +targets: + +.. _VIDIOC_SUBDEV_G_SELECTION: https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/vidioc-subdev-g-selection.html?highlight=g_selection#c.V4L.VIDIOC_SUBDEV_G_SELECTION + +* `V4L2_SEL_TGT_CROP_BOUNDS`_ to report the readable pixel array area size +* `V4L2_SEL_TGT_CROP_DEFAULT`_ to report the active pixel array area size +* `V4L2_SEL_TGT_CROP`_ to report the analogue selection rectangle + +Support for the selection API is scheduled to become a mandatory feature in +the near future. + +.. _V4L2_SEL_TGT_CROP_BOUNDS: https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/v4l2-selection-targets.html +.. _V4L2_SEL_TGT_CROP_DEFAULT: https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/v4l2-selection-targets.html +.. _V4L2_SEL_TGT_CROP: https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/v4l2-selection-targets.html From patchwork Fri Jan 15 17:00:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10865 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 8EA0CC3383 for ; Fri, 15 Jan 2021 17:00:22 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 42BF568102; Fri, 15 Jan 2021 18:00:22 +0100 (CET) Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0AF3D680EE for ; Fri, 15 Jan 2021 18:00:19 +0100 (CET) X-Originating-IP: 93.34.118.233 Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id ADB82240004 for ; Fri, 15 Jan 2021 17:00:18 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Fri, 15 Jan 2021 18:00:25 +0100 Message-Id: <20210115170033.27124-3-jacopo@jmondi.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210115170033.27124-1-jacopo@jmondi.org> References: <20210115170033.27124-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v7 02/10] libcamera: camera_sensor: Validate driver support 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" The CameraSensor class requires the sensor driver to report information through V4L2 controls and through the V4L2 selection API, and uses that information to register Camera properties and to construct CameraSensorInfo class instances to provide them to the IPA. Currently, validation of the kernel support happens each time a feature is requested, with slighly similar debug/error messages output to the user in case a feature is not supported. Rationalize this by validating the sensor driver requirements in a single function Reviewed-by: Niklas Söderlund Reviewed-by: Laurent Pinchart Reviewed-by: Paul Elder Signed-off-by: Jacopo Mondi --- include/libcamera/internal/camera_sensor.h | 1 + src/libcamera/camera_sensor.cpp | 84 ++++++++++++++++++++++ 2 files changed, 85 insertions(+) diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h index f80d836161a5..aee10aa6e3c7 100644 --- a/include/libcamera/internal/camera_sensor.h +++ b/include/libcamera/internal/camera_sensor.h @@ -69,6 +69,7 @@ protected: private: int generateId(); + int validateSensorDriver(); int initProperties(); const MediaEntity *entity_; diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp index e786821d4ba2..048fcd6a1fae 100644 --- a/src/libcamera/camera_sensor.cpp +++ b/src/libcamera/camera_sensor.cpp @@ -207,6 +207,10 @@ int CameraSensor::init() */ resolution_ = sizes_.back(); + ret = validateSensorDriver(); + if (ret) + return ret; + ret = initProperties(); if (ret) return ret; @@ -214,6 +218,86 @@ int CameraSensor::init() return 0; } +int CameraSensor::validateSensorDriver() +{ + /* + * Make sure the sensor driver supports the mandatory controls + * required by the CameraSensor class. + * - V4L2_CID_PIXEL_RATE is used to calculate the sensor timings + * - V4L2_CID_HBLANK is used to calculate the line length + */ + const std::vector mandatoryControls{ + V4L2_CID_PIXEL_RATE, + V4L2_CID_HBLANK, + }; + + ControlList ctrls = subdev_->getControls(mandatoryControls); + if (ctrls.empty()) { + LOG(CameraSensor, Error) + << "Mandatory V4L2 controls not available"; + LOG(CameraSensor, Error) + << "The sensor kernel driver needs to be fixed"; + LOG(CameraSensor, Error) + << "See Documentation/sensor_driver_requirements.rst in the libcamera sources for more information"; + return -EINVAL; + } + + /* + * Optional controls are used to register optional sensor properties. If + * not present, some values will be defaulted. + */ + const std::vector optionalControls{ + V4L2_CID_CAMERA_ORIENTATION, + V4L2_CID_CAMERA_SENSOR_ROTATION, + }; + + ctrls = subdev_->getControls(optionalControls); + if (ctrls.empty()) + LOG(CameraSensor, Debug) << "Optional V4L2 controls not supported"; + + /* + * Make sure the required selection targets are supported. + * + * Failures in reading any of the targets are not deemed to be fatal, + * but some properties and features, like constructing a + * CameraSensorInfo for the IPA module, won't be supported. + * + * \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) { + LOG(CameraSensor, Warning) + << "Failed to retrieve the readable pixel array size"; + err = -EINVAL; + } + + ret = subdev_->getSelection(pad_, V4L2_SEL_TGT_CROP_DEFAULT, &rect); + if (ret) { + LOG(CameraSensor, Warning) + << "Failed to retrieve the active pixel array size"; + err = -EINVAL; + } + + ret = subdev_->getSelection(pad_, V4L2_SEL_TGT_CROP, &rect); + if (ret) { + LOG(CameraSensor, Warning) + << "Failed to retrieve the sensor crop rectangle"; + err = -EINVAL; + } + + if (err) { + LOG(CameraSensor, Warning) + << "The sensor kernel driver needs to be fixed"; + LOG(CameraSensor, Warning) + << "See Documentation/sensor_driver_requirements.rst in the libcamera sources for more information"; + } + + return 0; +} + int CameraSensor::initProperties() { /* From patchwork Fri Jan 15 17:00:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10866 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 5A9DAC3383 for ; Fri, 15 Jan 2021 17:00:23 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 6B9A268107; Fri, 15 Jan 2021 18:00:22 +0100 (CET) Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3F95F680F5 for ; Fri, 15 Jan 2021 18:00:19 +0100 (CET) X-Originating-IP: 93.34.118.233 Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 0D811240011 for ; Fri, 15 Jan 2021 17:00:18 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Fri, 15 Jan 2021 18:00:26 +0100 Message-Id: <20210115170033.27124-4-jacopo@jmondi.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210115170033.27124-1-jacopo@jmondi.org> References: <20210115170033.27124-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v7 03/10] libcamera: camera_sensor: Provide fall-back for sensor properties 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" Support for the V4L2 selection API is currently optional in the CameraSensor class. Properties registered by using values read through that API are defaulted in several different places (the Android camera HAL or the CameraSensor class). In the future support for the selection API will be made mandatory, but to give time to sensor drivers in all test platforms to be updated, use sensor resolution as fallback values for sensor pixel array properties and cache them as class member variables. Reviewed-by: Laurent Pinchart Reviewed-by: Niklas Söderlund Signed-off-by: Jacopo Mondi --- include/libcamera/internal/camera_sensor.h | 3 ++ src/libcamera/camera_sensor.cpp | 57 ++++++++-------------- 2 files changed, 24 insertions(+), 36 deletions(-) diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h index aee10aa6e3c7..86902b85ada8 100644 --- a/include/libcamera/internal/camera_sensor.h +++ b/include/libcamera/internal/camera_sensor.h @@ -84,6 +84,9 @@ private: std::vector mbusCodes_; std::vector sizes_; + Size pixelArraySize_; + Rectangle activeArea_; + ControlList properties_; }; diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp index 048fcd6a1fae..0c9bd4f50cff 100644 --- a/src/libcamera/camera_sensor.cpp +++ b/src/libcamera/camera_sensor.cpp @@ -269,15 +269,21 @@ int CameraSensor::validateSensorDriver() Rectangle rect; int ret = subdev_->getSelection(pad_, V4L2_SEL_TGT_CROP_BOUNDS, &rect); if (ret) { + rect = Rectangle(resolution()); LOG(CameraSensor, Warning) - << "Failed to retrieve the readable pixel array size"; + << "The PixelArraySize property has been defaulted to " + << rect.toString(); err = -EINVAL; } + pixelArraySize_.width = rect.width; + pixelArraySize_.height = rect.height; - ret = subdev_->getSelection(pad_, V4L2_SEL_TGT_CROP_DEFAULT, &rect); + ret = subdev_->getSelection(pad_, V4L2_SEL_TGT_CROP_DEFAULT, &activeArea_); if (ret) { + activeArea_ = Rectangle(pixelArraySize_); LOG(CameraSensor, Warning) - << "Failed to retrieve the active pixel array size"; + << "The PixelArrayActiveAreas property has been defaulted to " + << activeArea_.toString(); err = -EINVAL; } @@ -373,24 +379,8 @@ int CameraSensor::initProperties() propertyValue = 0; properties_.set(properties::Rotation, propertyValue); - Rectangle bounds; - ret = subdev_->getSelection(pad_, V4L2_SEL_TGT_CROP_BOUNDS, &bounds); - if (!ret) - properties_.set(properties::PixelArraySize, bounds.size()); - - Rectangle crop; - ret = subdev_->getSelection(pad_, V4L2_SEL_TGT_CROP_DEFAULT, &crop); - if (!ret) { - /* - * V4L2_SEL_TGT_CROP_DEFAULT and V4L2_SEL_TGT_CROP_BOUNDS are - * defined relatively to the sensor full pixel array size, - * while properties::PixelArrayActiveAreas is defined relatively - * to properties::PixelArraySize. Adjust it. - */ - crop.x -= bounds.x; - crop.y -= bounds.y; - properties_.set(properties::PixelArrayActiveAreas, { crop }); - } + properties_.set(properties::PixelArraySize, pixelArraySize_); + properties_.set(properties::PixelArrayActiveAreas, { activeArea_ }); /* Color filter array pattern, register only for RAW sensors. */ for (const auto &format : formats_) { @@ -646,20 +636,15 @@ int CameraSensor::sensorInfo(CameraSensorInfo *info) const { info->model = model(); - /* Get the active area size. */ - Rectangle rect; - int ret = subdev_->getSelection(pad_, V4L2_SEL_TGT_CROP_DEFAULT, &rect); - if (ret) { - LOG(CameraSensor, Error) - << "Failed to construct camera sensor info: " - << "the camera sensor does not report the active area"; - - return ret; - } - info->activeAreaSize = { rect.width, rect.height }; + /* + * The active area size is a static property, while the crop + * rectangle needs to be re-read as it depends on the sensor + * configuration. + */ + info->activeAreaSize = { activeArea_.width, activeArea_.height }; /* It's mandatory for the subdevice to report its crop rectangle. */ - ret = subdev_->getSelection(pad_, V4L2_SEL_TGT_CROP, &info->analogCrop); + int ret = subdev_->getSelection(pad_, V4L2_SEL_TGT_CROP, &info->analogCrop); if (ret) { LOG(CameraSensor, Error) << "Failed to construct camera sensor info: " @@ -672,10 +657,10 @@ int CameraSensor::sensorInfo(CameraSensorInfo *info) const * are defined relatively to the active pixel area, while V4L2's * TGT_CROP target is defined in respect to the full pixel array. * - * Compensate it by subtracting the active areas offset. + * Compensate it by subtracting the active area offset. */ - info->analogCrop.x -= rect.x; - info->analogCrop.y -= rect.y; + info->analogCrop.x -= activeArea_.x; + info->analogCrop.y -= activeArea_.y; /* The bit depth and image size depend on the currently applied format. */ V4L2SubdeviceFormat format{}; From patchwork Fri Jan 15 17:00:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10867 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 C8E67C3383 for ; Fri, 15 Jan 2021 17:00:24 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A6B1A680FE; Fri, 15 Jan 2021 18:00:24 +0100 (CET) Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 906B8680ED for ; Fri, 15 Jan 2021 18:00:19 +0100 (CET) X-Originating-IP: 93.34.118.233 Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 61CB524000A for ; Fri, 15 Jan 2021 17:00:19 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Fri, 15 Jan 2021 18:00:27 +0100 Message-Id: <20210115170033.27124-5-jacopo@jmondi.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210115170033.27124-1-jacopo@jmondi.org> References: <20210115170033.27124-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v7 04/10] libcamera: camera_sensor: Default analogue crop rectangle 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" As support for the V4L2_SEL_TGT_CROP selection target used to read the sensor analogue crop rectangle is schedule to become mandatory but is still optional, use the sensor's active area size as fallback value to allow the creation of the CameraSensorInfo in the case the driver does not support it. Reviewed-by: Niklas Söderlund Reviewed-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- src/libcamera/camera_sensor.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp index 0c9bd4f50cff..e8caa4467643 100644 --- a/src/libcamera/camera_sensor.cpp +++ b/src/libcamera/camera_sensor.cpp @@ -643,13 +643,16 @@ int CameraSensor::sensorInfo(CameraSensorInfo *info) const */ info->activeAreaSize = { activeArea_.width, activeArea_.height }; - /* It's mandatory for the subdevice to report its crop rectangle. */ + /* + * \todo Support for retreiving the crop rectangle is scheduled to + * become mandatory. For the time being use the default value if it has + * been initialized at sensor driver validation time. + */ int ret = subdev_->getSelection(pad_, V4L2_SEL_TGT_CROP, &info->analogCrop); if (ret) { + info->analogCrop = activeArea_; LOG(CameraSensor, Error) - << "Failed to construct camera sensor info: " - << "the camera sensor does not report the crop rectangle"; - return ret; + << "The analogue crop rectangle has been defaulted to the active area size"; } /* From patchwork Fri Jan 15 17:00:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10868 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 2AE15C3384 for ; Fri, 15 Jan 2021 17:00:25 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id CFBCD68112; Fri, 15 Jan 2021 18:00:24 +0100 (CET) Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E43C4680D1 for ; Fri, 15 Jan 2021 18:00:19 +0100 (CET) X-Originating-IP: 93.34.118.233 Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id B46CE24001A for ; Fri, 15 Jan 2021 17:00:19 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Fri, 15 Jan 2021 18:00:28 +0100 Message-Id: <20210115170033.27124-6-jacopo@jmondi.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210115170033.27124-1-jacopo@jmondi.org> References: <20210115170033.27124-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v7 05/10] 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: Niklas Söderlund Reviewed-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- 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 e8caa4467643..71aa268f3b4f 100644 --- a/src/libcamera/camera_sensor.cpp +++ b/src/libcamera/camera_sensor.cpp @@ -345,7 +345,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(); @@ -354,20 +353,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); From patchwork Fri Jan 15 17:00:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10869 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 7D0EDC3383 for ; Fri, 15 Jan 2021 17:00:25 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id F12D368115; Fri, 15 Jan 2021 18:00:24 +0100 (CET) Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4888B680F7 for ; Fri, 15 Jan 2021 18:00:20 +0100 (CET) X-Originating-IP: 93.34.118.233 Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 173DE240015 for ; Fri, 15 Jan 2021 17:00:19 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Fri, 15 Jan 2021 18:00:29 +0100 Message-Id: <20210115170033.27124-7-jacopo@jmondi.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210115170033.27124-1-jacopo@jmondi.org> References: <20210115170033.27124-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v7 06/10] libcamera: camera_sensor: Do not default 'rotation' 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" The 'rotation' property is not critical. Only register it if the sensor driver reports it. Reviewed-by: Niklas Söderlund Reviewed-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- src/libcamera/camera_sensor.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp index 71aa268f3b4f..e9c80c304dd4 100644 --- a/src/libcamera/camera_sensor.cpp +++ b/src/libcamera/camera_sensor.cpp @@ -370,13 +370,11 @@ int CameraSensor::initProperties() } properties_.set(properties::Location, propertyValue); - /* Camera Rotation: default is 0 degrees. */ const auto &rotationControl = controls.find(V4L2_CID_CAMERA_SENSOR_ROTATION); - if (rotationControl != controls.end()) + if (rotationControl != controls.end()) { propertyValue = rotationControl->second.def().get(); - else - propertyValue = 0; - properties_.set(properties::Rotation, propertyValue); + properties_.set(properties::Rotation, propertyValue); + } properties_.set(properties::PixelArraySize, pixelArraySize_); properties_.set(properties::PixelArrayActiveAreas, { activeArea_ }); From patchwork Fri Jan 15 17:00:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10870 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 223D7C3383 for ; Fri, 15 Jan 2021 17:00:26 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4D07368117; Fri, 15 Jan 2021 18:00:25 +0100 (CET) Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9FBC6680F6 for ; Fri, 15 Jan 2021 18:00:20 +0100 (CET) X-Originating-IP: 93.34.118.233 Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 6C638240011 for ; Fri, 15 Jan 2021 17:00:20 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Fri, 15 Jan 2021 18:00:30 +0100 Message-Id: <20210115170033.27124-8-jacopo@jmondi.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210115170033.27124-1-jacopo@jmondi.org> References: <20210115170033.27124-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v7 07/10] libcamera: uvc: Initialize the pixel array properties 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" Initialize the pixel array properties in the UVC pipeline handler as they're now initialized in the CameraSensor class, which the UVC pipeline handler does not use. Reviewed-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp index 7cb310e20511..08a594175091 100644 --- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp +++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp @@ -509,6 +509,22 @@ int UVCCameraData::init(MediaDevice *media) properties_.set(properties::Location, properties::CameraLocationExternal); properties_.set(properties::Model, utils::toAscii(media->model())); + /* + * Get the current format in order to initialize the sensor array + * properties. + */ + Size resolution; + for (const auto &it : video_->formats()) { + const std::vector &sizeRanges = it.second; + for (const SizeRange &sizeRange : sizeRanges) { + if (sizeRange.max > resolution) + resolution = sizeRange.max; + } + } + + properties_.set(properties::PixelArraySize, resolution); + properties_.set(properties::PixelArrayActiveAreas, { Rectangle(resolution) }); + /* Initialise the supported controls. */ ControlInfoMap::Map ctrls; From patchwork Fri Jan 15 17:00:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10871 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 80AE7C3384 for ; Fri, 15 Jan 2021 17:00:26 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 764EF6811A; Fri, 15 Jan 2021 18:00:25 +0100 (CET) Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id EF1BE680FD for ; Fri, 15 Jan 2021 18:00:20 +0100 (CET) X-Originating-IP: 93.34.118.233 Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id BF9F1240015 for ; Fri, 15 Jan 2021 17:00:20 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Fri, 15 Jan 2021 18:00:31 +0100 Message-Id: <20210115170033.27124-9-jacopo@jmondi.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210115170033.27124-1-jacopo@jmondi.org> References: <20210115170033.27124-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v7 08/10] libcamera: media_object: Add a const version of dev() 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" Add a const version of the MediaObject::dev() method to be able to retrieve a pointer to a const MediaDevice from a constant instance of a MediaObject sub-class. Reviewed-by: Niklas Söderlund Reviewed-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- include/libcamera/internal/media_object.h | 1 + src/libcamera/media_object.cpp | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/include/libcamera/internal/media_object.h b/include/libcamera/internal/media_object.h index 43a35bef8f35..2b336961f98d 100644 --- a/include/libcamera/internal/media_object.h +++ b/include/libcamera/internal/media_object.h @@ -22,6 +22,7 @@ class MediaObject { public: MediaDevice *device() { return dev_; } + const MediaDevice *device() const { return dev_; } unsigned int id() const { return id_; } protected: diff --git a/src/libcamera/media_object.cpp b/src/libcamera/media_object.cpp index 056036635902..94aeb50402ca 100644 --- a/src/libcamera/media_object.cpp +++ b/src/libcamera/media_object.cpp @@ -67,6 +67,11 @@ LOG_DECLARE_CATEGORY(MediaDevice) /** * \fn MediaObject::device() + * \copydoc MediaObject::device() const + */ + +/** + * \fn MediaObject::device() const * \brief Retrieve the media device the media object belongs to * \return The MediaDevice */ From patchwork Fri Jan 15 17:00:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10872 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 C9164C3383 for ; Fri, 15 Jan 2021 17:00:26 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1883E68102; Fri, 15 Jan 2021 18:00:26 +0100 (CET) Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4CF8D680FE for ; Fri, 15 Jan 2021 18:00:21 +0100 (CET) X-Originating-IP: 93.34.118.233 Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 1AB95240004 for ; Fri, 15 Jan 2021 17:00:20 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Fri, 15 Jan 2021 18:00:32 +0100 Message-Id: <20210115170033.27124-10-jacopo@jmondi.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210115170033.27124-1-jacopo@jmondi.org> References: <20210115170033.27124-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v7 09/10] libcamera: camera_sensor: Initialize VIMC properties 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" The VIMC driver does not yet support all the features required for all sensor drivers. As it is the main testing platforms and the driver changes might take a long time to land in the developments and testing platforms, temporary close the gap by skipping driver validation and initializing properties with static information such as the sensor resolution. Reviewed-by: Niklas Söderlund Reviewed-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- include/libcamera/internal/camera_sensor.h | 1 + src/libcamera/camera_sensor.cpp | 26 ++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h index 86902b85ada8..fed36bf26e47 100644 --- a/include/libcamera/internal/camera_sensor.h +++ b/include/libcamera/internal/camera_sensor.h @@ -70,6 +70,7 @@ protected: private: int generateId(); int validateSensorDriver(); + void initVimcDefaultProperties(); int initProperties(); const MediaEntity *entity_; diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp index e9c80c304dd4..251691aedfa3 100644 --- a/src/libcamera/camera_sensor.cpp +++ b/src/libcamera/camera_sensor.cpp @@ -6,6 +6,7 @@ */ #include "libcamera/internal/camera_sensor.h" +#include "libcamera/internal/media_device.h" #include #include @@ -207,6 +208,21 @@ int CameraSensor::init() */ resolution_ = sizes_.back(); + /* + * VIMC is a bit special, as it does not yet support all the mandatory + * requirements regular sensors have to respect. + * + * Do not validate the driver if it's VIMC and initialize the sensor + * properties with static information. + * + * \todo Remove the special case once the VIMC driver has been + * updated in all test platforms. + */ + if (entity_->device()->driver() == "vimc") { + initVimcDefaultProperties(); + return initProperties(); + } + ret = validateSensorDriver(); if (ret) return ret; @@ -304,6 +320,16 @@ int CameraSensor::validateSensorDriver() return 0; } +/* + * \brief Initialize properties that cannot be intialized by the + * regular initProperties() function for VIMC + */ +void CameraSensor::initVimcDefaultProperties() +{ + pixelArraySize_ = resolution(); + activeArea_ = Rectangle(pixelArraySize_); +} + int CameraSensor::initProperties() { /* From patchwork Fri Jan 15 17:00:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10873 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 1F61FC3384 for ; Fri, 15 Jan 2021 17:00:27 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A7056680EF; Fri, 15 Jan 2021 18:00:26 +0100 (CET) Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id AD9FA680EE for ; Fri, 15 Jan 2021 18:00:21 +0100 (CET) X-Originating-IP: 93.34.118.233 Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 77EEC240014 for ; Fri, 15 Jan 2021 17:00:21 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Fri, 15 Jan 2021 18:00:33 +0100 Message-Id: <20210115170033.27124-11-jacopo@jmondi.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210115170033.27124-1-jacopo@jmondi.org> References: <20210115170033.27124-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v7 10/10] android: camera_device: Do not default pixel array properties 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" Now that the pixel array properties have been defaulted in the CameraSensor class (or in the pipeline handler, for the UVC use case), they will always be reported by the libcamera::Camera and there's no need to default them in the Camera HAL. Remove defaults and assume properties are always there. Reviewed-by: Niklas Söderlund Reviewed-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- src/android/camera_device.cpp | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index 23be2a593a2a..a136f8e33843 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -851,7 +851,7 @@ const camera_metadata_t *CameraDevice::getStaticMetadata() staticMetadata_->addEntry(ANDROID_JPEG_MAX_SIZE, &maxJpegBufferSize_, 1); /* Sensor static metadata. */ - if (properties.contains(properties::PixelArraySize)) { + { const Size &size = properties.get(properties::PixelArraySize); std::vector data{ @@ -860,17 +860,9 @@ const camera_metadata_t *CameraDevice::getStaticMetadata() }; staticMetadata_->addEntry(ANDROID_SENSOR_INFO_PIXEL_ARRAY_SIZE, data.data(), data.size()); - } else { - /* - * \todo Drop the default once the ov5670 and ov13858 drivers - * are updated to report the pixel array size. - */ - int32_t data[] = { 2592, 1944 }; - staticMetadata_->addEntry(ANDROID_SENSOR_INFO_PIXEL_ARRAY_SIZE, - data, 2); } - if (properties.contains(properties::PixelArrayActiveAreas)) { + { const Span &rects = properties.get(properties::PixelArrayActiveAreas); std::vector data{ @@ -881,14 +873,6 @@ const camera_metadata_t *CameraDevice::getStaticMetadata() }; staticMetadata_->addEntry(ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE, data.data(), data.size()); - } else { - /* - * \todo Drop the default once the ov5670 and ov13858 drivers - * are updated to report the pixel array size. - */ - int32_t data[] = { 0, 0, 2560, 1920 }; - staticMetadata_->addEntry(ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE, - data, 4); } int32_t sensitivityRange[] = {