Patch Detail
Show a patch.
GET /api/1.1/patches/21634/?format=api
{ "id": 21634, "url": "https://patchwork.libcamera.org/api/1.1/patches/21634/?format=api", "web_url": "https://patchwork.libcamera.org/patch/21634/", "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": "<20241015203820.574326-5-stefan.klug@ideasonboard.com>", "date": "2024-10-15T20:38:15", "name": "[v1,4/4] pycamera: Add missing code for ControlTypePoint", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "217302df1a33ca17d0e1df1cd3577dc209f5f598", "submitter": { "id": 184, "url": "https://patchwork.libcamera.org/api/1.1/people/184/?format=api", "name": "Stefan Klug", "email": "stefan.klug@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/21634/mbox/", "series": [ { "id": 4702, "url": "https://patchwork.libcamera.org/api/1.1/series/4702/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4702", "date": "2024-10-15T20:38:11", "name": "A few small fixes", "version": 1, "mbox": "https://patchwork.libcamera.org/series/4702/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/21634/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/21634/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 320FEC326C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 15 Oct 2024 20:38:38 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C55E865389;\n\tTue, 15 Oct 2024 22:38:37 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E356C65379\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 15 Oct 2024 22:38:35 +0200 (CEST)", "from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:64d4:9f74:8308:300d])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 281B3A2F;\n\tTue, 15 Oct 2024 22:36:54 +0200 (CEST)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"Vvnxa59A\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1729024614;\n\tbh=eUrFix+5tWyE6Ubky4DRITsWu8HFMtP2T/hJgisvR2c=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=Vvnxa59AbUp28jrqNx1pMnQ4maDPLUBtRIZf+khfkEAifOfQ8Y7HO/4Twj3DmkAxK\n\t8GjTwy0TxOJ1Hd+aknkAJ4uKBeoIR4VOw9o2fViLYNtrKDWJ6Mpg4Nzn5mJMWHHP1q\n\taH5NJGMMGPR5KpWVwtpDa1oidx1YBPcJWKwrTDco=", "From": "Stefan Klug <stefan.klug@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Stefan Klug <stefan.klug@ideasonboard.com>", "Subject": "[PATCH v1 4/4] pycamera: Add missing code for ControlTypePoint", "Date": "Tue, 15 Oct 2024 22:38:15 +0200", "Message-ID": "<20241015203820.574326-5-stefan.klug@ideasonboard.com>", "X-Mailer": "git-send-email 2.43.0", "In-Reply-To": "<20241015203820.574326-1-stefan.klug@ideasonboard.com>", "References": "<20241015203820.574326-1-stefan.klug@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "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>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "In the python bindings ControlTypePoint is not handled in the\ncorresponding conversion functions. Add that.\n\nWhile at it, sort the listings in the same order as the enum in\ncontrols.h.\n\nFixes: 200d535ca85f (\"libcamera: controls: Add ControlTypePoint\")\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n---\n src/py/libcamera/py_enums.cpp | 3 ++-\n src/py/libcamera/py_helpers.cpp | 16 ++++++++++------\n 2 files changed, 12 insertions(+), 7 deletions(-)", "diff": "diff --git a/src/py/libcamera/py_enums.cpp b/src/py/libcamera/py_enums.cpp\nindex ca6aeb868cbe..9e75ec1a97b3 100644\n--- a/src/py/libcamera/py_enums.cpp\n+++ b/src/py/libcamera/py_enums.cpp\n@@ -32,7 +32,8 @@ void init_py_enums(py::module &m)\n \t\t.value(\"Float\", ControlType::ControlTypeFloat)\n \t\t.value(\"String\", ControlType::ControlTypeString)\n \t\t.value(\"Rectangle\", ControlType::ControlTypeRectangle)\n-\t\t.value(\"Size\", ControlType::ControlTypeSize);\n+\t\t.value(\"Size\", ControlType::ControlTypeSize)\n+\t\t.value(\"Point\", ControlType::ControlTypePoint);\n \n \tpy::enum_<Orientation>(m, \"Orientation\")\n \t\t.value(\"Rotate0\", Orientation::Rotate0)\ndiff --git a/src/py/libcamera/py_helpers.cpp b/src/py/libcamera/py_helpers.cpp\nindex 79891ab63862..1ad1d4c1a1cd 100644\n--- a/src/py/libcamera/py_helpers.cpp\n+++ b/src/py/libcamera/py_helpers.cpp\n@@ -34,6 +34,8 @@ static py::object valueOrTuple(const ControlValue &cv)\n py::object controlValueToPy(const ControlValue &cv)\n {\n \tswitch (cv.type()) {\n+\tcase ControlTypeNone:\n+\t\treturn py::none();\n \tcase ControlTypeBool:\n \t\treturn valueOrTuple<bool>(cv);\n \tcase ControlTypeByte:\n@@ -46,14 +48,14 @@ py::object controlValueToPy(const ControlValue &cv)\n \t\treturn valueOrTuple<float>(cv);\n \tcase ControlTypeString:\n \t\treturn py::cast(cv.get<std::string>());\n-\tcase ControlTypeRectangle:\n-\t\treturn valueOrTuple<Rectangle>(cv);\n \tcase ControlTypeSize: {\n \t\tconst Size *v = reinterpret_cast<const Size *>(cv.data().data());\n \t\treturn py::cast(v);\n \t}\n-\tcase ControlTypeNone:\n-\t\treturn py::none();\n+\tcase ControlTypeRectangle:\n+\t\treturn valueOrTuple<Rectangle>(cv);\n+\tcase ControlTypePoint:\n+\t\treturn valueOrTuple<Point>(cv);\n \tdefault:\n \t\tthrow std::runtime_error(\"Unsupported ControlValue type\");\n \t}\n@@ -73,6 +75,8 @@ static ControlValue controlValueMaybeArray(const py::object &ob)\n ControlValue pyToControlValue(const py::object &ob, ControlType type)\n {\n \tswitch (type) {\n+\tcase ControlTypeNone:\n+\t\treturn ControlValue();\n \tcase ControlTypeBool:\n \t\treturn ControlValue(ob.cast<bool>());\n \tcase ControlTypeByte:\n@@ -89,8 +93,8 @@ ControlValue pyToControlValue(const py::object &ob, ControlType type)\n \t\treturn controlValueMaybeArray<Rectangle>(ob);\n \tcase ControlTypeSize:\n \t\treturn ControlValue(ob.cast<Size>());\n-\tcase ControlTypeNone:\n-\t\treturn ControlValue();\n+\tcase ControlTypePoint:\n+\t\treturn controlValueMaybeArray<Point>(ob);\n \tdefault:\n \t\tthrow std::runtime_error(\"Control type not implemented\");\n \t}\n", "prefixes": [ "v1", "4/4" ] }