Show a patch.

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

{
    "id": 17359,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/17359/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/17359/",
    "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": "<37d32be5-5d65-3d9d-b40a-78781f6820de@gmx.de>",
    "date": "2022-09-10T13:15:09",
    "name": "[libcamera-devel] Fwd: [PATCH v4 1/2] libcamera: control_serializer: store/load all ControlValue types",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "fd98f49526765cb3db8a6042853929803bdf21b9",
    "submitter": {
        "id": 111,
        "url": "https://patchwork.libcamera.org/api/1.1/people/111/?format=api",
        "name": "Christian Rauch",
        "email": "Rauch.Christian@gmx.de"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/17359/mbox/",
    "series": [
        {
            "id": 3480,
            "url": "https://patchwork.libcamera.org/api/1.1/series/3480/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3480",
            "date": "2022-09-10T13:15:09",
            "name": "[libcamera-devel] Fwd: [PATCH v4 1/2] libcamera: control_serializer: store/load all ControlValue types",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/3480/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/17359/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/17359/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 E42A8C0DA4\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 10 Sep 2022 13:15:11 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3356C620A8;\n\tSat, 10 Sep 2022 15:15:11 +0200 (CEST)",
            "from mout.gmx.net (mout.gmx.net [212.227.15.18])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id BE2E161F97\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 10 Sep 2022 15:15:09 +0200 (CEST)",
            "from [192.168.0.158] ([88.152.184.103]) by mail.gmx.net (mrgmx005\n\t[212.227.17.190]) with ESMTPSA (Nemesis) id\n\t1MtwZ4-1pKQ0v0vC0-00uFDm for\n\t<libcamera-devel@lists.libcamera.org>; Sat, 10 Sep 2022 15:15:09 +0200"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1662815711;\n\tbh=P8IG4LuTNwd+tk2pNyPtqEwa7eFBKyyng1fnYF0dSdc=;\n\th=Date:References:To:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=D3TnXtU5PddO4Y+C7gsCdpgtIfvH/kfdEI2Ax1lh3CqAAuZQBLl3sODiHwBC7vdmn\n\ti9ypJT6cumm3HAiDHDjer1KLtPklqxTIIiVC4k0Ld5K9762Ee/ndM0JMpHEpUEKKri\n\tDGHQLJqnJbrjjGM+z9T1d0cGeBt2v2BbXRWWSteqVntxGF9vwMp3r5N6p6+V8bebC7\n\t3Oi57YEq1sDo+Ecbq5YqfXs88gUOW7cZtxXPo965xT4nTWd0M2K0KNK/AZOIpmEC1C\n\tdCrhJQ7sjWwKfDxQrm89ZHYoXTuFEwH0BSlCFEo0ROojAAJH2u82eRacWMRXRS9mf4\n\tu2YK3Rdu2dirg==",
            "v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;\n\ts=badeba3b8450; t=1662815709;\n\tbh=P8IG4LuTNwd+tk2pNyPtqEwa7eFBKyyng1fnYF0dSdc=;\n\th=X-UI-Sender-Class:Date:Subject:References:To:From:In-Reply-To;\n\tb=ABrR2uO6OBiaKzZNXfIjU7VaPq1CEV4v+tb3RD8vNi3CxnMem7n5phvQYxPt5MpCg\n\tc+xcA7C9EPsVamHo6m9C5Ps5LIDpTO4ia7HN473+pQtucaLMrW2J9ms/d1bdOf/HnL\n\tudg7Z46VQ2lr7n7W+53FhdEARPcP/lNhcMNUXd/4="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=gmx.net header.i=@gmx.net\n\theader.b=\"ABrR2uO6\"; dkim-atps=neutral",
        "X-UI-Sender-Class": "01bb95c1-4bf8-414a-932a-4f6e2808ef9c",
        "Message-ID": "<37d32be5-5d65-3d9d-b40a-78781f6820de@gmx.de>",
        "Date": "Sat, 10 Sep 2022 15:15:09 +0200",
        "MIME-Version": "1.0",
        "User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101\n\tThunderbird/91.11.0",
        "References": "<20220903213330.213117-1-Rauch.Christian@gmx.de>",
        "Content-Language": "en-GB",
        "To": "libcamera devel <libcamera-devel@lists.libcamera.org>",
        "In-Reply-To": "<20220903213330.213117-1-Rauch.Christian@gmx.de>",
        "X-Forwarded-Message-Id": "<20220903213330.213117-1-Rauch.Christian@gmx.de>",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "7bit",
        "X-Provags-ID": "V03:K1:3FKfe1lBpfZ/AGUU65k5m8Oip2SvE8BpiQgzkNJClX9kOvYCsfd\n\t6AQ5PDQRu1KqJiaUzhkhdh+mb7ybcj5KT1zwRq6ajxCuCZfese2Z+cJGD/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/gB6IMe3xUB4NxTsqLYFQKerZdo9oYCBToNR42p1\n\tLbTXg3YrNxWx2bThuwBf7VnzvyiZ7ErnBc6jRFXpyT8cLZlBxtgVEGwhTlZlvOoy1zpcUeaoI\n\t5CVkuF6P3omeNQaR/m9rXiULyY2P4+ycNpx7/eo0h0lFeWTt+bnt6JTOAwd7m27eBA6MHaDYR\n\t7ygTbRrwxoDg86DIrZmm/Fn8UkdeQad9Vf+K3ofTkALwaEAPZ3twUnNhP4YWzoasWBO+08Gp7\n\tnnIjQsIxcDN4ct+jtqVOMfDb3NuJmecucdt6YgLYduM+Z111RCKGHEQwzD/JfRsdCiZia5LmS\n\t/m95Ya74N3l0u7g3nmIckOHau+",
        "Subject": "[libcamera-devel] Fwd: [PATCH v4 1/2] libcamera:\n\tcontrol_serializer: store/load all ControlValue types",
        "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": "Christian Rauch via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Christian Rauch <Rauch.Christian@gmx.de>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Hi,\n\nTo bring this up to attention again, is this something you are willing\nto merge to fix the issue 137?\n\nBest,\nChristian\n\n\n-------- Weitergeleitete Nachricht --------\nBetreff: [PATCH v4 1/2] libcamera: control_serializer: store/load all\nControlValue types\nDatum: Sat,  3 Sep 2022 23:33:29 +0200\nVon: Christian Rauch <Rauch.Christian@gmx.de>\nAn: libcamera-devel@lists.libcamera.org\nKopie (CC): Christian Rauch <Rauch.Christian@gmx.de>, Paul Elder\n<paul.elder@ideasonboard.com>\n\nThe min/max/def ControlValue of a ControlInfo can take arbitrary types that\nare different from each other and different from the ControlId type.\nThe serialiser serialises these ControlValue separately by their type but\ndoes not store the type. The deserialiser assumes that ControlValue types\nmatch the ControlId type. If this is not the case, deserialisation will try\nto deserialise values of the wrong type.\n\nFix this by serialising each of the min/max/def ControlValue's ControlType\nand storing it just before the serialised ControlValue.\n\nFixes: https://bugs.libcamera.org/show_bug.cgi?id=137\n\nSigned-off-by: Christian Rauch <Rauch.Christian@gmx.de>\nTested-by: Paul Elder <paul.elder@ideasonboard.com>\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n---\n .../libcamera/internal/control_serializer.h   |  4 +--\n src/libcamera/control_serializer.cpp          | 28 +++++++++----------\n 2 files changed, 15 insertions(+), 17 deletions(-)\n\n\n@@ -379,11 +381,13 @@ int ControlSerializer::serialize(const ControlList\n&list,\n \treturn 0;\n }\n\n-ControlValue ControlSerializer::loadControlValue(ControlType type,\n-\t\t\t\t\t\t ByteStreamBuffer &buffer,\n+ControlValue ControlSerializer::loadControlValue(ByteStreamBuffer &buffer,\n \t\t\t\t\t\t bool isArray,\n \t\t\t\t\t\t unsigned int count)\n {\n+\tControlType type;\n+\tbuffer.read(&type);\n+\n \tControlValue value;\n\n \tvalue.reserve(type, isArray, count);\n@@ -392,15 +396,11 @@ ControlValue\nControlSerializer::loadControlValue(ControlType type,\n \treturn value;\n }\n\n-ControlInfo ControlSerializer::loadControlInfo(ControlType type,\n-\t\t\t\t\t       ByteStreamBuffer &b)\n+ControlInfo ControlSerializer::loadControlInfo(ByteStreamBuffer &b)\n {\n-\tif (type == ControlTypeString)\n-\t\ttype = ControlTypeInteger32;\n-\n-\tControlValue min = loadControlValue(type, b);\n-\tControlValue max = loadControlValue(type, b);\n-\tControlValue def = loadControlValue(type, b);\n+\tControlValue min = loadControlValue(b);\n+\tControlValue max = loadControlValue(b);\n+\tControlValue def = loadControlValue(b);\n\n \treturn ControlInfo(min, max, def);\n }\n@@ -513,7 +513,7 @@ ControlInfoMap\nControlSerializer::deserialize<ControlInfoMap>(ByteStreamBuffer &\n \t\t}\n\n \t\t/* Create and store the ControlInfo. */\n-\t\tctrls.emplace(controlId, loadControlInfo(type, values));\n+\t\tctrls.emplace(controlId, loadControlInfo(values));\n \t}\n\n \t/*\n@@ -624,10 +624,8 @@ ControlList\nControlSerializer::deserialize<ControlList>(ByteStreamBuffer &buffer\n \t\t\treturn {};\n \t\t}\n\n-\t\tControlType type = static_cast<ControlType>(entry->type);\n \t\tctrls.set(entry->id,\n-\t\t\t  loadControlValue(type, values, entry->is_array,\n-\t\t\t\t\t   entry->count));\n+\t\t\t  loadControlValue(values, entry->is_array, entry->count));\n \t}\n\n \treturn ctrls;\n--\n2.34.1",
    "diff": "diff --git a/include/libcamera/internal/control_serializer.h\nb/include/libcamera/internal/control_serializer.h\nindex 99e57fee..a38ca6b0 100644\n--- a/include/libcamera/internal/control_serializer.h\n+++ b/include/libcamera/internal/control_serializer.h\n@@ -47,9 +47,9 @@ private:\n \tstatic void store(const ControlValue &value, ByteStreamBuffer &buffer);\n \tstatic void store(const ControlInfo &info, ByteStreamBuffer &buffer);\n\n-\tControlValue loadControlValue(ControlType type, ByteStreamBuffer &buffer,\n+\tControlValue loadControlValue(ByteStreamBuffer &buffer,\n \t\t\t\t      bool isArray = false, unsigned int count = 1);\n-\tControlInfo loadControlInfo(ControlType type, ByteStreamBuffer &buffer);\n+\tControlInfo loadControlInfo(ByteStreamBuffer &buffer);\n\n \tunsigned int serial_;\n \tunsigned int serialSeed_;\ndiff --git a/src/libcamera/control_serializer.cpp\nb/src/libcamera/control_serializer.cpp\nindex e87d2362..0cf719bd 100644\n--- a/src/libcamera/control_serializer.cpp\n+++ b/src/libcamera/control_serializer.cpp\n@@ -144,7 +144,7 @@ void ControlSerializer::reset()\n\n size_t ControlSerializer::binarySize(const ControlValue &value)\n {\n-\treturn value.data().size_bytes();\n+\treturn sizeof(ControlType) + value.data().size_bytes();\n }\n\n size_t ControlSerializer::binarySize(const ControlInfo &info)\n@@ -195,6 +195,8 @@ size_t ControlSerializer::binarySize(const\nControlList &list)\n void ControlSerializer::store(const ControlValue &value,\n \t\t\t      ByteStreamBuffer &buffer)\n {\n+\tconst ControlType type = value.type();\n+\tbuffer.write(&type);\n \tbuffer.write(value.data());\n }\n",
    "prefixes": [
        "libcamera-devel"
    ]
}