Show a patch.

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

{
    "id": 16480,
    "url": "https://patchwork.libcamera.org/api/patches/16480/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/16480/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/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": "<20220630133902.321099-23-jacopo@jmondi.org>",
    "date": "2022-06-30T13:39:01",
    "name": "[libcamera-devel,v3,22/23] libcamera: camera_lens: Expose libcamera control limits",
    "commit_ref": null,
    "pull_url": null,
    "state": "not-applicable",
    "archived": true,
    "hash": "fba6440381b7cb5c1a2a24baa1d085a885a6e794",
    "submitter": {
        "id": 3,
        "url": "https://patchwork.libcamera.org/api/people/3/?format=api",
        "name": "Jacopo Mondi",
        "email": "jacopo@jmondi.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/16480/mbox/",
    "series": [
        {
            "id": 3238,
            "url": "https://patchwork.libcamera.org/api/series/3238/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3238",
            "date": "2022-06-30T13:38:39",
            "name": "Internal controls, sensor delays and IPA rework",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/3238/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/16480/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/16480/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 A3605C3274\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 30 Jun 2022 13:39:59 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5A75F656B7;\n\tThu, 30 Jun 2022 15:39:59 +0200 (CEST)",
            "from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net\n\t[IPv6:2001:4b98:dc4:8::221])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 17879656A7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 30 Jun 2022 15:39:53 +0200 (CEST)",
            "(Authenticated sender: jacopo@jmondi.org)\n\tby mail.gandi.net (Postfix) with ESMTPSA id 7D859240005;\n\tThu, 30 Jun 2022 13:39:50 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1656596399;\n\tbh=ppR811V+Kq0f8c46mGFUwZj89Mn6DI0vaywGAE1speA=;\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=T0l+oC+Cr683r1bwG3ftUIZFu3tghf6KOUxJaGWICt8aDeZ+A8UmRKT2gd0Zq7fMA\n\t3o1GtWVeuI5RcEyAPWzthj1jKERA+1VH5nhV4byZcHfzEdxzkNFwuO7c+tBAZWS+6m\n\tWik+L4w/qKIYsxo1g5jl7UzsuGxWDslLy1OXw288Rf7fwNRHRfY2UlqPwDknsh0wb3\n\tIEj5q6THzVlVcpRocm65F6Ubxc5NIAxfol9JAb3WG2X4Eft4DnhIdUThXFXt4lBXZG\n\tMoABI+J9pLii5m7K2F9SbmybEQfVfDejQmC7Vs8fMghAL2wR3Wqiqj+CSBhJNSrcw/\n\tsJo8BB6pWlPTA==",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu, 30 Jun 2022 15:39:01 +0200",
        "Message-Id": "<20220630133902.321099-23-jacopo@jmondi.org>",
        "X-Mailer": "git-send-email 2.36.1",
        "In-Reply-To": "<20220630133902.321099-1-jacopo@jmondi.org>",
        "References": "<20220630133902.321099-1-jacopo@jmondi.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v3 22/23] libcamera: camera_lens: Expose\n\tlibcamera control limits",
        "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": "Jacopo Mondi via libcamera-devel <libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Jacopo Mondi <jacopo@jmondi.org>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "The CameraLens class exposes the list of V4L2 controls through\nthe CameraLens::controls() function.\n\nModify the implementation to expose the newly introduced\nLensFocusAbsolute control limits.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n include/libcamera/internal/camera_lens.h |  5 +++-\n src/libcamera/camera_lens.cpp            | 33 ++++++++++++++++++------\n 2 files changed, 29 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/include/libcamera/internal/camera_lens.h b/include/libcamera/internal/camera_lens.h\nindex 277417daffed..ea98379ecc62 100644\n--- a/include/libcamera/internal/camera_lens.h\n+++ b/include/libcamera/internal/camera_lens.h\n@@ -30,7 +30,7 @@ public:\n \n \tconst std::string &model() const { return model_; }\n \n-\tconst ControlInfoMap &controls() const;\n+\tconst ControlInfoMap &controls() const { return controls_; }\n \n protected:\n \tstd::string logPrefix() const override;\n@@ -39,11 +39,14 @@ private:\n \tLIBCAMERA_DISABLE_COPY_AND_MOVE(CameraLens)\n \n \tint validateLensDriver();\n+\tvoid updateControls();\n \n \tconst MediaEntity *entity_;\n \tstd::unique_ptr<V4L2Subdevice> subdev_;\n \n \tstd::string model_;\n+\n+\tControlInfoMap controls_;\n };\n \n } /* namespace libcamera */\ndiff --git a/src/libcamera/camera_lens.cpp b/src/libcamera/camera_lens.cpp\nindex b3d48199ec3b..08c2c42a9cfa 100644\n--- a/src/libcamera/camera_lens.cpp\n+++ b/src/libcamera/camera_lens.cpp\n@@ -9,6 +9,7 @@\n \n #include <libcamera/base/utils.h>\n \n+#include \"libcamera/internal/control_ids.h\"\n #include \"libcamera/internal/v4l2_subdevice.h\"\n \n /**\n@@ -73,6 +74,9 @@ int CameraLens::init()\n \t\treturn ret;\n \n \tmodel_ = subdev_->model();\n+\n+\tupdateControls();\n+\n \treturn 0;\n }\n \n@@ -124,6 +128,13 @@ int CameraLens::validateLensDriver()\n \treturn ret;\n }\n \n+/**\n+ * \\fn CameraLens::controls()\n+ * \\brief Retrieve the CameraLens controls limits\n+ *\n+ * \\return The ControlInfoMap with the CameraLens controls limits\n+ */\n+\n /**\n  * \\fn CameraLens::model()\n  * \\brief Retrieve the lens model name\n@@ -139,15 +150,21 @@ std::string CameraLens::logPrefix() const\n \treturn \"'\" + entity_->name() + \"'\";\n }\n \n-/**\n- * \\fn CameraLens::controls()\n- * \\brief Retrieve the V4L2 controls of the lens' subdev\n- *\n- * \\return A map of the V4L2 controls supported by the lens' driver\n- */\n-const ControlInfoMap &CameraLens::controls() const\n+void CameraLens::updateControls()\n {\n-\treturn subdev_->controls();\n+\tControlInfoMap::Map controls;\n+\n+\t/* The lens driver has been validate, the control is there. */\n+\tconst ControlInfoMap &lensControls = subdev_->controls();\n+\tconst ControlInfo &focusAbsolute = lensControls.at(V4L2_CID_FOCUS_ABSOLUTE);\n+\n+\tcontrols[&controls::internal::draft::LensFocusAbsolute] =\n+\t\tControlInfo(focusAbsolute.min().get<int32_t>(),\n+\t\t\t    focusAbsolute.max().get<int32_t>(),\n+\t\t\t    focusAbsolute.def().get<int32_t>());\n+\n+\tcontrols_ = ControlInfoMap(std::move(controls),\n+\t\t\t\t   controls::internal::controls);\n }\n \n } /* namespace libcamera */\n",
    "prefixes": [
        "libcamera-devel",
        "v3",
        "22/23"
    ]
}