Show a patch.

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

{
    "id": 15794,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/15794/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/15794/",
    "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": "<20220505104104.70841-12-tomi.valkeinen@ideasonboard.com>",
    "date": "2022-05-05T10:41:02",
    "name": "[libcamera-devel,v7,11/13] py: support controls in the start method",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "5d19b2923fc5731f39323cb7b54317a3314c1cb3",
    "submitter": {
        "id": 109,
        "url": "https://patchwork.libcamera.org/api/1.1/people/109/?format=api",
        "name": "Tomi Valkeinen",
        "email": "tomi.valkeinen@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/15794/mbox/",
    "series": [
        {
            "id": 3093,
            "url": "https://patchwork.libcamera.org/api/1.1/series/3093/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3093",
            "date": "2022-05-05T10:40:51",
            "name": "Python bindings",
            "version": 7,
            "mbox": "https://patchwork.libcamera.org/series/3093/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/15794/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/15794/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 17081C3271\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  5 May 2022 10:41:38 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 65A636566F;\n\tThu,  5 May 2022 12:41:37 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8C22560424\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  5 May 2022 12:41:31 +0200 (CEST)",
            "from deskari.lan (91-156-85-209.elisa-laajakaista.fi\n\t[91.156.85.209])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id ED9B4492;\n\tThu,  5 May 2022 12:41:30 +0200 (CEST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1651747297;\n\tbh=na9LqJT9Kll4y+N+bUCkl2veymqhxZf7LnOIYxMG3tE=;\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=oDluzx7eH51RY7+IgMbjRBcKd9vV0T7Po5EUdL6ECjxTVrAlpbIL8B8RLu9ZuBCxC\n\tUIvAZ4MgFIdsccrxHguaDUJn/5/CliYtwPBrEWfVSdYN7BY1YxKt3dGqtROqCrzAtb\n\tZ06ruNuXlGU1O0hvbfF5gs5xWMwmAY+UKCdJKF6bzFWYE40CIUuoJCEqF3yeIGGCDb\n\tywWdv6iIM9pfskLnM17reF7A2+xS6huA0rZMq0Gj78CGkHXgDFAUOyiRhddSOUQmTe\n\tEXNaTWiuWQHVdF2db1UWAw+EcjURKA0nEDOqoz0sEJY4rkmBl2XidjutID0tgfDnH4\n\tmNHXKEn2vAEhQ==",
            "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1651747291;\n\tbh=na9LqJT9Kll4y+N+bUCkl2veymqhxZf7LnOIYxMG3tE=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=tq+jH4hoHbGD8fOfI0iqpkIN7en9Yj/rJ4Dfoj2x0ld3j0oVY8v02Di7h764l2XFZ\n\tu8OURpVZcuY5s8Aa7d1fjrfZKMo23kBgyJ5XCy7jF0U/VmTDW6/GRveKkfCg1I2kjZ\n\tpVzN+a0Hf5wugKLcQSc+NUyh0j/jSAb61+ZMl8+U="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"tq+jH4ho\"; dkim-atps=neutral",
        "To": "libcamera-devel@lists.libcamera.org,\n\tDavid Plowman <david.plowman@raspberrypi.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tJacopo Mondi <jacopo@jmondi.org>",
        "Date": "Thu,  5 May 2022 13:41:02 +0300",
        "Message-Id": "<20220505104104.70841-12-tomi.valkeinen@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20220505104104.70841-1-tomi.valkeinen@ideasonboard.com>",
        "References": "<20220505104104.70841-1-tomi.valkeinen@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v7 11/13] py: support controls in the\n\tstart method",
        "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": "Tomi Valkeinen via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "From: David Plowman <david.plowman@raspberrypi.com>\n\nLibcamera has for a while allowed controls to be set in the camera's\nstart method. The Python bindings need to permit this too.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\nSigned-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>\n---\n src/py/libcamera/pymain.cpp | 25 ++++++++++++++++++++++---\n 1 file changed, 22 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/src/py/libcamera/pymain.cpp b/src/py/libcamera/pymain.cpp\nindex c442ad50..6375e326 100644\n--- a/src/py/libcamera/pymain.cpp\n+++ b/src/py/libcamera/pymain.cpp\n@@ -250,15 +250,34 @@ PYBIND11_MODULE(_libcamera, m)\n \t\t.def_property_readonly(\"id\", &Camera::id)\n \t\t.def(\"acquire\", &Camera::acquire)\n \t\t.def(\"release\", &Camera::release)\n-\t\t.def(\"start\", [](Camera &self) {\n+\t\t.def(\"start\", [](Camera &self, py::dict controls) {\n \t\t\tself.requestCompleted.connect(handleRequestCompleted);\n \n-\t\t\tint ret = self.start();\n+\t\t\tconst ControlInfoMap &controlMap = self.controls();\n+\t\t\tControlList controlList(controlMap);\n+\t\t\tfor (const auto& [hkey, hval]: controls) {\n+\t\t\t\tauto key = hkey.cast<std::string>();\n+\n+\t\t\t\tauto it = find_if(controlMap.begin(), controlMap.end(),\n+\t\t\t\t\t\t  [&key](const auto &kvp) {\n+\t\t\t\t\t\t\t  return kvp.first->name() == key; });\n+\n+\t\t\t\tif (it == controlMap.end())\n+\t\t\t\t\tthrow runtime_error(\"Control \" + key + \" not found\");\n+\n+\t\t\t\tconst auto &id = it->first;\n+\t\t\t\tauto obj = py::cast<py::object>(hval);\n+\n+\t\t\t\tcontrolList.set(id->id(), PyToControlValue(obj, id->type()));\n+\t\t\t}\n+\n+\t\t\tint ret = self.start(&controlList);\n \t\t\tif (ret)\n \t\t\t\tself.requestCompleted.disconnect(handleRequestCompleted);\n \n \t\t\treturn ret;\n-\t\t})\n+\t\t},\n+\t\tpy::arg(\"controls\") = py::dict())\n \n \t\t.def(\"stop\", [](Camera &self) {\n \t\t\tint ret = self.stop();\n",
    "prefixes": [
        "libcamera-devel",
        "v7",
        "11/13"
    ]
}