Show a patch.

GET /api/1.1/patches/16186/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 16186,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/16186/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/16186/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api",
        "name": "libcamera",
        "link_name": "libcamera",
        "list_id": "libcamera_core",
        "list_email": "libcamera-devel@lists.libcamera.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20220609060306.57953-4-jeanmichel.hautbois@ideasonboard.com>",
    "date": "2022-06-09T06:03:05",
    "name": "[libcamera-devel,RFC,3/4] libcamera: lens: Add a helper to get the fixed range lens values",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "d2aa68ae4e80428177386880c4101537351bb90f",
    "submitter": {
        "id": 75,
        "url": "https://patchwork.libcamera.org/api/1.1/people/75/?format=api",
        "name": "Jean-Michel Hautbois",
        "email": "jeanmichel.hautbois@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/16186/mbox/",
    "series": [
        {
            "id": 3166,
            "url": "https://patchwork.libcamera.org/api/1.1/series/3166/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3166",
            "date": "2022-06-09T06:03:02",
            "name": "Introduce camera lens properties",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/3166/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/16186/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/16186/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 0003DC3274\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  9 Jun 2022 06:03:19 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3257C65640;\n\tThu,  9 Jun 2022 08:03:17 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9A1E265635\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  9 Jun 2022 08:03:13 +0200 (CEST)",
            "from tatooine.ideasonboard.com (unknown\n\t[IPv6:2a01:e0a:169:7140:ae94:9dc3:50ea:aee6])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 5FB1C9B1;\n\tThu,  9 Jun 2022 08:03:13 +0200 (CEST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1654754597;\n\tbh=2HzTEAjgjllaAMAH5YbUX47ROk1ATiZreLc76dBGlyc=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=L7m2SZE4bdKbNMqt8q261vSOKo4rNkr1jnM0Xx5sPSENNKjRNKcZiBxODPFcD+LNi\n\tByGPw81pAfyQldscw3uucOF+Ue1195ZTlnR74/ZEuLAqoYow7I5tG5DWKdZfaMn8eF\n\tyDb1pb5yBoE9WZHSWnhfBVlChxKuzZsTltRRBIYZX2ZEWKvYMeZtVkBvzdLNEKkk62\n\t6gYzXg7Io8JnHSsuTXDjOz/oJUxV1E8t/0FzqvqGopEFnCFCXQ07akFqlmNdQsf0km\n\t2Ev6gCF+I8t4Nvq87FbV3QQiVcAyKs2miaRiH9fHB7hEhgpPMO9WElkL0MNcS76U9F\n\tUxAs3+ErzxPZA==",
            "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1654754593;\n\tbh=2HzTEAjgjllaAMAH5YbUX47ROk1ATiZreLc76dBGlyc=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=pLVLcvc2/Pv4lR0iH3+pMO/0WRcaVlJAC98LKMdFd9oOyxDrSEHjKpnYLPjc5EjBw\n\tTbJTUPz6eIIfH2yl8cogmJLC3VJ+RDX3p+St9gMitkAbf9AlT7vLVMkUNkwPbh9A/+\n\tAFL9An/4u9nKAIKaFzQH2KfV8O+25DYQaJVrbisQ="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"pLVLcvc2\"; dkim-atps=neutral",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu,  9 Jun 2022 08:03:05 +0200",
        "Message-Id": "<20220609060306.57953-4-jeanmichel.hautbois@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20220609060306.57953-1-jeanmichel.hautbois@ideasonboard.com>",
        "References": "<20220609060306.57953-1-jeanmichel.hautbois@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [RFC PATCH 3/4] libcamera: lens: Add a helper to\n\tget the fixed range lens values",
        "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>",
        "From": "Jean-Michel Hautbois via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "When the focus algorithm runs, it can be asked to go to a specific\nposition, through the controls::LensPosition control. Those controls\nneed specific values to be known, in particular the minimum and maximum\nvalue the driver can set to the lens to make it move to a given\nposition.\n\nAdd a new helper on the camera lens side to get this range or a default\nnulled structure if it is not available. This particular value needs to\nbe taken into account by the caller and it shall use the minimum and\nmaximum reported by the driver.\n\nSigned-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n---\n include/libcamera/internal/camera_lens.h      |  1 +\n .../internal/camera_lens_properties.h         |  2 ++\n src/libcamera/camera_lens.cpp                 | 19 +++++++++++++++++++\n src/libcamera/camera_lens_properties.cpp      |  9 ++++++++-\n 4 files changed, 30 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/include/libcamera/internal/camera_lens.h b/include/libcamera/internal/camera_lens.h\nindex 523a1481..f6daff01 100644\n--- a/include/libcamera/internal/camera_lens.h\n+++ b/include/libcamera/internal/camera_lens.h\n@@ -29,6 +29,7 @@ public:\n \n \tint init();\n \tint setFocusPosition(int32_t position);\n+\tconst Size &getLensRange();\n \n \tconst std::string &model() const { return model_; }\n \ndiff --git a/include/libcamera/internal/camera_lens_properties.h b/include/libcamera/internal/camera_lens_properties.h\nindex 73982550..7424b375 100644\n--- a/include/libcamera/internal/camera_lens_properties.h\n+++ b/include/libcamera/internal/camera_lens_properties.h\n@@ -17,6 +17,8 @@ namespace libcamera {\n \n struct CameraLensProperties {\n \tstatic const CameraLensProperties *get(const std::string &lens);\n+\n+\tSize lensFocusRange;\n };\n \n } /* namespace libcamera */\ndiff --git a/src/libcamera/camera_lens.cpp b/src/libcamera/camera_lens.cpp\nindex d4d44bc7..abec5a27 100644\n--- a/src/libcamera/camera_lens.cpp\n+++ b/src/libcamera/camera_lens.cpp\n@@ -79,6 +79,25 @@ int CameraLens::init()\n \treturn 0;\n }\n \n+/**\n+ * \\brief Retrieve the lens position range\n+ * \\return The minimum and maximum positions for the given lens or a default\n+ * nulled Size reference\n+ *\n+ * If a lens has no static properties associated, a special value is returned,\n+ * where the minimum and maximum are set to 0. The caller may then chose the\n+ * ones returned by the V4L2_CID_FOCUS_ABSOLUTE call.\n+ */\n+const Size &CameraLens::getLensRange()\n+{\n+\tstatic const Size defaultLensFocusRange = { 0, 0 };\n+\tif (!staticProps_ || staticProps_->lensFocusRange.isNull())\n+\t\treturn defaultLensFocusRange;\n+\n+\treturn staticProps_->lensFocusRange;\n+}\n+\n+\n /**\n  * \\brief This function sets the focal point of the lens to a specific position.\n  * \\param[in] position The focal point of the lens\ndiff --git a/src/libcamera/camera_lens_properties.cpp b/src/libcamera/camera_lens_properties.cpp\nindex dee73b43..225546ae 100644\n--- a/src/libcamera/camera_lens_properties.cpp\n+++ b/src/libcamera/camera_lens_properties.cpp\n@@ -32,6 +32,9 @@ LOG_DEFINE_CATEGORY(CameraLensProperties)\n /**\n  * \\struct CameraLensProperties\n  * \\brief Database of camera lens properties\n+ *\n+ * \\var CameraLensProperties::lensFocusRange\n+ * \\brief The limits for the sensor position, stored as a min and a max.\n  */\n \n /**\n@@ -42,7 +45,11 @@ LOG_DEFINE_CATEGORY(CameraLensProperties)\n  */\n const CameraLensProperties *CameraLensProperties::get(const std::string &lens)\n {\n-\tstatic const std::map<std::string, const CameraLensProperties> lensProps = {};\n+\tstatic const std::map<std::string, const CameraLensProperties> lensProps = {\n+\t\t{ \"dw9714\", {\n+\t\t\t\t.lensFocusRange = { 150, 800 },\n+\t\t} },\n+\t};\n \n \tconst auto it = lensProps.find(lens);\n \tif (it == lensProps.end()) {\n",
    "prefixes": [
        "libcamera-devel",
        "RFC",
        "3/4"
    ]
}